Req #52267 [Opn->Ver]: add collation to mysqli::set_charset
Edit report at http://bugs.php.net/bug.php?id=52267&edit=1
ID: 52267
Updated by: andrey@php.net
Reported by: gutzmer at usa dot net
Summary: add collation to mysqli::set_charset
-Status: Open
+Status: Verified
Type: Feature/Change Request
Package: MySQLi related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: mysql
Previous Comments:
------------------------------------------------------------------------
[2010-07-06 19:07:01] gutzmer at usa dot net
Description:
------------
According to the docs, mysqli::set_charset "is the preferred way to
change the charset. Using mysqli::query() to execute SET NAMES .. is
not recommended."
But when using the MySQLi extension, the only way to use a collation
other than the default for a particular charset is to send a SET NAMES
... with a COLLATION clause.
mysqli::set_charset should have a second (Optional) "string $collation"
parameter to allow users to set the charset and collation without
resorting to the 'not recommended' direct query method. When the
optional parameter is not set, is null, casts to Boolean FALSE, or is an
invalid choice for the charset passed in the first parameter, the
connection should use the default collation for the selected charset.
MySQL already handles error conditions relating to charset/collation
mismatches, so there should be no great added overhead to the source
code logic implementing the MySQLi function.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52267&edit=1
Thread (4 messages)