Support multiple queries in a single statement

Abierto
#277 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java, sqlite
Área
database

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
3.3k
Forks
676
Merge medio
1 d 15 h
PR fusionados (30 d)
18

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de xerial/sqlite-jdbc

Todos los issues de xerial/sqlite-jdbc

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.