}
#bye($this->db()->type);
+ if ($type_from == 'mysql') $views = []; # Mysql store sql create view in mysql format wich only works with mysql
foreach (array_merge($tables,$views) as $t) {
# DROP / CREATE
if (strpos($this->type,'date') !== false) return 'NULL';
}
- if (!($db = $this->db())) return "'".preg_replace("/'/","''",$value)."'";
+ if (!($db = $this->db())) return "'".str_replace("'","''",$value)."'";
+
+ if ($fct=$db->conf_type('quote_field')) return $fct($value);
return $db->quote($value);
} else {
$DB_TYPES['pgsql'] = array (
'extra_where' => 'denorm',
'regexp' => '~',
-# NB 04.12.17 'quote_name' => '"',
+# NB 04.12.17: Overwrite db->quote because of bugs with INSERT INTO
+# NB 04.12.17 'quote_name' => "'",
# NB 04.12.17 'quote' => function($str) {
# NB 04.12.17 global $DB_TYPES;
# NB 04.12.17 $chr = $DB_TYPES['pgsql']['quote_name'];
# NB 04.12.17 str_replace($chr,$chr.$chr,$str);
# NB 04.12.17 return $chr . $str . $chr;
# NB 04.12.17 },
+'quote_field' => function($str) {
+ $chr = "'";
+ $str = str_replace($chr,$chr.$chr,$str);
+ return $chr . $str . $chr;
+},
'localFile' => array (getenv('HOME').'/.pgpass','^[^:]+:[^:]+:<D.NAME>:(?P<user>[^:]+):(?<password>[^:]+)'),