Skip to content

Add isolation level support check#422

Open
larrasket wants to merge 1 commit intocanonical:v3from
larrasket:lr0/driver.BeginTx
Open

Add isolation level support check#422
larrasket wants to merge 1 commit intocanonical:v3from
larrasket:lr0/driver.BeginTx

Conversation

@larrasket
Copy link
Copy Markdown

The database/sql/driver.ConnBeginTx interface requires drivers to validate transaction options and return errors for unsupported configurations.

currently, BeginTx would silently accept any isolation level or read-only setting and just run BEGIN, which might be misleading.

the implementation returns ErrIsolationLevelNotSupported for anything other than LevelDefault or LevelSerializable (since SQLite/dqlite only supports serializable), and returns ErrReadOnlyNotSupported for read-only transactions (not supported by dqlite). Both error types are exported so callers can check what went wrong with error.As.

Closes #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return error in driver.BeginTx if options aren't used/required or incorrect.

1 participant