db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fox (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (TORQUE-58) Where clause with zero length string should be converted to NULL if db is Oracle
Date Thu, 27 Sep 2012 19:39:08 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Thomas Fox closed TORQUE-58.

> Where clause with zero length string should be converted to NULL if db is Oracle
> --------------------------------------------------------------------------------
>                 Key: TORQUE-58
>                 URL: https://issues.apache.org/jira/browse/TORQUE-58
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 3.3
>         Environment: All OS, All Hardware, Oracle db
>            Reporter: parthasarathy
>            Assignee: Thomas Fox
> 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, please contact your JIRA administrators
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

View raw message