Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread
Message: 66909
BY: Mike Pomraning (pilcrow)
DATE: 2009-03-27 03:59
SUBJECT: Connection-aware DBI::TypeUtil conversions

 

I suggest that DBI::TypeUtil in dbi-0.4.1 is flawed in that conversion routines do not take into account the current connection. Strings, for instance, must be encoded as appropriate for a connection's character set.

This is the reason that PQescapeString() is deprecated in favor of PQescapeStringConn(), mysql_escape_string() in favor of mysql_real_escape_string(), and so on.

IIUC, connection-awareness in type conversion would be a broad but internal change, perhaps something like:

DBI::TypeUtil.register_conversion("mydriver") do |obj, conn|
# obj is the value to be SQL-ified, and conn is the current
# DBD::MyDriver::Database
...
end

Sorry if this is a known issue or already on the roadmap.

-Mike


Thread View

Thread Author Date
Connection-aware DBI::TypeUtil conversionsMike Pomraning2009-03-27 03:59

Post a followup to this message