[teiid-issues] [JBoss JIRA] (TEIID-5353) Prepared Statement params are not pre-evaluated

Steven Hawkins (JIRA) issues at jboss.org
Fri May 25 09:35:01 EDT 2018


     [ https://issues.jboss.org/browse/TEIID-5353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Hawkins updated TEIID-5353:
----------------------------------
    Description: 
prepared statements, [1] with both criteria as parameters for the prepared statement, the predicates are not evaluated until after batches are pulled.  But for [2] if the SEARCH='FALSE' is in the query and not a param, it is pre-evaluated and we only run the one side of the union.

[1]
sql = "select  * from " +
"Inventory_Detail" +
" WHERE SEARCH = (?)  and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
PreparedStatement preparedStatement =  conn.prepareStatement(sql);
preparedStatement.setString(1,"FALSE");
preparedStatement.setString(2,"1005014161091");
ResultSet rs = null;


[2]
sql = "select  * from " +
"Inventory_Detail" +
" WHERE SEARCH = 'FALSE' and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
PreparedStatement preparedStatement =  conn.prepareStatement(sql);
preparedStatement.setString(1,"1005014161091");
ResultSet rs = null;

  was:
prepared statements, [1] with both criteria as parameters for the prepared statement, it appears that we are ignoring the SEARCH criteria because we are running both sides of the union.  But for [2] if the SEARCH='FALSE' is in the query and not a param, we process as expected and only run the one side of the union.

[1]
sql = "select  * from " +
"Inventory_Detail" +
" WHERE SEARCH = (?)  and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
PreparedStatement preparedStatement =  conn.prepareStatement(sql);
preparedStatement.setString(1,"FALSE");
preparedStatement.setString(2,"1005014161091");
ResultSet rs = null;


[2]
sql = "select  * from " +
"Inventory_Detail" +
" WHERE SEARCH = 'FALSE' and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
PreparedStatement preparedStatement =  conn.prepareStatement(sql);
preparedStatement.setString(1,"1005014161091");
ResultSet rs = null;



> Prepared Statement params are not pre-evaluated
> -----------------------------------------------
>
>                 Key: TEIID-5353
>                 URL: https://issues.jboss.org/browse/TEIID-5353
>             Project: Teiid
>          Issue Type: Bug
>    Affects Versions: 8.12.12.6_4
>            Reporter: Debbie Steigner
>            Assignee: Steven Hawkins
>
> prepared statements, [1] with both criteria as parameters for the prepared statement, the predicates are not evaluated until after batches are pulled.  But for [2] if the SEARCH='FALSE' is in the query and not a param, it is pre-evaluated and we only run the one side of the union.
> [1]
> sql = "select  * from " +
> "Inventory_Detail" +
> " WHERE SEARCH = (?)  and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
> PreparedStatement preparedStatement =  conn.prepareStatement(sql);
> preparedStatement.setString(1,"FALSE");
> preparedStatement.setString(2,"1005014161091");
> ResultSet rs = null;
> [2]
> sql = "select  * from " +
> "Inventory_Detail" +
> " WHERE SEARCH = 'FALSE' and ITEM_ID in (?) OFFSET 0 ROWS FETCH NEXT 500 ROWS ONLY";
> PreparedStatement preparedStatement =  conn.prepareStatement(sql);
> preparedStatement.setString(1,"1005014161091");
> ResultSet rs = null;



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the teiid-issues mailing list