[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 25/27: Code rewriting : accept table with a t
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 25/27: Code rewriting : accept table with a text PK |
Date: |
Sun, 02 Nov 2014 11:08:53 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 5cd6c9fd18e7ff5a0b935b41295479608f4cf3bd
Author: Dany De Bontridder <address@hidden>
Date: Sun Nov 2 11:55:17 2014 +0100
Code rewriting : accept table with a text PK
---
include/class_noalyss_sql.php | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/include/class_noalyss_sql.php b/include/class_noalyss_sql.php
index b73f67b..51549c2 100644
--- a/include/class_noalyss_sql.php
+++ b/include/class_noalyss_sql.php
@@ -158,8 +158,8 @@ class Noalyss_SQL
public function delete()
{
$pk=$this->primary_key;
- $sql=" delete from ".$this->table." where
".$this->primary_key."=".sql_string($this->$pk);
- $this->cn->exec_sql($sql);
+ $sql=" delete from ".$this->table." where ".$this->primary_key."= $1";
+ $this->cn->exec_sql($sql,array($this->$pk));
}
public function update()
@@ -189,7 +189,8 @@ class Noalyss_SQL
$set="";
$idx++;
}
- $sql.=" where ".$this->primary_key." =".$this->$pk;
+ $array[]=$this->$pk;
+ $sql.=" where ".$this->primary_key." = $".$idx;
$this->cn->exec_sql($sql, $array);
}
@@ -214,8 +215,10 @@ class Noalyss_SQL
}
$pk=$this->primary_key;
$sql.=" from ".$this->table;
- $sql.=" where ".$this->primary_key." = ".$this->$pk;
- $result=$this->cn->get_array($sql);
+
+ $sql.=" where ".$this->primary_key." = $1";
+
+ $result=$this->cn->get_array($sql,array ($this->$pk));
if ($this->cn->count()==0)
{
$this->$pk=-1;
- [Noalyss-commit] [noalyss] 12/27: resize icon, (continued)
- [Noalyss-commit] [noalyss] 12/27: resize icon, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 14/27: Cosmetique remove border, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 10/27: Correct mes Task #1038 - Recherche de fiche par poste comptable, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 17/27: Traduction, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 19/27: Last version of prototype + patch, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 23/27: Documentation, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 18/27: Documentation, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 22/27: Documentation, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 24/27: Code rewriting, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 16/27: Search by accounting Task #1038 - Recherche de fiche par poste comptable, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 25/27: Code rewriting : accept table with a text PK,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 26/27: Code rewriting : change due to change of menu_ref_sql, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 15/27: Button_image for search card, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 21/27: New functionnal test, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 27/27: Test unitaire avec PHPUNIT, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 20/27: Translation progress, Dany De Bontridder, 2014/11/02
- [Noalyss-commit] [noalyss] 05/27: Mise a jour traduction, Dany De Bontridder, 2014/11/02