is this worth filing a bug report? And one more notice the really bad thing about this bug is that SQL-Server e.g. does not produce an error when it parses a line like this:

SELECT IF('a_id>1',`a_id`,`dd_legacy_agent_code`) AS `Vertreter`, ...

It interprets 'a_id>1' as an negative value and because of this returns always the value of dd_legacy_agent_code.

Tom

Tom Schindl wrote:
Ok. Now I got i my own:

1. The Problem:
===============
A line like
-------------8<-------------
SELECT IF(a_id>1,a_id,dd_legacy_agent_code) AS Vertreter, ...
-------------8<-------------

Arrives at the database side like this:
-------------8<-------------
SELECT IF('a_id>1',`a_id`,`dd_legacy_agent_code`) AS `Vertreter`, ...
-------------8<-------------

Please notice the ' in the expression used.


2. The Workaround: ================== -------------8<------------- IF(strcmp(a_id,'1'),a_id,dd_legacy_agent_code) AS Vertreter, ... -------------8<-------------

This is parsed by OO as well as arriving on Db-Side as:

-------------8<-------------
SELECT IF( strcmp( `a_id`, '1' ), `a_id`, `dd_legacy_agent_code` ) AS `Vertreter`, ...
-------------8<-------------



3. Conclusion:
==============
The OO-SQL-Parser is useless when working with more complex SQL-Statements which is not a big problem when working directly with result-sets(switch to direct mode) but is really a pain when it comes to situations where one could not turn into direct-mode e.g. when importing things.


Tom

Tom Schindl wrote:

Has anybody an idea how one could have something like switch-case
with OO parsing the SQL-Statement?

Tom



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




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



Reply via email to