Skip to content

Collapse the duplicated send and update-count paths in LibsqlConnection #214

Closed

Description

@magnusp

Goal

Collapse the duplicated send and update-count paths in LibsqlConnection. Five places repeat the client call plus LibsqlException to SQLException mapping, and two methods re-implement batch update-count conversion.

Depends on

None. The savepoint pass depends on this one because it deletes executeTransactionStatement.

Pin

LibsqlConnectionTest covers transactions, batches, empty batches, and error mapping. LibsqlSavepointTest covers the savepoint send path.

Scope

  • Add sendOnStream(Stmt) and a batch equivalent, each owning the error mapping.
  • Make executeBatch(List) one line over steppedUpdateCounts.
  • Delete executeTransactionStatement (619 to 626) and point its four call sites at the helper.
  • Leave the autoCommit dispatch in executeStatement and executeBatchResults in place.

Preserve

  • A failed BEGIN closes the fresh stream and leaves the begin pending.
  • A failed COMMIT or ROLLBACK leaves the stream open.
  • An empty batch returns an empty list and sends no request.
  • Callers still hold stateLock.

Acceptance

  • One definition each for send, error mapping, and update-count conversion.
  • LibsqlConnection.java is under 750 lines.
  • ./mvnw -pl libsql-jdbc -am test green with no assertion edited.
  • ./mvnw -pl libsql-itests -am verify green with DOCKER_CONFIG set per AGENTS.md section 4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority: edge case, feature gap, or test/process improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions