How about the old stand-by "1=1"?



    |-----Original Message-----
    |From: Goncalo Luiz [mailto:[EMAIL PROTECTED]]
    |Sent: Friday, January 31, 2003 7:44 PM
    |To: OJB-ML
    |Subject: True value in OQL
    |
    |
    |Hello.
    |I'm constructin a highly dynamic OQL query string. In some 
    |specific cases I
    |must include certain clauses...but this clauses are absent 
    |in other specific
    |cases.
    |To avoid extremly complicated if / then /else I concluded 
    |that it would be
    |easier to use a "true" value in the query string:
    |
    |query = "select from CLASS" + "where (true and"
    |if (certain case) then query += "variable < x";
    |if (certain case) then query += "variable2 < y";
    |query += "and 1)"
    |
    |thus, I must not test if there is already a condition, and 
    |then to include
    |an "and" etc...
    |
    |The problem is, OQL doesn't like "true" neither "one".
    |What value may I use to force a positive comparision ?
    |In SQL if I use the query "select * from TABLE where 1" I 
    |get all the rows.
    |
    |Thanks
    |Gonçalo D. Luiz IST, Portugal.
    |
    |
    |
    |-----------------------------------------------------------
    |----------
    |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