noalyss-commit
[Top][All Lists]
Advanced

[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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]