[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 71/151: Database Ajout d'une fonction pour re
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 71/151: Database Ajout d'une fonction pour retirer une seule ligne |
Date: |
Sat, 4 Feb 2017 17:14:29 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit bd9a731854f635c368e2842702e4a16475c105fe
Author: Dany De Bontridder <address@hidden>
Date: Sat Nov 26 20:41:19 2016 +0100
Database Ajout d'une fonction pour retirer une seule ligne
---
include/lib/class_database.php | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/include/lib/class_database.php b/include/lib/class_database.php
index c2d1b78..eff5a44 100644
--- a/include/lib/class_database.php
+++ b/include/lib/class_database.php
@@ -589,12 +589,29 @@ class Database
{
$r=$this->exec_sql($p_sql, $p_array);
- if (($Max=pg_NumRows($r))==0)
+ if (pg_NumRows($r)==0)
return array();
$array=pg_fetch_all($r);
return $array;
}
-
+ /**
+ * Returns only one row from a query
+ * @param string $p_sql
+ * @param array $p_array
+ * @return array , idx = column of the table or null if nothing is found
+ * @throws Exception if too many rows are found code 100
+ */
+ function get_row($p_sql,$p_array=NULL) {
+ $array=$this->get_array($p_sql,$p_array);
+ if (empty($array) ) return null;
+ if (count($array)==1) return $array[0];
+ throw new Exception("Database:get_row retourne trop de lignes",100);
+ }
+ /**
+ * @brief Create a sequence
+ * @param string $p_name Sequence Name
+ * @param int $min starting value
+ */
function create_sequence($p_name, $min=1)
{
if ($min<1)
- [Noalyss-commit] [noalyss] 58/151: IDate : admit date from before 2000, (continued)
- [Noalyss-commit] [noalyss] 58/151: IDate : admit date from before 2000, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 63/151: Update doc, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 66/151: adapt for php 7.0, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 68/151: add newline at the end of file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 69/151: adapt for php 7.0, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 80/151: Export Detail Operation Analytique + Document, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 47/151: Correct simul.py remove old file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 77/151: Scenario test pour PDF_Operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 82/151: Remove useless file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 78/151: Scenario test pour PDF_Operation Task #9 - PDF_Operation : ajout des options, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 71/151: Database Ajout d'une fonction pour retirer une seule ligne,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 97/151: update of the config.inc.example file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 94/151: Fix problem of accentuated char, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 105/151: Noalyss_SQL Fix bug in set and get fct, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 103/151: Timestamp instead of date, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 90/151: Improve Acc_Bilan::warning, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 87/151: Performance : improve VERIF , Improve Accounting check, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 92/151: Fix config.inc.php : add carriage return, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 106/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 85/151: Performance : improve VERIF , Affiche uniquement journaux incorrects, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 86/151: Performance : improve VERIF , Totaux Actif/Passif, Charge/Produit, Dany De Bontridder, 2017/02/04