aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/sqlite/JSSQLStatement.h
diff options
context:
space:
mode:
authorGravatar Zilin Zhu <zhuzilinallen@gmail.com> 2022-08-12 17:47:01 +0800
committerGravatar GitHub <noreply@github.com> 2022-08-12 02:47:01 -0700
commitbcc4580cdceece582a776fc9fb3de1cc78c2b2aa (patch)
tree0097df6a7e7e9a998fbcb8697e486efa0240cec0 /src/bun.js/bindings/sqlite/JSSQLStatement.h
parentdba3aaedab5bb85e3ab13371e9d8484945c049f8 (diff)
downloadbun-bcc4580cdceece582a776fc9fb3de1cc78c2b2aa.tar.gz
bun-bcc4580cdceece582a776fc9fb3de1cc78c2b2aa.tar.zst
bun-bcc4580cdceece582a776fc9fb3de1cc78c2b2aa.zip
invalidate column name caches when the schema of table may change (#1056)
Diffstat (limited to 'src/bun.js/bindings/sqlite/JSSQLStatement.h')
-rw-r--r--src/bun.js/bindings/sqlite/JSSQLStatement.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.h b/src/bun.js/bindings/sqlite/JSSQLStatement.h
index 6bf830ee2..3dbb7eff0 100644
--- a/src/bun.js/bindings/sqlite/JSSQLStatement.h
+++ b/src/bun.js/bindings/sqlite/JSSQLStatement.h
@@ -47,6 +47,13 @@
namespace WebCore {
+class VersionSqlite3 {
+public:
+ explicit VersionSqlite3(sqlite3* db) : db(db), version(0) {}
+ sqlite3* db;
+ std::atomic<uint64_t> version;
+};
+
class JSSQLStatementConstructor final : public JSC::JSFunction {
public:
using Base = JSC::JSFunction;
@@ -71,7 +78,8 @@ public:
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
- Vector<sqlite3*> databases;
+ Vector<VersionSqlite3*> databases;
+ Vector<std::atomic<uint64_t>> schema_versions;
private:
JSSQLStatementConstructor(JSC::VM& vm, NativeExecutable* native, JSGlobalObject* globalObject, JSC::Structure* structure)