Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go][Format] initial attempt at wrapping adbc for database/sql #97

Merged
merged 6 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
change make readonly a connection property, not transaction.
  • Loading branch information
zeroshade committed Aug 31, 2022
commit 9ac0b0baaa62aa65df048a117dc210151c60d807
6 changes: 3 additions & 3 deletions adbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ AdbcStatusCode AdbcConnectionReadPartition(struct AdbcConnection* connection,
#define ADBC_CONNECTION_OPTION_AUTOCOMMIT "adbc.connection.autocommit"

/// \brief The name of the canonical option for whether the current
/// transaction should be restricted to being a read-only transaction.
#define ADBC_CONNECTION_OPTION_TRANSACTION_READ_ONLY \
"adbc.connection.transaction.readonly"
/// connection should be restricted to being read-only.
#define ADBC_CONNECTION_OPTION_READ_ONLY \
"adbc.connection.readonly"

/// \brief The name of the canonical option for setting the isolation
/// level of a transaction.
Expand Down
18 changes: 9 additions & 9 deletions go/adbc/adbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ const (

// Canonical option values
const (
OptionValueEnabled = "true"
OptionValueDisabled = "false"
OptionKeyAutoCommit = "adbc.connection.autocommit"
OptionKeyIngestTargetTable = "adbc.ingest.target_table"
OptionKeyIngestMode = "adbc.ingest.mode"
OptionKeyIsolationLevel = "adbc.connection.transaction.isolation_level"
OptionKeyTransactionReadOnly = "adbc.connection.transaction.readonly"
OptionValueIngestModeCreate = "adbc.ingest.mode.create"
OptionValueIngestModeAppend = "adbc.ingest.mode.append"
OptionValueEnabled = "true"
OptionValueDisabled = "false"
OptionKeyAutoCommit = "adbc.connection.autocommit"
OptionKeyIngestTargetTable = "adbc.ingest.target_table"
OptionKeyIngestMode = "adbc.ingest.mode"
OptionKeyIsolationLevel = "adbc.connection.transaction.isolation_level"
OptionKeyReadOnly = "adbc.connection.readonly"
OptionValueIngestModeCreate = "adbc.ingest.mode.create"
OptionValueIngestModeAppend = "adbc.ingest.mode.append"
)

type OptionIsolationLevel string
Expand Down
2 changes: 1 addition & 1 deletion go/adbc/sqldriver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e
}

if opts.ReadOnly {
if err := postopt.SetOption(adbc.OptionKeyTransactionReadOnly, adbc.OptionValueEnabled); err != nil {
if err := postopt.SetOption(adbc.OptionKeyReadOnly, adbc.OptionValueEnabled); err != nil {
return nil, err
}
}
Expand Down