You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2023/02/17 18:55:59 UTC

[GitHub] [arrow-adbc] zeroshade commented on a diff in pull request #467: feat(go/adbc/driver/flightsql): add transaction and substrait support

zeroshade commented on code in PR #467:
URL: https://github.com/apache/arrow-adbc/pull/467#discussion_r1110215855


##########
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:
   Gotcha, i'll update this here to check GetSqlInfo on startup and return NotImplemented if that's the case.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org