Support multiple queries in a single statement

Aperta
#277 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java, sqlite
Ambito
database

Direzione di ricerca

Start in CorePreparedStatement, where the issue says the batch array is allocated from the parameter count. Trace how parameter positions are mapped when a prepared statement contains multiple SELECT statements, then inspect nearby tests for prepared statements and multi statement handling. Done means executing the described repeated parameter query no longer throws ArrayIndexOutOfBoundsException.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement:SQLite impacts:JNI

I'm using this JDBC driver in the Apache Incubator Guacamole project, with MyBatis and Guice, to try to make the SQLite database available as an authentication back-end for the product. In a couple of places in the code (1, 2), there are prepared statements passed to the JDBC drivers that contain multiple select statements from different tables, each terminated by a semicolon. This allows the Java code to make a single method call that runs both queries and returns a single result map, and keeps the code simple. It works perfectly fine for MySQL, PostgreSQL, and SQL Server, but generates this ArrayIndexOutOfBoundsException when used with this SQLite JDBC driver.

When the batch array is allocated in the CorePreparedStatement class, it's allocated based on the number of parameters. However, when multiple select statements are used that expect the same parameters to be passed, there will be x * y number of positions, where x is the parameter count and y is the number of SELECT statements, which is what results in the index out of bounds exception.

I'm not sure if batch needs to be dynamically allocated or resized, or if the size that it needs to be can be computed from other available parameters to get the total position count, but the current method does not allow for multiple statements to be prepared properly.

Lingua principale
Java
Stelle
3.3k
Fork
676
Merge medio
1g 15h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di xerial/sqlite-jdbc

Tutte le issue di xerial/sqlite-jdbc

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.