[Dbix-class] mssql 'convert' function in DBIx::Class
listinfo at banfieldgroup.com
Thu Aug 9 17:56:35 GMT 2007
On Thu, 9 Aug 2007 13:58:25 +0100
Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Wed, Aug 08, 2007 at 10:06:01AM -0700, Michael Higgins wrote:
> > Hello --
> > I'm working with a SQL Server 2000 database. One of the columns is of type 'money'.
> > I've come to understand the issue I have originates with DBI placeholders which cause an error about not automagically converting the datatype. (Changing the datatype isn't an option, something to do with MSAccess.)
> If you bound it as the appropriate type, would it work?
Unless there is some magic *other* than importing :sql_types and using bind_param on my $statement_handle... no. Is this what you refer to?
If I understand at all what is going on, it is having the placeholder for that field when the $sth is 'prepared' -- that is the problem. It appears the solution is the convert statement must be _in_ the SQL when the SQL is parsed by the (driver? server?) and the statement handle is created.
So, can I use DBIx::Class to get that 'convert' function mapped onto an accessor when I create the files for the schema? Or can I make a custom resultset (or something) to do the same, but still use $result->accessor functions?
Anyway, it'd be nice if there was a standard workaround to the error (here's the text):
DBD::Sybase::db prepare failed: Server message number=260 severity=16 state=1 line=1 server=SERVER text=Disallowed implicit conversion from data type varchar to data type money, table 'DB.dbo.DATA', column 'Total Cost'. Use the CONVERT function to run this query.Server message number=8180 severity=16 state=1 line=1 server=SERVER procedure=sp_prepare text=Statement(s) could not be prepared. at test_syb.pl line 20.
Michael Higgins <listinfo at banfieldgroup.com>
More information about the DBIx-Class