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/29 13:21:33 UTC

[GitHub] [arrow-adbc] lidavidm commented on a diff in pull request #714: refactor(c/driver/postgresql): Use Prepared Statement in Result Helper

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


##########
c/driver/postgresql/connection.cc:
##########
@@ -72,12 +72,48 @@ class PqResultRow {
 // as expected prior to iterating
 class PqResultHelper {
  public:
-  PqResultHelper(PGconn* conn, const char* query) : conn_(conn) {
+  PqResultHelper(PGconn* conn, const char* query, std::vector<std::string> param_values,
+                 struct AdbcError* error)
+      : conn_(conn), param_values_(param_values), error_(error) {
     query_ = std::string(query);
     result_ = PQexec(conn_, query_.c_str());
+    for (auto data : param_values) {
+      param_lengths_.push_back(data.length());
+    }
+  }
+
+  AdbcStatusCode Prepare() {
+    // TODO: make stmtName a unique identifier?

Review Comment:
   A single connection can only handle a single query at a time anyways. Though, exposing the name may be useful if we want to somehow expose managing multiple prepared statements on a single connection. (I suppose that could be one way to allow multiple AdbcStatement instances from a single AdbcConnection, with the restriction that you can't use them concurrently, and that one result set must be completely consumed before using a different statement.)



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