You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Daniel Weidele (JIRA)" <em...@incubator.apache.org> on 2012/09/12 09:49:07 UTC
[jira] [Created] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Daniel Weidele created EMPIREDB-170:
---------------------------------------
Summary: DBDatabase.querySingleValue(cmd, conn) does not care about DataType
Key: EMPIREDB-170
URL: https://issues.apache.org/jira/browse/EMPIREDB-170
Project: Empire-DB
Issue Type: Improvement
Components: Core
Affects Versions: empire-db-2.4.2
Environment: any
Reporter: Daniel Weidele
Priority: Minor
Attachments: patch.txt
Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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
[jira] [Commented] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Posted by "Francis De Brabandere (JIRA)" <em...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/EMPIREDB-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13456454#comment-13456454 ]
Francis De Brabandere commented on EMPIREDB-170:
------------------------------------------------
Any chance you could us us a proper patch?
> DBDatabase.querySingleValue(cmd, conn) does not care about DataType
> -------------------------------------------------------------------
>
> Key: EMPIREDB-170
> URL: https://issues.apache.org/jira/browse/EMPIREDB-170
> Project: Empire-DB
> Issue Type: Improvement
> Components: Core
> Affects Versions: empire-db-2.4.2
> Environment: any
> Reporter: Daniel Weidele
> Priority: Minor
> Attachments: patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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
[jira] [Commented] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Posted by "Francis De Brabandere (JIRA)" <em...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/EMPIREDB-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13456123#comment-13456123 ]
Francis De Brabandere commented on EMPIREDB-170:
------------------------------------------------
Hi Daniel, did you run a source format? A lot of formatting was changed in the commit so it's kind of hard to find the actual changed part...
> DBDatabase.querySingleValue(cmd, conn) does not care about DataType
> -------------------------------------------------------------------
>
> Key: EMPIREDB-170
> URL: https://issues.apache.org/jira/browse/EMPIREDB-170
> Project: Empire-DB
> Issue Type: Improvement
> Components: Core
> Affects Versions: empire-db-2.4.2
> Environment: any
> Reporter: Daniel Weidele
> Priority: Minor
> Attachments: patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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
[jira] [Commented] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Posted by "Francis De Brabandere (JIRA)" <em...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/EMPIREDB-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461239#comment-13461239 ]
Francis De Brabandere commented on EMPIREDB-170:
------------------------------------------------
Response from rainer:
Personally I would prefer not to have this dodgy logic with cmd.getSelectExprList() in that function.
I would rather simply create new overload that has the desired signature
i.e.
public final Object querySingleValue(DBCommand cmd, DataType dataType, Connection conn)
{
return querySingleValue(cmd.getSelect(), cmd.getParamValues(), dataType, conn);
}
Everything else is up to the caller.
We should keep it small and simple.
> DBDatabase.querySingleValue(cmd, conn) does not care about DataType
> -------------------------------------------------------------------
>
> Key: EMPIREDB-170
> URL: https://issues.apache.org/jira/browse/EMPIREDB-170
> Project: Empire-DB
> Issue Type: Improvement
> Components: Core
> Affects Versions: empire-db-2.4.2
> Environment: any
> Reporter: Daniel Weidele
> Priority: Minor
> Attachments: patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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
[jira] [Commented] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Posted by "Daniel Weidele (JIRA)" <em...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/EMPIREDB-170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13456840#comment-13456840 ]
Daniel Weidele commented on EMPIREDB-170:
-----------------------------------------
I added the following method to DBDatabase (in core project).
/**
* Returns the value of the first row/column of a sql-query as an object.
* If the query does not return a result a QueryNoResultException is thrown
*
* @param cmd
* the Command object that contains the select statement
* @param conn
* a valid connection to the database.
* @return the value of the first column in the first row of the query
*/
public final Object querySingleValue(DBCommand cmd, Connection conn)
{
if (cmd.getSelectExprList() != null && cmd.getSelectExprList().length > 0 && cmd.getSelectExprList()[0] != null)
{
return querySingleValue(cmd.getSelect(), cmd.getParamValues(), cmd.getSelectExprList()[0].getDataType(), conn);
}
return querySingleValue(cmd.getSelect(), cmd.getParamValues(), conn);
}
> DBDatabase.querySingleValue(cmd, conn) does not care about DataType
> -------------------------------------------------------------------
>
> Key: EMPIREDB-170
> URL: https://issues.apache.org/jira/browse/EMPIREDB-170
> Project: Empire-DB
> Issue Type: Improvement
> Components: Core
> Affects Versions: empire-db-2.4.2
> Environment: any
> Reporter: Daniel Weidele
> Priority: Minor
> Attachments: patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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
[jira] [Updated] (EMPIREDB-170) DBDatabase.querySingleValue(cmd,
conn) does not care about DataType
Posted by "Daniel Weidele (JIRA)" <em...@incubator.apache.org>.
[ https://issues.apache.org/jira/browse/EMPIREDB-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Weidele updated EMPIREDB-170:
------------------------------------
Attachment: patch.txt
I attached a patch which might improve the situation.
> DBDatabase.querySingleValue(cmd, conn) does not care about DataType
> -------------------------------------------------------------------
>
> Key: EMPIREDB-170
> URL: https://issues.apache.org/jira/browse/EMPIREDB-170
> Project: Empire-DB
> Issue Type: Improvement
> Components: Core
> Affects Versions: empire-db-2.4.2
> Environment: any
> Reporter: Daniel Weidele
> Priority: Minor
> Attachments: patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Making use of DBDatabase.querySingleValue(cmd, conn) seems to ignore the DataType of the select expression. This can result in erreneous behaviour, e.g. when trying to select a number(1,0) column as boolean for Oracle, as empire-db reads the value as Number, instead of the declared BOOL in table defintions.
--
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