lidavidm commented on code in PR #4203:
URL: https://github.com/apache/arrow-adbc/pull/4203#discussion_r3083128294
##########
java/driver/jni/src/main/cpp/jni_wrapper.cc:
##########
@@ -456,15 +456,163 @@
Java_org_apache_arrow_adbc_driver_jni_impl_NativeAdbc_statementExecuteSchema(
return nullptr;
}
+JNIEXPORT jbyteArray JNICALL
+Java_org_apache_arrow_adbc_driver_jni_impl_NativeAdbc_statementGetOptionBytes(
+ JNIEnv* env, [[maybe_unused]] jclass self, jlong handle, jstring key) {
+ struct AdbcError error = ADBC_ERROR_INIT;
+ auto* db = reinterpret_cast<struct
AdbcStatement*>(static_cast<uintptr_t>(handle));
+
+ std::vector<uint8_t> buf(1024, '\0');
+ size_t length = buf.size();
+ try {
+ JniStringView key_str(env, key);
+ CHECK_ADBC_ERROR(
+ AdbcStatementGetOptionBytes(db, key_str.value,
const_cast<uint8_t*>(buf.data()),
+ &length, &error),
+ error);
+ while (length > buf.size()) {
+ // Buffer was too small, resize and try again
+ buf.resize(length);
+ CHECK_ADBC_ERROR(
+ AdbcStatementGetOptionBytes(db, key_str.value,
const_cast<uint8_t*>(buf.data()),
+ &length, &error),
+ error);
+ }
Review Comment:
The other driver managers also use a loop
--
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]