[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 20/151: Database Ajout d'une fonction pour re
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 20/151: Database Ajout d'une fonction pour retirer une seule ligne |
Date: |
Sat, 4 Feb 2017 17:14:24 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 913d737534af28985013720d5ad20be3fcf44274
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] 11/151: Merge branch 'master' of ssh://ns3git/srv/git/noalyss, (continued)
- [Noalyss-commit] [noalyss] 11/151: Merge branch 'master' of ssh://ns3git/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 15/151: Performance : replace Anc_Grandlivre->display_html with Anc_Grandlivre->load, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 14/151: adapt for php 7.0, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 06/151: improve CSS theme, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 21/151: Documentation Task #2 - Documentation nouveau code, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 18/151: adapt for php 7.0, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 16/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 19/151: sécurité Task #8 - Sécurité protection SQL, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 24/151: Scenario pour dév. de comptabilité analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 17/151: add newline at the end of file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 20/151: Database Ajout d'une fonction pour retirer une seule ligne,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 23/151: Export en PDF d'operation : PDF_Operation::print_section Task #10 - PDF_Operation : ajout titre Analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 26/151: Scenario test pour PDF_Operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 30/151: syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 29/151: Export Detail Operation Analytique + Document, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 25/151: Ajout options Task #9 - PDF_Operation : ajout des options, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 12/151: Clean code, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 28/151: PDF Operation ajout détail opération pour GrandLivre ANC , export des pièces avec tampon, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 31/151: Remove useless file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 33/151: Performance : improve VERIF , change query pour fiche utilisé avec 2 postes, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 42/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04