From ddccba6325df599c4009dad8009779f4a0d79007 Mon Sep 17 00:00:00 2001 From: Alex Garcia Date: Wed, 29 May 2024 22:12:39 -0700 Subject: [PATCH 1/2] Add BindBlob --- src/sqlite_stmt.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sqlite_stmt.cpp b/src/sqlite_stmt.cpp index 40d08cc..474f7fc 100644 --- a/src/sqlite_stmt.cpp +++ b/src/sqlite_stmt.cpp @@ -130,6 +130,10 @@ void SQLiteStatement::Bind(idx_t col, double value) { SQLiteUtils::Check(sqlite3_bind_double(stmt, col + 1, value), db); } +void SQLiteStatement::BindBlob(idx_t col, const string_t &value) { + SQLiteUtils::Check(sqlite3_bind_blob(stmt, col + 1, value.GetDataUnsafe(), value.GetSize(), nullptr), db); +} + void SQLiteStatement::BindText(idx_t col, const string_t &value) { SQLiteUtils::Check(sqlite3_bind_text(stmt, col + 1, value.GetDataUnsafe(), value.GetSize(), nullptr), db); } @@ -152,6 +156,8 @@ void SQLiteStatement::BindValue(Vector &col, idx_t c, idx_t r) { Bind(c, FlatVector::GetData(col)[r]); break; case LogicalTypeId::BLOB: + BindBlob(c, FlatVector::GetData(col)[r]); + break; case LogicalTypeId::VARCHAR: BindText(c, FlatVector::GetData(col)[r]); break; From 3ec103d4e92d67aae25e4c1fb9c14864d27af9ca Mon Sep 17 00:00:00 2001 From: Alex Garcia Date: Thu, 30 May 2024 09:18:50 -0700 Subject: [PATCH 2/2] Update sqlite_stmt.hpp --- src/include/sqlite_stmt.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/sqlite_stmt.hpp b/src/include/sqlite_stmt.hpp index abd92cd..8a050fe 100644 --- a/src/include/sqlite_stmt.hpp +++ b/src/include/sqlite_stmt.hpp @@ -41,6 +41,7 @@ class SQLiteStatement { throw InternalException("Unsupported type for SQLiteStatement::Bind"); } void BindText(idx_t col, const string_t &value); + void BindBlob(idx_t col, const string_t &value); void BindValue(Vector &col, idx_t c, idx_t r); int GetType(idx_t col); bool IsOpen();