felipecrv commented on code in PR #2801:
URL: https://github.com/apache/arrow-adbc/pull/2801#discussion_r2080356076
##########
go/adbc/pkg/snowflake/driver.go:
##########
@@ -97,7 +97,27 @@ func setErrWithDetails(err *C.struct_AdbcError, adbcError
adbc.Error) {
return
}
+ for i := 0; i < 5; i++ {
+ err.sqlstate[i] = C.char(adbcError.SqlState[i])
+ }
+
if err.vendor_code != C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+ // Caller is not interested in `private_data` if `vendor_code`
is not
+ // `ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA` so let's use the field
for
+ // `vendor_code` instead, but make sure it's not set to the
value
+ // that would indicate `private_data` is set.
+ if adbcError.VendorCode !=
C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+ err.vendor_code = C.int(adbcError.VendorCode)
+ }
+ setErr(err, adbcError.Msg)
+ return
+ }
+
+ numDetails := len(adbcError.Details)
+ // If there are no details, but we have a `VendorCode`, let's override
+ // `vendor_code` and not populate `private_data` with the error details.
+ if numDetails == 0 && adbcError.VendorCode != 0 && adbcError.VendorCode
!= C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+ err.vendor_code = C.int(adbcError.VendorCode)
Review Comment:
@zeroshade if you are OK with this approach I will change the `go.tmpl` file
and `make regenerate`.
--
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]