Home » Database » DB » Bug #7857
Improve a little package DB (add an option for mysqli connector already present
Details
| Request #7857 | Improve a little package DB (add an option for mysqli connector already present |
|---|---|
| Submitted | 2006-06-10 16:27 UTC |
| From | rapsys at free dot fr |
| Status | Wont fix |
| Package | DB |
| PHP Version | 5.1.4 |
| OS | Mandriva 2007 (Cooker) |
| Roadmaps | (Not assigned) |
Comments
[2006-06-10 16:27 UTC] rapsys at free dot fr
Description:
------------
Hi, I know that PEAR DB package is yet deprecated and is
intended to be
replaced by the new mdb2.
But I have a small feature request that requires ading 4-5
lines and a comment
line in the file : /usr/share/pear/DB/mysqli.php
ps: I treated the fact that php set charset fail as a non
fatal error (as mysqli is avaible from mysql 4.1 to mysql
5.x and only mysql5 support utf8 for example)
The patch :
--- /usr/share/pear/DB/mysqli.php~ 2006-05-05
19:37:08.000000000 +0200
+++ /usr/share/pear/DB/mysqli.php 2006-06-10
01:03:20.523531813 +0200
@@ -242,6 +242,7 @@ class DB_mysqli extends DB_common
* + capath The path to a directory that
contains trusted SSL
* CA certificates in pem format.
* + cipher The list of allowable ciphers for
SSL encryption.
+ * + charset The default character set for a
database.
*
* Example of how to connect using SSL:
* <code>
@@ -336,6 +337,12 @@ class DB_mysqli extends DB_common
}
}
+ if (!empty($dsn['charset'])) {
+ if (!mysqli_set_charset($this->connection,
$dsn['charset'])) {
+ printf("Error loading character set
{$dsn['charset']}: %s\n",
mysqli_error($this->connection));
+ }
+ }
+
if ($dsn['database']) {
$this->_db = $dsn['database'];
}