Author: capttofu
Date: Mon Mar 19 19:45:21 2007
New Revision: 9279
Modified:
DBD-mysql/trunk/ChangeLog
DBD-mysql/trunk/dbdimp.c
DBD-mysql/trunk/dbdimp.h
DBD-mysql/trunk/t/utf8.t
Log:
UTF8-Flag not set with flag mysql_enable_utf8 and column collation utf8_bin patch,
Joost Diepenmaat, (RT #24738)
Modified: DBD-mysql/trunk/ChangeLog
==============================================================================
--- DBD-mysql/trunk/ChangeLog (original)
+++ DBD-mysql/trunk/ChangeLog Mon Mar 19 19:45:21 2007
@@ -5,6 +5,11 @@
patch from Philip Stoev)
* Add support for mysql_multi_statements connection option. (RT #12322, based
on patch from Doug Morris)
+* Had to bump to 4.003 do to print statement in mysql.pm that made it
+ into the dist. Even though you can delete a file on CPAN, you cannot
+ re-upload it if it's the same name. Mea Culpa.
+* UTF8-Flag not set with flag mysql_enable_utf8 and column collation utf8_bin patch,
+ Joost Diepenmaat, (RT #24738)
2007-3-5 Patrick Galbraith <patg@stripped> Jim Winstead <jimw@stripped>
(4.003)
* Fix inclusion of non-primary keys in primary_key_info. (Bug #26786,
@@ -18,9 +23,9 @@
was specified)
* Fixed $DBD::mysql::VERSION to be a string instead of a float, which caused
problems for certain locales
-* Fixed bug #23974. $dbh->column_info now returns empty arrayref upon table not
- existing. Much thanks to Tim Bunce for help fixing the problem in mysql.pm
- vs. dbdimp.c
+* Fixed bug #23974. $dbh->column_info now returns handle with no rows upon
+ table not existing. Much thanks to Tim Bunce for help fixing the problem
+ in mysql.pm vs. dbdimp.c
* Removed #ifdefs for do error (sqlstate being passed as last arg depending on
version)
* Fixed insertid test to work with auto_increment_increment replication setup.
Modified: DBD-mysql/trunk/dbdimp.c
==============================================================================
--- DBD-mysql/trunk/dbdimp.c (original)
+++ DBD-mysql/trunk/dbdimp.c Mon Mar 19 19:45:21 2007
@@ -3657,7 +3657,13 @@
sv_setpvn(sv, col, len);
/* UTF8 */
#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
+
+#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION
+ /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */
+ if (imp_dbh->enable_utf8 && fields[i].charsetnr != 63)
+#else
if (imp_dbh->enable_utf8 && !(fields[i].flags & BINARY_FLAG))
+#endif
sv_utf8_decode(sv);
#endif
/* END OF UTF8 */
Modified: DBD-mysql/trunk/dbdimp.h
==============================================================================
--- DBD-mysql/trunk/dbdimp.h (original)
+++ DBD-mysql/trunk/dbdimp.h Mon Mar 19 19:45:21 2007
@@ -29,6 +29,7 @@
* statements as opposed to emulation in the driver
*/
#define SQL_STATE_VERSION 40101
+#define FIELD_CHARSETNR_VERSION 40101 /* should equivalent to 4.1.0 */
#define MULTIPLE_RESULT_SET_VERSION 40102
#define SERVER_PREPARE_VERSION 40103
#define LIMIT_PLACEHOLDER_VERSION 50100
Modified: DBD-mysql/trunk/t/utf8.t
==============================================================================
--- DBD-mysql/trunk/t/utf8.t (original)
+++ DBD-mysql/trunk/t/utf8.t Mon Mar 19 19:45:21 2007
@@ -102,7 +102,7 @@
# Create a new table; In an ideal world, it'd be more sensible to
# make the whole database UTF8...
#
- $query = "CREATE TABLE $table (name VARCHAR(64) CHARACTER SET utf8, bincol BLOB,
shape GEOMETRY)";
+ $query = "CREATE TABLE $table (name VARCHAR(64) CHARACTER SET utf8, bincol BLOB,
shape GEOMETRY, binutf VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_bin)";
Test($state or $dbh->do($query))
or ErrMsgF("Cannot create table: Error %s.\n", $dbh->errstr);
@@ -126,11 +126,11 @@
Test( $state or ( $dbh->{ mysql_enable_utf8 } ) )
or ErrMsg( "mysql_enable_utf8 didn't survive connect()\n" );
- $query = qq{INSERT INTO $table (name, bincol, shape) VALUES (?,?,
GeomFromText('Point(132865 501937)'))};
- Test( $state or $dbh->do( $query, {}, $utf8_str,$blob ) )
+ $query = qq{INSERT INTO $table (name, bincol, shape, binutf) VALUES (?,?,
GeomFromText('Point(132865 501937)'), ?)};
+ Test( $state or $dbh->do( $query, {}, $utf8_str,$blob, $utf8_str ) )
or ErrMsgF( "INSERT failed: query $query, error %s.\n", $dbh->errstr );
- $query = "SELECT name,bincol,asbinary(shape) FROM $table LIMIT 1";
+ $query = "SELECT name,bincol,asbinary(shape), binutf FROM $table LIMIT 1";
Test( $state or ($sth = $dbh->prepare( $query ) ) )
or ErrMsgF( "prepare failed: query $query, error %s.\n", $dbh->errstr );
@@ -143,7 +143,14 @@
# Finally, check that we got back UTF-8 correctly.
Test( $state or ($ref->[0] eq $utf8_str) )
- or ErrMsgF( "got back '$ref->[0]' instead of '$utf8_str'.\n" );
+ or ErrMsgF( "got back '$ref->[0]' instead of '$utf8_str' (normal utf8
collation).\n" );
+
+ # same as above for utf8_bin column
+ Test( $state or ($ref->[3] eq $utf8_str) )
+ or ErrMsgF( "got back '$ref->[3]' instead of '$utf8_str' (binary utf8
collation).\n" );
+
+
+
if (eval "use Encode;") {
# Check for utf8 flag
| Thread |
|---|
| • [svn:DBD-mysql] r9279 - in DBD-mysql/trunk: . t | capttofu | 20 Mar |