[PATCH][RESUBMIT] mysql_db_quote + UTF8 flagged strings
"Ruslan U. Zakirov" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Hello. I didn't get any feedback on patch, but it is still major problem for users of UTF8 strings cause we have to workaround DBD::mysql behavior. Attached patch fix problems for users of perl5.8.x when somebody try quote strings with UTF8 flag enabled: $new_str = $dbh->quote( $utf_str ); # new_str lost UTF flag. DBD::mysql doesn't preserve UTF8 flag. This is wrong because in future if you try to join quoted string with another UTF string then quoted part would be corrupted. This patch fix DBD::mysql quote sub which should copy UTF8 flag if it is was set on src str. Best regards. Ruslan. PS. May be PERL_VERSION check should be changed to right values, I don't know when exactly UTF8 flag was introduced. -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]
mysql_quote_utf_fix.patch
(application/aegis-patch, 441 B)
diff -ru DBD-mysql-2.9003/dbdimp.c DBD-mysql-2.9003-my/dbdimp.c
--- DBD-mysql-2.9003/dbdimp.c 2003-10-17 21:20:50.000000000 +0400
+++ DBD-mysql-2.9003-my/dbdimp.c 2004-05-03 21:12:41.000000000 +0400
@@ -2449,6 +2449,10 @@
*sptr++ = '\0'; /* Never hurts NUL terminating a Perl
* string ...
*/
+#if ((PERL_REVISION >= 5) && (PERL_VERSION >= 8))
+ if(SvUTF8(str))
+ SvUTF8_on(result);
+#endif
}
return result;
}