Skip to content

Commit

Permalink
remove last ref to old utils from sqlite.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Sep 22, 2024
1 parent 89597da commit 79aa337
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion c/driver/framework/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Connection : public ObjectBase {

std::vector<uint32_t> codes(info_codes, info_codes + info_codes_length);
RAISE_RESULT(error, auto infos, impl().InfoImpl(codes));
RAISE_STATUS(error, adbc::driver::MakeGetInfoStream(infos, out));
RAISE_STATUS(error, MakeGetInfoStream(infos, out));
return ADBC_STATUS_OK;
}

Expand Down
26 changes: 13 additions & 13 deletions c/driver/sqlite/sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
// specific language governing permissions and limitations
// under the License.

#include <cstdarg>
#include <limits>

#include <arrow-adbc/adbc.h>
#include <nanoarrow/nanoarrow.h>
#include <sqlite3.h>
#include <nanoarrow/nanoarrow.hpp>

#define ADBC_FRAMEWORK_USE_FMT
#include "driver/common/options.h"
#include "driver/common/utils.h"
#include "driver/framework/base_driver.h"
#include "driver/framework/connection.h"
#include "driver/framework/database.h"
Expand Down Expand Up @@ -933,37 +929,41 @@ class SqliteStatement : public driver::Statement<SqliteStatement> {
}
assert(stmt != nullptr);

AdbcStatusCode status = ADBC_STATUS_OK;
AdbcStatusCode status_code = ADBC_STATUS_OK;
Status status = status::Ok();
struct AdbcError error = ADBC_ERROR_INIT;
while (true) {
char finished = 0;
status = AdbcSqliteBinderBindNext(&binder_, conn_, stmt, &finished, &error);
if (status != ADBC_STATUS_OK || finished) break;
status_code = AdbcSqliteBinderBindNext(&binder_, conn_, stmt, &finished, &error);
if (status_code != ADBC_STATUS_OK || finished) {
status = Status::FromAdbc(status_code, error);
break;
}

int rc = 0;
do {
rc = sqlite3_step(stmt);
} while (rc == SQLITE_ROW);
if (rc != SQLITE_DONE) {
SetError(&error, "failed to execute: %s\nquery was: %s", sqlite3_errmsg(conn_),
insert.data());
status = ADBC_STATUS_INTERNAL;
status = status::fmt::Internal("failed to execute: {}\nquery was: {}",
sqlite3_errmsg(conn_), insert.data());
status_code = ADBC_STATUS_INTERNAL;
break;
}
row_count++;
}
std::ignore = sqlite3_finalize(stmt);

if (is_autocommit) {
if (status == ADBC_STATUS_OK) {
if (status_code == ADBC_STATUS_OK) {
UNWRAP_STATUS(::adbc::sqlite::SqliteQuery::Execute(conn_, "COMMIT"));
} else {
UNWRAP_STATUS(::adbc::sqlite::SqliteQuery::Execute(conn_, "ROLLBACK"));
}
}

if (status != ADBC_STATUS_OK) {
return Status::FromAdbc(status, error);
if (status_code != ADBC_STATUS_OK) {
return status;
}
return row_count;
}
Expand Down

0 comments on commit 79aa337

Please sign in to comment.