Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL where in with ? placeholders throws IndexOutOfBoundsException #1454

Closed
Mark-A-W opened this issue Apr 30, 2013 · 1 comment
Closed

SQL where in with ? placeholders throws IndexOutOfBoundsException #1454

Mark-A-W opened this issue Apr 30, 2013 · 1 comment

Comments

@Mark-A-W
Copy link

I have a non-trivial SQL statement, where basically a 'folio' has a key and is always within an 'application area' and has a specific 'folio subject'. These three variable values (key, application area and folio subject, have simple character values):

select *,in[@class='linked_folio'].out.user_key as user_key from (select flatten(rid.out.in) from index:folios_by_key where key between ? ) where in[@class='parent_application_area'].out.name = ? and out[@class='linked_folio_subject'].in.name = ?

I specify the values for the ? but the query returns this error trace:

Exception in thread "main" com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: OSQLQuery [text=select *,in[@class='linked_folio'].out.user_key as user_key from (select flatten(rid.out.in) from index:folios_by_key where key between ? ) where in[@class='parent_application_area'].out.name = ? and out[@class='linked_folio_subject'].in.name = ?]
at com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:102)
at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:83)
at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:78)
at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:32)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.query(ODatabaseRecordAbstract.java:447)
at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.query(ODatabaseRecordWrapperAbstract.java:187)
at com.orientechnologies.orient.jdbc.OrientJdbcPreparedStatement.executeQuery(OrientJdbcPreparedStatement.java:73)
at com.pacsol.imageview.core.Test1.main(Test1.java:93)
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:571)
at java.util.ArrayList.get(ArrayList.java:349)
at com.orientechnologies.orient.core.sql.filter.OSQLPredicate.bindParameters(OSQLPredicate.java:370)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:132)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:342)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:323)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:312)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:56)
at com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:94)
... 8 more

It doesn't error if the last two values are hard coded, but does error if either of the last two are ?, except that it does not error if the first value is hard coded and the last two are ?.

I am using the latest snapshot of today: orientdb-1.4.0-20130430.115930-174-distribution.

@lvca
Copy link
Member

lvca commented May 1, 2013

It's the same as #1069

@lvca lvca closed this as completed May 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants