diff --git a/ecrire/req/mysql.php b/ecrire/req/mysql.php index 6e73f0238d0d4016857a854a61db20737ca105b5..c1485d44c9fe767c68afe69cff1dfa54e9506ccc 100644 --- a/ecrire/req/mysql.php +++ b/ecrire/req/mysql.php @@ -734,7 +734,7 @@ function spip_mysql_quote($v, $type='') { return spip_mysql_cite($v,$type); // si c'est un tableau, le parcourir en propageant le type foreach($v as $k=>$r) - $v[$k] = spip_mysql_quote($r, $type=''); + $v[$k] = spip_mysql_quote($r, $type); return $v; } // si on ne connait pas le type, s'en remettre a _q : @@ -792,6 +792,7 @@ function calcul_mysql_in($val, $valeurs, $not='') { // http://doc.spip.org/@spip_mysql_cite function spip_mysql_cite($v, $type) { + if(is_null($v)) return 'NULL'; // null php se traduit en NULL SQL if (sql_test_date($type) AND preg_match('/^\w+\(/', $v)) return $v; if (sql_test_int($type)) { diff --git a/ecrire/req/pg.php b/ecrire/req/pg.php index 4ce170fc2877d2b76cca4636bbd092fd43930c0d..39dbed192f91a8277e9a36472796ab96c700c3e8 100644 --- a/ecrire/req/pg.php +++ b/ecrire/req/pg.php @@ -978,8 +978,9 @@ function spip_pg_sequence($table) // Dans le cas d'un champ date, pas d'apostrophe, c'est une syntaxe ad hoc // http://doc.spip.org/@spip_pg_cite -function spip_pg_cite($v, $t) -{ +function spip_pg_cite($v, $t){ + if(is_null($v)) return 'NULL'; // null php se traduit en NULL SQL + if (sql_test_date($t)) { if (strpos("0123456789", $v[0]) === false) return spip_pg_frommysql($v); diff --git a/ecrire/req/sqlite_generique.php b/ecrire/req/sqlite_generique.php index 0942b670ad5330dbf6f92846a34ca5784ee45fa3..5a467134c5094b9aaf3b87916ea9b562a9f6f4cb 100644 --- a/ecrire/req/sqlite_generique.php +++ b/ecrire/req/sqlite_generique.php @@ -1285,6 +1285,8 @@ function _sqlite_link($serveur = '', $recharger = false){ * @return number */ function _sqlite_calculer_cite($v, $type){ + if(is_null($v)) return 'NULL'; // null php se traduit en NULL SQL + if (sql_test_date($type) AND preg_match('/^\w+\(/', $v)) return $v; if (sql_test_int($type)){ @@ -1293,8 +1295,7 @@ function _sqlite_calculer_cite($v, $type){ if (ctype_xdigit(substr($v, 2)) AND strncmp($v, '0x', 2)==0) return hexdec(substr($v, 2)); } - //else return ("'" . spip_sqlite_quote($v) . "'"); - return (spip_sqlite_quote($v)); + return spip_sqlite_quote($v,$type); }