aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index 49ef2032d..56b2e33d9 100644
--- a/README.md
+++ b/README.md
@@ -2003,7 +2003,7 @@ TLDR:
- `get Statement.columnNames` get the returned column names
- `get Statement.paramsCount` how many parameters are expected?
-You can bind parameters on any call to a statement. Named parameters and positional parameters are supported.
+You can bind parameters on any call to a statement. Named parameters and positional parameters are supported. Bound parameters are remembered between calls and reset the next time you pass parameters to bind.
```ts
import { Database } from "bun:sqlite";
diff --git a/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp b/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp
index d7cccd771..ceb803b0a 100644
--- a/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp
+++ b/src/javascript/jsc/bindings/sqlite/JSSQLStatement.cpp
@@ -206,15 +206,15 @@ static inline bool rebindValue(JSC::JSGlobalObject* lexicalGlobalObject, sqlite3
}
if (roped.is8Bit()) {
- CHECK_BIND(sqlite3_bind_text(stmt, i, reinterpret_cast<const char*>(roped.characters8()), roped.length(), nullptr));
+ CHECK_BIND(sqlite3_bind_text(stmt, i, reinterpret_cast<const char*>(roped.characters8()), roped.length(), SQLITE_TRANSIENT));
} else {
- CHECK_BIND(sqlite3_bind_text16(stmt, i, roped.characters16(), roped.length() * 2, nullptr));
+ CHECK_BIND(sqlite3_bind_text16(stmt, i, roped.characters16(), roped.length() * 2, SQLITE_TRANSIENT));
}
} else if (UNLIKELY(value.isHeapBigInt())) {
CHECK_BIND(sqlite3_bind_int64(stmt, i, JSBigInt::toBigInt64(value)));
} else if (JSC::JSArrayBufferView* buffer = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(value)) {
- CHECK_BIND(sqlite3_bind_blob(stmt, i, buffer->vector(), buffer->byteLength(), nullptr));
+ CHECK_BIND(sqlite3_bind_blob(stmt, i, buffer->vector(), buffer->byteLength(), SQLITE_TRANSIENT));
} else {
throwException(lexicalGlobalObject, scope, createTypeError(lexicalGlobalObject, "Binding expected string, TypedArray, boolean, number, bigint or null"_s));
return false;