emecii commented on code in PR #4773:
URL: https://github.com/apache/arrow-adbc/pull/4773#discussion_r3981007270


##########
c/driver/sqlite/statement_reader.c:
##########
@@ -343,6 +343,25 @@ AdbcStatusCode InternalAdbcSqliteBinderBindNext(struct 
AdbcSqliteBinder* binder,
       binder->param_indices[i] =
           sqlite3_bind_parameter_index(stmt, binder->schema.children[i]->name);
       if (binder->param_indices[i] == 0) {
+        // Accept names without a prefix when the match is unique. Exact names
+        // above retain precedence and their existing behavior.
+        for (int parameter = 1; parameter <= 
sqlite3_bind_parameter_count(stmt);
+             parameter++) {
+          const char* name = sqlite3_bind_parameter_name(stmt, parameter);
+          if (name != NULL && (name[0] == ':' || name[0] == '@' || name[0] == 
'$') &&
+              strcmp(name + 1, binder->schema.children[i]->name) == 0) {
+            if (binder->param_indices[i] != 0) {
+              binder->param_indices[0] = 0;
+              InternalAdbcSetError(error, "ambiguous parameter `%s`; include 
its prefix",
+                                   binder->schema.children[i]->name);
+              return ADBC_STATUS_INVALID_ARGUMENT;
+            }
+            binder->param_indices[i] = parameter;

Review Comment:
   Fixed in d93ec05. The binder now rejects duplicate resolved SQLite indexes, 
with native and DB-API regressions for this exact collision. Existing 
exact-prefixed and unique unprefixed cases continue to pass.



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

Reply via email to