]> git.nbdom.net Git - nb.git/commitdiff
try to escape chars when dbq2...
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 28 Sep 2016 16:20:50 +0000 (18:20 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 28 Sep 2016 16:20:50 +0000 (18:20 +0200)
lib/php/db.php
lib/php/db/table.php
lib/php/db/types/sqlite.php

index 0304ffa09154ea695ec29b24133715ed3ff845b4..00fde73f61c8fc22eb47f0d568560c5b0fb0cd7f 100644 (file)
@@ -822,6 +822,9 @@ class Db extends nb {
       echo rtrim($s,';').";\n";
     }
 
+      #bye($this->db()->type);
+    $fct = $this->conf_type('table.sql.create',false);
+    if (!$fct) $fct = false;
     foreach ($tables as $t) {
 
       # DROP / CREATE
@@ -855,6 +858,7 @@ class Db extends nb {
         $t->rows();
         if ($type_to) $this->type = $type_to;
       }
+
     }
 
     $i = 0; foreach ((array)$this->method('sql.post') as $s) {
index a4ab811238d613da6d0831a3dc2f53abd01eba55..9f85f3b26a20329f1dd7c2545715addb9f2ffee5 100644 (file)
@@ -985,8 +985,10 @@ Class Table extends nb {
       $keys[] = $f->sql_name();
     }
 
-    return "INSERT INTO ".$this->sql_name()." VALUES (".join(',',array_values($values)).");".NB_EOL;
-    return "INSERT INTO ".$this->sql_name()." (".join(',',$keys).") VALUES (".join(',',array_values($values)).");".NB_EOL;
+    $sql = "INSERT INTO ".$this->sql_name()." VALUES (".join(',',array_values($values)).");";
+    #$sql = "INSERT INTO ".$this->sql_name()." (".join(',',$keys).") VALUES (".join(',',array_values($values)).");";
+    #if ($fct and $this->name=='place') debug($sql);
+    return $sql.NB_EOL;
   }
 
   public function rows_end_sql() {
index ab3f220f0a00a3576b3b40af50e13fafe5ac1153..0e6ed43a524fa73e53d053bbfce7e21057372f2a 100644 (file)
@@ -107,6 +107,10 @@ $DB_TYPES['sqlite'] = array (
 'table.sql.create' => function($sql,$t) {
   #$sql .= $t->db()->row("SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name=".$t->sql_name());
   $sql = str_replace("\\'","''",$sql);
+  #$sql = preg_replace("/\\'/","''",$sql);
+  #$sql = 'espace';
+  #$sql = "zaza $sql";
+  #debug($sql);
   return $sql;
 },
 );?>