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

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

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


##########
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:
   Makes sense. We should also be able to leverage CMake to inject the version as a constant.



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