lidavidm commented on code in PR #2266:
URL: https://github.com/apache/arrow-adbc/pull/2266#discussion_r1809764608
##########
c/driver_manager/adbc_driver_manager.cc:
##########
@@ -84,6 +84,37 @@ void SetError(struct AdbcError* error, const std::string&
message) {
error->release = ReleaseError;
}
+// Copies src_error into error and releases src_error
+void SetError(struct AdbcError* error, struct AdbcError* src_error) {
+ if (!error) return;
+ if (error->release) error->release(error);
+
+ if (src_error->message) {
+ size_t message_size = strlen(src_error->message);
+ error->message = new char[message_size];
+ std::memcpy(error->message, src_error->message, message_size);
+ error->message[message_size] = '\0';
+ } else {
+ error->message = nullptr;
+ }
+
+ error->release = ReleaseError;
+ if (src_error->release) {
+ src_error->release(src_error);
+ }
+}
+
+struct OwnedError {
+ struct AdbcError error {
+ ADBC_ERROR_INIT
+ };
Review Comment:
...except never mind, the field name is right there so ...??? anyways it
seems `=` is better to the formatter!
--
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]