{"record":{"id":"f5c7d4251623f95c","repo":"tursodatabase/turso","slug":"invalid-argument","errorCode":null,"errorMessage":"Invalid argument","messagePattern":"Invalid argument","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Statement.java","lineNumber":356,"sourceCode":"    return BATCH_COMPATIBLE_PATTERN.matcher(sql).find();\n  }\n\n  @Override\n  public Connection getConnection() {\n    return connection;\n  }\n\n  @Override\n  public boolean getMoreResults() throws SQLException {\n    return getMoreResults(Statement.CLOSE_CURRENT_RESULT);\n  }\n\n  @Override\n  public boolean getMoreResults(int current) throws SQLException {\n    requireNonNull(statement, \"statement should not be null\");\n\n    if (current != Statement.CLOSE_CURRENT_RESULT) {\n      throw new SQLException(\"Invalid argument\");\n    }\n\n    statement.getResultSet().close();\n    updateCount = -1;\n\n    return false;\n  }\n\n  @Override\n  @SkipNullableCheck\n  public ResultSet getGeneratedKeys() throws SQLException {\n    // TODO\n    return null;\n  }\n\n  @Override\n  public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {\n    // TODO: enhance","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Statement.java#L338-L374","documentation":"JDBC4Statement.getMoreResults(int) accepts only Statement.CLOSE_CURRENT_RESULT; any other flag (KEEP_CURRENT_RESULT, CLOSE_ALL_RESULTS) throws SQLException(\"Invalid argument\"). Even the accepted path is single-result only: it closes the current result set, resets updateCount to -1, and always returns false — this driver does not expose multiple result sets per statement.","triggerScenarios":"Calling stmt.getMoreResults(Statement.KEEP_CURRENT_RESULT) or CLOSE_ALL_RESULTS, most often inside the standard JDBC multi-result iteration loop (while (stmt.getMoreResults(...)) after execute()), or inside generic DAO/stored-procedure helpers that preserve the current result set while probing for more.","commonSituations":"Porting multi-result-set iteration patterns written for MySQL/PostgreSQL/SQL Server drivers; engines or test harnesses that return several result sets per call; framework code that chooses a flag based on configuration.","solutions":["Call the no-arg getMoreResults(), which defaults to CLOSE_CURRENT_RESULT","Restructure to one statement per result set; this driver never returns a second one","Guard the flag: treat any value other than CLOSE_CURRENT_RESULT as an error before calling","Catch the SQLException when reusing generic multi-result framework code that you cannot change"],"exampleFix":"// before\nwhile (stmt.getMoreResults(Statement.KEEP_CURRENT_RESULT)) { ... }\n\n// after\n// single result set per statement on this driver\ntry (ResultSet rs = stmt.getResultSet()) {\n  while (rs.next()) { ... }\n}","handlingStrategy":"validation","validationCode":"if (current != Statement.CLOSE_CURRENT_RESULT) {\n  // driver supports only CLOSE_CURRENT_RESULT; single result set per statement\n  current = Statement.CLOSE_CURRENT_RESULT;\n}\nboolean more = stmt.getMoreResults(current);","typeGuard":null,"tryCatchPattern":"try {\n  return stmt.getMoreResults(current);\n} catch (SQLException e) {\n  if (\"Invalid argument\".equals(e.getMessage())) {\n    return false; // driver has no additional result sets anyway\n  }\n  throw e;\n}","preventionTips":["Prefer the no-arg getMoreResults() with this driver","Do not port multi-result-set iteration loops; issue one statement per result set","Remember the driver always reports a single result set and getUpdateCount is reset to -1"],"tags":["java","jdbc","turso","multi-resultset","invalid-argument","statement"],"backgroundTag":"invalid-argument","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}