db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "parthasarathy (JIRA)" <j...@apache.org>
Subject [jira] Created: (TORQUE-58) Where clause with zero length string should be converted to NULL if db is Oracle
Date Mon, 09 Oct 2006 08:29:19 GMT
Where clause with zero length string should be converted to NULL if db is Oracle
--------------------------------------------------------------------------------

                 Key: TORQUE-58
                 URL: http://issues.apache.org/jira/browse/TORQUE-58
             Project: Torque
          Issue Type: Bug
          Components: Runtime
    Affects Versions: 3.2.1
         Environment: All OS, All Hardware, Oracle db
            Reporter: parthasarathy
             Fix For: 3.2.1


Oracle treats Zero length characters as NULL. Consider the following case 
-- Table create --
create table nullzero (field1 varchar2(10), field2 varchar2(10));

-- Record insert --
insert into nullzero('',null);

-- Query --

select * from nullzero where field1 = "" -- returns no rows

select * from nullzero where field2 is null -- returns the inserted row

select * from nullzero where field1 is null -- returns the inserted row.


The first statement should have returned a record as we inserted "" for field1. But it did
not return a row as Oracle has converted the "" to NULL during insert. We cannot change the
where clause as we want the criteria to be db agnostic. For example the first statement would
have worked in other dbs. 

We should handle this case in torque to change the where clause to NULL if it is "" (zero
length string) . One place where we can do this is at build() method of org.apache. torque.util.SQLExpression.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message