On 1/24/06, John Siracusa <[EMAIL PROTECTED]> wrote: > Note the funky B'00' syntax for setting the default bitfield value. > DBD::mysql's inability to deal with this is the main source of our woes. To > wit: > > $sth = $dbh->prepare('UPDATE photos SET fl = ? WHERE id = 1'); > $sth->execute(...); > ^^^ > | > See that underlined part above? As far as I've been able to determine, > there's nothing you can put there to make the above code work correctly. > Bare numbers, strings, I even tried using pack() to create the correct > binary format. All attempts failed. DBD::mysql takes whatever I pass it > and then quotes it as a string. Then that string is evaluated in "bitfield" > context in the db and you get garbage values.
Ahhh ... there's a solution here. *grins* I provided a patch to DBD::mysql to do param type guessing using the undocumented mysql_unsafe_bind_type_guessing attribute. Currently, if set, it will determine if it's SQL_VARCHAR or SQL_INTEGER based on the following rules: 1) If a '-' is seen and it's not in the first position, it's VARCHAR 2) If a second '.' is seen, it's VARCHAR 3) If a character doesn't pass isdigit(), it's VARCHAR 4) Otherwise, it's INTEGER The idea is that if it's SQL_INTEGER, it doesn't get $dbh->quote()'ed. This feature was added in 2.9015_2 and released to the general public in 3.000. (I really need to get Patrick to change the log from Dragonchild to Rob Kinyon.) Rob ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object