[Dbix-class] Field types and Sybase

Jonathan Batchelor jmb at atuin.co.uk
Tue Jan 30 12:21:14 GMT 2007


(Apologies I sent this to the wrong list earlier).

I have a problem with some of the field types set up in my Database and 
wondered if anyone can help me to define it within my model properly. 
The errors I get are as follows:

Caught exception in ReCharge::Controller::Contracts->url_create 
"DBIx::Class::ResultSet::create(): Error executing 'INSERT INTO 
contracts (amount, contract, end_date, start_date) VALUES ('1000', 
'Test', '12/31/07 23:59:59', '01/01/07 00:00:00')': Server message 
number=257 severity=16 state=1 line=1 server=DBSERVER text=Implicit 
conversion from datatype 'VARCHAR' to 'MONEY' is not allowed.  Use the 
CONVERT function to run this query."

undef error - DBIx::Class::AccessorGroup::__ANON__(): Error executing 
'SELECT me.contract_id, me.contract, me.amount, me.start_date, 
me.end_date FROM contracts me WHERE ( ( ( me.contract_id = '2' ) ) )': 
Server message number=257 severity=16 state=1 line=1 server=DBSERVER 
text=Implicit conversion from datatype 'VARCHAR' to 'INT' is not 
allowed. Use the CONVERT function to run this query.

The database is Sybase and I think the fields both (MONEY and INT types) 
need to be entered without quotes in the SQL, as Sybase won't implicitly 
convert them unfortunately.
Sybase datatype conversion info is here: 
http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/34781;pt=35709

I have searched all over for information on how to specify the data type 
or get it to not use quotes for specific fields, but have found all the 
information quite confusing!

Thanks in advance for any assistance,
Jonathan.



More information about the Dbix-class mailing list