I haven't coded in the DBI for a while now. Nonetheless, I would try binding parameters using $sth->bind_param(). For instance, given that $dbh is a valid database handler:
$sth->prepare("UPDATE table SET column_1 = ? WHERE id = 1");
$sth->bind_param(1, 221783, { TYPE => SQL_VARCHAR });
$sth->execute();
According to Programming the Perl DBI, DBD::ODBC supports placeholders, so hopefully this will work.
This does not mean that the module supports money columns--you'll have to try the type_info() and type_info_all() methods, as in:
print $dbh->type_info_all(); This will (hopefully) return all the datatypes supported by Microsoft SQL Server and DBD::ODBC. I can't really answer for sure, as I do not use SQL Server or ODBC.
Hope this helps.
-ppm | [reply] [d/l] [select] |
We used this for a while at work, ie MS SQL Server with DBI & DBD::ODBC & openlink. I seem to remember that
the money field is buggy in DBD::ODBC or maybe it was in the openlink driver.
My memory of the problem was that money fields needed to be strings when input to the DBI ie in '', sending them as numbers ie without '' or as placeholders didn't work. (Or possibly the other way round - it was a while ago now.) I remember that we could never get the money fields to be entered as placeholders though.
We solved this problem (and many others) by switching to MySQL ;-) | [reply] |