[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 190/219: Database : get_value throw an error
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 190/219: Database : get_value throw an error if SQL failed |
Date: |
Mon, 18 Dec 2017 13:23:01 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 0e304db73002de1c2933d530503028682005d9df
Author: Dany De Bontridder <address@hidden>
Date: Sat Dec 9 15:54:01 2017 +0100
Database : get_value throw an error if SQL failed
---
include/lib/database.class.php | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/include/lib/database.class.php b/include/lib/database.class.php
index e484713..258bd45 100644
--- a/include/lib/database.class.php
+++ b/include/lib/database.class.php
@@ -561,18 +561,23 @@ class Database
function get_value($p_sql, $p_array=null)
{
- $this->ret=$this->exec_sql($p_sql, $p_array);
- $r=pg_NumRows($this->ret);
- if ($r==0)
- return "";
- if ($r>1)
- {
- $array=pg_fetch_all($this->ret);
- throw new Exception("Attention $p_sql retourne
".pg_NumRows($this->ret)." valeurs ".
- var_export($p_array, true)." values=".var_export($array, true));
- }
- $r=pg_fetch_row($this->ret, 0);
- return $r[0];
+ try {
+ $this->ret=$this->exec_sql($p_sql, $p_array);
+ $r=pg_NumRows($this->ret);
+ if ($r==0)
+ return "";
+ if ($r>1)
+ {
+ $array=pg_fetch_all($this->ret);
+ throw new Exception("Attention $p_sql retourne
".pg_NumRows($this->ret)." valeurs ".
+ var_export($p_array, true)." values=".var_export($array,
true));
+ }
+ $r=pg_fetch_row($this->ret, 0);
+ return $r[0];
+
+ } catch (Exception $ex) {
+ throw($ex);
+ }
}
/**
* @brief return the number of rows affected by the previous query
- [Noalyss-commit] [noalyss] 194/219: Select_box : fix position, (continued)
- [Noalyss-commit] [noalyss] 194/219: Select_box : fix position, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 176/219: Change autocomplete and adapt Icard setWidth is false + indicator icon for ICard, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 202/219: ManageTable.js : change Manage.delete by Manage.remove, because delete is a reserved keyword, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 181/219: Fix ID problem, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 163/219: Code cleaning, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 213/219: Code rewrite : move the function HtmlInput::select_ledger into Acc_Ledger_Search::select_ledger, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 197/219: Task #001381 : enlève , ajout de la nouvelle liste dans la liste, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 183/219: Icon move / fix, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 211/219: Bug : in recherche the ledger choice is transparent, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 162/219: Constant add an exception code for duplicate, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 190/219: Database : get_value throw an error if SQL failed,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 30/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation 1. Correct export CSV 2. Improve code : new function Acc_Reconciliation:get_amount_noautovat, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 133/219: #0001414: LETTRAGE - montants différents non indiqués Les montants différents pour un lettrage sont marqués avec un triangle orange Changement des requêtes SQL , peut avoir un prob. de performance pour gros volume, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 70/219: Task #0001475: VEN / ACH opération prédéfinie , il manque le bouton "Fermer", Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 131/219: Bug : correct catch clause , getMessage is wrong must be replaced by message, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 203/219: Task #0001507: Click sur détail opérations apparaît trop haut Fixed for IE8 : use documentElement.scrollTop, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 191/219: Database : improve message when exec_sql failed, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 185/219: Fix problem with invalid unicode sequence, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 178/219: NEW : add iselect , display a list with options, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 200/219: Task #0001507: Click sur détail opérations apparaît trop haut Use the function window.pageYOffset instead of window.scrollY, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 123/219: Anc ODS : check date is valid and comment not empty, remove debug, Dany De Bontridder, 2017/12/18