1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 03:10:14 +02:00

MySQL, MySQLi & PostgreSql drivers: default character set is 'utf8' (BC break)

This commit is contained in:
David Grudl
2010-08-04 15:35:34 +02:00
parent 76783b3872
commit 9f982cb310
4 changed files with 7 additions and 5 deletions

View File

@@ -22,7 +22,7 @@
* - password (or pass)
* - database => the database name to select
* - flags (int) => driver specific constants (MYSQL_CLIENT_*)
* - charset => character encoding to set
* - charset => character encoding to set (default is utf8)
* - persistent (bool) => try to find a persistent link?
* - unbuffered (bool) => sends query without fetching and buffering the result rows automatically?
* - sqlmode => see http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
@@ -74,6 +74,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
} else {
// default values
DibiConnection::alias($config, 'flags', 'options');
if (!isset($config['charset'])) $config['charset'] = 'utf8';
if (!isset($config['username'])) $config['username'] = ini_get('mysql.default_user');
if (!isset($config['password'])) $config['password'] = ini_get('mysql.default_password');
if (!isset($config['host'])) {

View File

@@ -23,7 +23,7 @@
* - database => the database name to select
* - options (array) => array of driver specific constants (MYSQLI_*) and values {@see mysqli_options}
* - flags (int) => driver specific constants (MYSQLI_CLIENT_*) {@see mysqli_real_connect}
* - charset => character encoding to set
* - charset => character encoding to set (default is utf8)
* - persistent (bool) => try to find a persistent link?
* - unbuffered (bool) => sends query without fetching and buffering the result rows automatically?
* - sqlmode => see http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
@@ -75,6 +75,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
} else {
// default values
if (!isset($config['charset'])) $config['charset'] = 'utf8';
if (!isset($config['username'])) $config['username'] = ini_get('mysqli.default_user');
if (!isset($config['password'])) $config['password'] = ini_get('mysqli.default_pw');
if (!isset($config['socket'])) $config['socket'] = ini_get('mysqli.default_socket');

View File

@@ -18,7 +18,7 @@
* - host, hostaddr, port, dbname, user, password, connect_timeout, options, sslmode, service => see PostgreSQL API
* - string => or use connection string
* - schema => the schema search path
* - charset => character encoding to set
* - charset => character encoding to set (default is utf8)
* - persistent (bool) => try to find a persistent link?
* - resource (resource) => existing connection resource
* - lazy, profiler, result, substitutes, ... => see DibiConnection options
@@ -62,6 +62,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
$this->connection = $config['resource'];
} else {
if (!isset($config['charset'])) $config['charset'] = 'utf8';
if (isset($config['string'])) {
$string = $config['string'];
} else {

View File

@@ -45,7 +45,7 @@ echo "</p>\n";
// connects to MySQL using DSN
echo '<p>Connecting to MySQL: ';
try {
dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=utf8');
dibi::connect('driver=mysql&host=localhost&username=root&password=xxx&database=test&charset=cp1250');
echo 'OK';
} catch (DibiException $e) {
@@ -65,7 +65,6 @@ try {
'username' => 'root',
'password' => 'xxx',
'database' => 'dibi',
'charset' => 'utf8',
'options' => array(
MYSQLI_OPT_CONNECT_TIMEOUT => 30
),