[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 104/151: Improve Noalyss_SQL : add set and ge
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 104/151: Improve Noalyss_SQL : add set and get |
Date: |
Sat, 4 Feb 2017 17:14:32 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit c320ed75a4d198dc02dc77476d677c5392fc67d8
Author: Rachel <address@hidden>
Date: Thu Jan 5 15:02:59 2017 +0100
Improve Noalyss_SQL : add set and get
Signed-off-by: Dany De Bontridder <address@hidden>
---
include/database/class_noalyss_sql.php | 39 +++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/include/database/class_noalyss_sql.php
b/include/database/class_noalyss_sql.php
index 1844f19..21babcd 100644
--- a/include/database/class_noalyss_sql.php
+++ b/include/database/class_noalyss_sql.php
@@ -77,7 +77,10 @@ abstract class Noalyss_SQL
$this->cn=$p_cn;
$pk=$this->primary_key;
$this->$pk=$p_id;
-
+ // check that the definition is correct
+ if (count($this->name) != count($this->type) {
+ throw new Exception (__FILE__." $this->table Cannot
instantiate");
+ }
/* Initialize an empty object */
foreach ($this->name as $key)
{
@@ -100,7 +103,37 @@ abstract class Noalyss_SQL
else
$this->update();
}
+ /**
+ address@hidden get the value thanks the colum name and not the alias
(name).
+ address@hidden getp
+ */
+ public function get($p_string)
+ {
+ if (array_key_exists($p_string, $this->type)) {
+ $idx=$this->type[$p_string];
+ return $this->$idx;
+ }
+ else
+ throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur
attribut inexistant '.$p_string);
+ }
+ /**
+ address@hidden set the value thanks the colum name and not the alias
(name)
+ address@hidden setp
+ */
+ public function set($p_string, $p_value)
+ {
+ if (array_key_exists($p_string, $this->type)) {
+ $idx=$this->type[$p_string];
+ $this->$idx=$p_value;
+ } else
+ throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur
attribut inexistant '.$p_string);
+ }
+
+ /**
+ address@hidden set the value thanks the alias name instead of the colum
name
+ address@hidden get
+ */
public function getp($p_string)
{
if (array_key_exists($p_string, $this->name)) {
@@ -111,6 +144,10 @@ abstract class Noalyss_SQL
throw new Exception(__FILE__.":".__LINE__.$p_string.'Erreur
attribut inexistant '.$p_string);
}
+ /**
+ address@hidden set the value thanks the alias name instead of the colum
name
+ address@hidden set
+ */
public function setp($p_string, $p_value)
{
if (array_key_exists($p_string, $this->name)) {
- [Noalyss-commit] [noalyss] 108/151: Noalyss_SQL add function get_pk_value for getting the value of the PK, (continued)
- [Noalyss-commit] [noalyss] 108/151: Noalyss_SQL add function get_pk_value for getting the value of the PK, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 75/151: Scenario pour dév. de comptabilité analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 70/151: sécurité Task #8 - Sécurité protection SQL, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 64/151: Clean code, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 79/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] 81/151: syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 88/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 93/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 95/151: Problème htmlentities : charset par défaut différent entre version, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 91/151: Improve Performance Acc_Bilan::warning, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 104/151: Improve Noalyss_SQL : add set and get,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 107/151: Add Receipt number to detail operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 118/151: correct typo, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 124/151: Test ManageTable ; fix parseXML function, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 129/151: #1380 : Duplication d'opérations, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 138/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 134/151: Fix Bug : Predefined operation in Sales , impossible to add new items, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 139/151: ManageTable correct color of HighLigthed row, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 140/151: ManageTable use icon, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 136/151: Esthetic for duplicate operation & Correct esthetic, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 72/151: Documentation Task #2 - Documentation nouveau code, Dany De Bontridder, 2017/02/04