Re: AW: Oracle - Null and Zero-length string problem

2006-10-08 Thread Thomas Vandahl

Thoralf Rickert wrote:

? Does this work in Oracle. In MySQL this isn't a problem.


Actually, it is. At least it may be. In MySQL I can distinguish between 
NULL and an empty string. In Oracle I can't. But it is not the same 
thing. There are quite some things I don't like about MySQL, but in this 
case I believe it provides the better solution.


Bye, Thomas.


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



AW: Oracle - Null and Zero-length string problem

2006-10-06 Thread Thoralf Rickert
Just one idea - I'm not using Oracle - but what about:

  (column = '' OR column IS NULL)

In Torque

  Criteria.Criterion c1 = criteria.getNewCriterion(COLUMN, , Criteria.EQUAL);
  Criteria.Criterion c2 = criteria.getNewCriterion(COLUMN, (Object)null, 
Criteria.ISNULL);
  criteria.add(c1.or(c2));

? Does this work in Oracle. In MySQL this isn't a problem.


 -Ursprüngliche Nachricht-
 Von: Parthasarathy Thandavarayan 
 [mailto:[EMAIL PROTECTED] 
 Gesendet: Dienstag, 3. Oktober 2006 06:18
 An: torque-user@db.apache.org
 Betreff: Oracle - Null and Zero-length string problem
 
 
 Hi all,
 
 I am working on an framework that uses torque 3.2 as the ORM 
 layer. Everything works perfectly on MySQL 4.1 and I am right 
 now trying to make it work on Oracle 10g also. One of the 
 problems i am facing is with respect to the difference in the 
 way oracle handles zero-length strings ('') when compared to 
 other dbs. In oracle zero-length strings are treated as null. 
 If we are inserting '' in a column and query it back with 
 where clause -- where column = ''  no rows will be 
 returned. We should rather query it with the where clause -- 
 where column is null. 
 On other dbs for eg., MySQL 4.1 the where clause condition 
 should be -- where column = ''. 
 
 If I change the where clause to IS NULL then the app wont 
 work on MySQL.. If I retain it as '' then it wont work on 
 Oracle. Can anyone help me with a solution or workaround for this? 
 
 One possible way to make it work is by changing the 
 SQLExpression class to convert the criteria to null from '' 
 if the db is oracle. Is there anyother way to make this work? 
 the only restriction is that the same where clause should 
 work on all dbs
 
 
 Thanks,
 
 Sarathy
 
  
 


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



AW: Oracle - Null and Zero-length string problem

2006-10-06 Thread Thoralf Rickert
 Why cannot we write a code in this method which simply says - 
  if db is of type dboracle and if criteria= then criteria is null

Maybe because nobody wrote a patch or a jira issue. :)

http://issues.apache.org/jira/browse/TORQUE



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



Re: AW: Oracle - Null and Zero-length string problem

2006-10-06 Thread Bill Leng
the actual code that does db operation is in village.jar which is not a 
part of Torque.


Thoralf Rickert wrote:
Why cannot we write a code in this method which simply says - 
if db is of type dboracle and if criteria= then criteria is null



Maybe because nobody wrote a patch or a jira issue. :)

http://issues.apache.org/jira/browse/TORQUE



-
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]