Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ import (
)

type conn struct {
id string
cfg *config.Config
client cli_service.TCLIService
session *cli_service.TOpenSessionResp
id string
cfg *config.Config
client cli_service.TCLIService
session *cli_service.TOpenSessionResp
autoCommit bool // Cache autocommit state client-side (default: true)
}

// tx implements driver.Tx for transaction support
type tx struct {
conn *conn
}

// Prepare prepares a statement with the query bound to this connection.
Expand Down
9 changes: 5 additions & 4 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {
}

conn := &conn{
id: client.SprintGuid(session.SessionHandle.GetSessionId().GUID),
cfg: c.cfg,
client: tclient,
session: session,
id: client.SprintGuid(session.SessionHandle.GetSessionId().GUID),
cfg: c.cfg,
client: tclient,
session: session,
autoCommit: true, // Initialize autocommit cache to true (default state)
}
log := logger.WithContext(conn.id, driverctx.CorrelationIdFromContext(ctx), "")

Expand Down
7 changes: 7 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ const (
ErrParametersNotSupported = "query parameters are not supported by this server"
ErrMixedNamedAndPositionalParameters = "named and positional parameters cannot be used simultaneously"

// Transaction errors
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"

// Request error messages (connection, authentication, network error)
ErrCloseConnection = "failed to close connection"
ErrThriftClient = "error initializing thrift client"
Expand Down
Loading