databricks-sql-go icon indicating copy to clipboard operation
databricks-sql-go copied to clipboard

[PECOBLR-1156] Add foundational structures for transaction support

Open gopalldb opened this issue 2 months ago • 0 comments

Summary

Implement foundational infrastructure for Multi-Statement Transaction (MST) support in the Go driver, adding core structures and error constants needed for transaction implementation.

Changes

  • Add autoCommit bool field to conn struct for client-side state caching
  • Create tx struct with conn *conn field implementing driver.Tx interface
  • Add 5 transaction error constants:
    • ErrTransactionBegin - "failed to begin transaction"
    • ErrTransactionCommit - "failed to commit transaction"
    • ErrTransactionRollback - "failed to rollback transaction"
    • ErrTransactionNested - "transaction already in progress"
    • ErrUnsupportedIsolation - "unsupported transaction isolation level"
  • Initialize autoCommit = true in connector (default state)

Testing

  • ✅ Code compiles successfully (go build ./...)
  • ✅ Static analysis passes (go vet ./...)
  • ✅ Pre-commit hooks passed
  • Note: No functional tests in this ticket (foundational structures only)
  • Full testing will be implemented in PECOBLR-1160 and PECOBLR-1161

JIRA

Closes PECOBLR-1156 Part of Story: PECOBLR-1155 Part of Epic: PECOBLR-1144

Design Document

See DESIGN_MULTI_STATEMENT_TRANSACTIONS.md for complete technical design. This implementation follows Section 3.1 (tx struct), Section 4.1 (autoCommit field), Section 4.2 (initialization), and Section 5.1 (error constants).

Implementation Notes

  • Follows JDBC implementation pattern (PR #1060) with client-side autocommit caching
  • No user-facing changes in this ticket (structures only)
  • Ready for PECOBLR-1157 (BeginTx implementation)

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

gopalldb avatar Nov 05 '25 01:11 gopalldb