zeroshade commented on code in PR #467:
URL: https://github.com/apache/arrow-adbc/pull/467#discussion_r1110324299
##########
go/adbc/driver/flightsql/flightsql_adbc.go:
##########
@@ -554,10 +556,44 @@ func (c *cnxn) SetOption(key, value string) error {
}
c.timeouts.updateTimeout = timeout
case adbc.OptionKeyAutoCommit:
- return adbc.Error{
- Msg: "[Flight SQL] transactions not yet supported",
- Code: adbc.StatusNotImplemented,
+ autocommit := true
+ switch value {
+ case adbc.OptionValueEnabled:
+ case adbc.OptionValueDisabled:
+ autocommit = false
+ default:
+ return adbc.Error{
+ Msg: "[Flight SQL] invalid value for option "
+ key + ": " + value,
+ Code: adbc.StatusInvalidArgument,
+ }
}
+
+ if autocommit != c.autocommit {
+ // if we're *enabling* autocommit, then commit any
existing
+ // transaction. If we're *disabling* auto commit, start
a
+ // transaction and store it.
+ ctx :=
metadata.NewOutgoingContext(context.Background(), c.hdrs)
+ var err error
+ if autocommit && c.txn != nil {
+ if err = c.txn.Commit(ctx, c.timeouts); err !=
nil {
+ return adbc.Error{
+ Msg: "[Flight SQL] failed to
update autocommit: " + err.Error(),
+ Code: adbc.StatusIO,
+ }
Review Comment:
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]