From: "Maarten Coene" <[EMAIL PROTECTED]>

> Hi,
>
> I have the problem that the doSelect(Criteria) method of my Peer classes
> does behave different when using different databases.
>
> For example: suppose I have a simple table (TEST) where the primary key
> column (ID) is of type INTEGER. If I create this Criteria:
>
> Criteria crit = new Criteria();
> crit.add(TestPeer.ID, "123");
> TestPeer.doSelect(crit);
>
> everything works fine. But if I execute this query:
>
> Criteria crit = new Criteria();
> crit.add(TestPeer.ID, "abc");
> TestPeer.doSelect(crit);
>
> it goes wrong:
> - MySQL is returning an empty list on this query
> - Oracle is throwing a TorqueException (saying something like: given value
> is not a valid number)

I believe that's more of a difference in databases (or the JDBC drivers of
those databases);  Oracle throws an error if you try to specifiy a string
for an Integer column, MySQL doesn't care, and returns empty results.
There's really no way of Torque knowing if it will get an error or an empty
resultSet, since it's DB independent.  You might want to check the data
clientside to make sure that what's going into the SQL query really is an
integer, so the results from Torque will be predictable.

>
> I'm using Torque b2.
>
> thanks,
> Maarten

Roy


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to