WillAyd commented on code in PR #906:
URL: https://github.com/apache/arrow-adbc/pull/906#discussion_r1264221976
##########
c/driver/sqlite/sqlite.c:
##########
@@ -981,23 +981,22 @@ AdbcStatusCode SqliteStatementInitIngest(struct
SqliteStatement* stmt,
AdbcStatusCode code = ADBC_STATUS_OK;
// Create statements for CREATE TABLE / INSERT
- struct StringBuilder create_query = {0};
- struct StringBuilder insert_query = {0};
-
- if (StringBuilderInit(&create_query, /*initial_size=*/256) != 0) {
- SetError(error, "[SQLite] Could not initiate StringBuilder");
+ sqlite3_str* create_query = sqlite3_str_new(NULL);
+ if (sqlite3_str_errcode(create_query)) {
+ SetError(error, "[SQLite] %s", sqlite3_errmsg(stmt->conn));
return ADBC_STATUS_INTERNAL;
}
+ struct StringBuilder insert_query = {0};
if (StringBuilderInit(&insert_query, /*initial_size=*/256) != 0) {
SetError(error, "[SQLite] Could not initiate StringBuilder");
- StringBuilderReset(&create_query);
+ sqlite3_free(sqlite3_str_finish(create_query));
return ADBC_STATUS_INTERNAL;
}
- if (StringBuilderAppend(&create_query, "%s%s%s", "CREATE TABLE ",
stmt->target_table,
- " (") != 0) {
- SetError(error, "[SQLite] Call to StringBuilderAppend failed");
+ sqlite3_str_appendf(create_query, "%s%Q%s", "CREATE TABLE ",
stmt->target_table, " (");
Review Comment:
Looks like sqlite uses the %Q format to handle quoting
https://www.sqlite.org/printf.html
--
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]