You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "WillAyd (via GitHub)" <gi...@apache.org> on 2023/05/05 22:19:38 UTC

[GitHub] [arrow-adbc] WillAyd commented on a diff in pull request #658: feat(c/driver/postgresql): Implement Postgres GetInfo

WillAyd commented on code in PR #658:
URL: https://github.com/apache/arrow-adbc/pull/658#discussion_r1186534330


##########
c/driver/postgresql/connection.cc:
##########
@@ -68,6 +75,76 @@ AdbcStatusCode PostgresConnection::Commit(struct AdbcError* error) {
   return ADBC_STATUS_OK;
 }
 
+AdbcStatusCode PostgresConnectionGetInfoImpl(const uint32_t* info_codes,
+                                             size_t info_codes_length,
+                                             struct ArrowSchema* schema,
+                                             struct ArrowArray* array,
+                                             struct AdbcError* error) {
+  RAISE_ADBC(AdbcInitConnectionGetInfoSchema(info_codes, info_codes_length, schema, array,
+                                             error));
+
+  for (size_t i = 0; i < info_codes_length; i++) {
+    switch (info_codes[i]) {
+      case ADBC_INFO_VENDOR_NAME:
+        RAISE_ADBC(
+            AdbcConnectionGetInfoAppendString(array, info_codes[i], "PostgreSQL", error));
+        break;
+      case ADBC_INFO_VENDOR_VERSION:
+        RAISE_ADBC(AdbcConnectionGetInfoAppendString(
+            array, info_codes[i], std::to_string(PQlibVersion()).c_str(), error));
+        break;
+      case ADBC_INFO_DRIVER_NAME:
+        RAISE_ADBC(AdbcConnectionGetInfoAppendString(array, info_codes[i],
+                                                     "ADBC PostgreSQL Driver", error));
+        break;
+      case ADBC_INFO_DRIVER_VERSION:
+        // TODO(lidavidm): fill in driver version

Review Comment:
   I'm guessing this is something we can place in utils.c whenever read and just have all the drivers pull from it. Maybe even pre-populate it in the utils.c `AdbcInitConnectionGetInfoSchema` function



-- 
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