WillAyd commented on code in PR #714:
URL: https://github.com/apache/arrow-adbc/pull/714#discussion_r1207596735
##########
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:
I noticed in the similar implementation in statement.cc that this uses an
empty string. Wondering if we should generate a random string for the lifetime
of the class so that there is no potential for races trying to execute prepared
statements
##########
c/driver/postgresql/connection.cc:
##########
@@ -146,15 +185,17 @@ class PqGetObjectsHelper {
}
AdbcStatusCode GetObjects() {
- PqResultHelper curr_db_helper = PqResultHelper{conn_, "SELECT
current_database()"};
- if (curr_db_helper.Status() == PGRES_TUPLES_OK) {
- assert(curr_db_helper.NumRows() == 1);
- auto curr_iter = curr_db_helper.begin();
- PqResultRow db_row = *curr_iter;
- current_db_ = std::string(db_row[0].data);
- } else {
- return ADBC_STATUS_INTERNAL;
- }
+ std::vector<std::string> _;
Review Comment:
This is pointless to add an empty vector. I'm guessing we should just add an
alternate constructor, but could also go in a separate class since the
Prepare/Execute interaction is overkill for something without parameters
--
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]