dblayer : Force using UTF8 for MySQL and PostgreSQL
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1811 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
10
dblayer.php
10
dblayer.php
@@ -115,6 +115,14 @@ class dblayer extends PDO
|
||||
// Force ForeignKeys support (disabled by default)
|
||||
$this->db->exec("PRAGMA foreign_keys = ON");
|
||||
break;
|
||||
case "mysql":
|
||||
// Set the coding to UTF8
|
||||
$this->db->exec("SET CHARACTER SET utf8");
|
||||
break;
|
||||
case "pgsql":
|
||||
// Set the coding to UTF8
|
||||
$this->db->exec("SET CHARACTER SET utf8");
|
||||
break;
|
||||
}
|
||||
$this->dsn = $dsn;
|
||||
}
|
||||
@@ -354,7 +362,7 @@ class dblayer extends PDO
|
||||
$value = md5 ($value);
|
||||
});
|
||||
$req = "INSERT INTO `$this->tableprefix$this->table` ";
|
||||
$req .= "(\"".implode ("\",\"", array_keys ($datasOK))."\")";
|
||||
$req .= "(`".implode ("`,`", array_keys ($datasOK))."`)";
|
||||
$req .= " VALUES ";
|
||||
$req .= "(:".implode (",:", $binds).")";
|
||||
if ($this->debug) echo "DEBUG : $req\n";
|
||||
|
||||
Reference in New Issue
Block a user