implemented statement.busy getter

(cherry picked from commit 539ff32b96213fbb033daa75303b94cbe9d95572)
This commit is contained in:
Joshua Wise
2022-01-19 20:21:47 +05:30
committed by Mahesh Bandara Wijerathna
parent eb9ea9f2a6
commit 3c5d4ac6f0
5 changed files with 98 additions and 72 deletions
+2
View File
@@ -598,6 +598,8 @@ console.log(cat.name); // => "Joey"
**.readonly -> _boolean_** - Whether the prepared statement is readonly, meaning it does not mutate the database (note that [SQL functions might still change the database indirectly](https://www.sqlite.org/c3ref/stmt_readonly.html) as a side effect, even if the `.readonly` property is `true`).
**.busy -> _boolean_** - Whether the prepared statement is busy executing a query via the [`.iterate()`](#iteratebindparameters---iterator) method.
# class *SqliteError*
Whenever an error occurs within SQLite3, a `SqliteError` object will be thrown. `SqliteError` is a subclass of `Error`. Every `SqliteError` object has a `code` property, which is a string matching one of error codes defined [here](https://sqlite.org/rescode.html) (for example, `"SQLITE_CONSTRAINT"`).
+42 -34
View File
@@ -759,11 +759,12 @@ v8::Local <v8 :: Function> Statement::Init (v8::Isolate * isolate, v8::Local <v8
SetPrototypeMethod(isolate, data, t, "raw", JS_raw);
SetPrototypeMethod(isolate, data, t, "safeIntegers", JS_safeIntegers);
SetPrototypeMethod(isolate, data, t, "columns", JS_columns);
SetPrototypeGetter(isolate, data, t, "busy", JS_busy);
return t->GetFunction( isolate -> GetCurrentContext ( ) ).ToLocalChecked();
}
#line 25 "./src/objects/statement.lzz"
#line 26 "./src/objects/statement.lzz"
BindMap * Statement::GetBindMap (v8::Isolate * isolate)
#line 25 "./src/objects/statement.lzz"
#line 26 "./src/objects/statement.lzz"
{
if (has_bind_map) return &extras->bind_map;
BindMap* bind_map = &extras->bind_map;
@@ -775,34 +776,34 @@ BindMap * Statement::GetBindMap (v8::Isolate * isolate)
has_bind_map = true;
return bind_map;
}
#line 38 "./src/objects/statement.lzz"
#line 39 "./src/objects/statement.lzz"
void Statement::CloseHandles ()
#line 38 "./src/objects/statement.lzz"
#line 39 "./src/objects/statement.lzz"
{
if (alive) {
alive = false;
sqlite3_finalize(handle);
}
}
#line 45 "./src/objects/statement.lzz"
#line 46 "./src/objects/statement.lzz"
Statement::~ Statement ()
#line 45 "./src/objects/statement.lzz"
#line 46 "./src/objects/statement.lzz"
{
if (alive) db->RemoveStatement(this);
CloseHandles();
delete extras;
}
#line 55 "./src/objects/statement.lzz"
#line 56 "./src/objects/statement.lzz"
Statement::Extras::Extras (sqlite3_uint64 id)
#line 55 "./src/objects/statement.lzz"
#line 56 "./src/objects/statement.lzz"
: bind_map (0), id (id)
#line 55 "./src/objects/statement.lzz"
#line 56 "./src/objects/statement.lzz"
{}
#line 60 "./src/objects/statement.lzz"
#line 61 "./src/objects/statement.lzz"
Statement::Statement (Database * db, sqlite3_stmt * handle, sqlite3_uint64 id, bool returns_data)
#line 65 "./src/objects/statement.lzz"
#line 66 "./src/objects/statement.lzz"
: node::ObjectWrap (), db (db), handle (handle), extras (new Extras(id)), alive (true), locked (false), bound (false), has_bind_map (false), safe_ints (db->GetState()->safe_ints), mode (Data::FLAT), returns_data (returns_data)
#line 76 "./src/objects/statement.lzz"
#line 77 "./src/objects/statement.lzz"
{
assert(db != NULL);
assert(handle != NULL);
@@ -810,9 +811,9 @@ Statement::Statement (Database * db, sqlite3_stmt * handle, sqlite3_uint64 id, b
assert(!db->GetState()->busy);
db->AddStatement(this);
}
#line 84 "./src/objects/statement.lzz"
#line 85 "./src/objects/statement.lzz"
void Statement::JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 84 "./src/objects/statement.lzz"
#line 85 "./src/objects/statement.lzz"
{
Addon * addon = static_cast < Addon * > ( info . Data ( ) . As < v8 :: External > ( ) -> Value ( ) ) ;
if (!addon->privileged_info) {
@@ -876,9 +877,9 @@ void Statement::JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info)
info.GetReturnValue().Set(info.This());
}
#line 148 "./src/objects/statement.lzz"
#line 149 "./src/objects/statement.lzz"
void Statement::JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 148 "./src/objects/statement.lzz"
#line 149 "./src/objects/statement.lzz"
{
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; ( ( void ) 0 ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; if ( ! db -> GetState ( ) -> unsafe_mode ) { if ( db -> GetState ( ) -> iterators ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; } ( ( void ) 0 ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
sqlite3* db_handle = db->GetHandle();
@@ -901,9 +902,9 @@ void Statement::JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info)
}
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
}
#line 171 "./src/objects/statement.lzz"
#line 172 "./src/objects/statement.lzz"
void Statement::JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 171 "./src/objects/statement.lzz"
#line 172 "./src/objects/statement.lzz"
{
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; if ( ! stmt -> returns_data ) return ThrowTypeError ( "This statement does not return data. Use run() instead" ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
int status = sqlite3_step(handle);
@@ -918,9 +919,9 @@ void Statement::JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info)
sqlite3_reset(handle);
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
}
#line 186 "./src/objects/statement.lzz"
#line 187 "./src/objects/statement.lzz"
void Statement::JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 186 "./src/objects/statement.lzz"
#line 187 "./src/objects/statement.lzz"
{
Statement * stmt = node :: ObjectWrap :: Unwrap < Statement > ( info . This ( ) ) ; if ( ! stmt -> returns_data ) return ThrowTypeError ( "This statement does not return data. Use run() instead" ) ; sqlite3_stmt * handle = stmt -> handle ; Database * db = stmt -> db ; if ( ! db -> GetState ( ) -> open ) return ThrowTypeError ( "The database connection is not open" ) ; if ( db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ; if ( stmt -> locked ) return ThrowTypeError ( "This statement is busy executing a query" ) ; const bool bound = stmt -> bound ; if ( ! bound ) { Binder binder ( handle ) ; if ( ! binder . Bind ( info , info . Length ( ) , stmt ) ) { sqlite3_clear_bindings ( handle ) ; return ; } ( ( void ) 0 ) ; } else if ( info . Length ( ) > 0 ) { return ThrowTypeError ( "This statement already has bound parameters" ) ; } ( ( void ) 0 ) ; db -> GetState ( ) -> busy = true ; v8 :: Isolate * isolate = info . GetIsolate ( ) ; if ( db -> Log ( isolate , handle ) ) { db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ; } ( ( void ) 0 ) ;
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
@@ -941,9 +942,9 @@ void Statement::JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info)
if (js_error) db->GetState()->was_js_error = true;
db -> GetState ( ) -> busy = false ; db -> ThrowDatabaseError ( ) ; if ( ! bound ) { sqlite3_clear_bindings ( handle ) ; } return ;
}
#line 207 "./src/objects/statement.lzz"
#line 208 "./src/objects/statement.lzz"
void Statement::JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 207 "./src/objects/statement.lzz"
#line 208 "./src/objects/statement.lzz"
{
Addon * addon = static_cast < Addon * > ( info . Data ( ) . As < v8 :: External > ( ) -> Value ( ) ) ;
v8 :: Isolate * isolate = info . GetIsolate ( ) ;
@@ -953,9 +954,9 @@ void Statement::JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info)
addon->privileged_info = NULL;
if (!maybeIterator.IsEmpty()) info.GetReturnValue().Set(maybeIterator.ToLocalChecked());
}
#line 217 "./src/objects/statement.lzz"
#line 218 "./src/objects/statement.lzz"
void Statement::JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 217 "./src/objects/statement.lzz"
#line 218 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if (stmt->bound) return ThrowTypeError("The bind() method can only be invoked once per statement object");
@@ -966,9 +967,9 @@ void Statement::JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info)
stmt->bound = true;
info.GetReturnValue().Set(info.This());
}
#line 228 "./src/objects/statement.lzz"
#line 229 "./src/objects/statement.lzz"
void Statement::JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 228 "./src/objects/statement.lzz"
#line 229 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if (!stmt->returns_data) return ThrowTypeError("The pluck() method is only for statements that return data");
@@ -979,9 +980,9 @@ void Statement::JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info)
stmt->mode = use ? Data::PLUCK : stmt->mode == Data::PLUCK ? Data::FLAT : stmt->mode;
info.GetReturnValue().Set(info.This());
}
#line 239 "./src/objects/statement.lzz"
#line 240 "./src/objects/statement.lzz"
void Statement::JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 239 "./src/objects/statement.lzz"
#line 240 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if (!stmt->returns_data) return ThrowTypeError("The expand() method is only for statements that return data");
@@ -992,9 +993,9 @@ void Statement::JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info)
stmt->mode = use ? Data::EXPAND : stmt->mode == Data::EXPAND ? Data::FLAT : stmt->mode;
info.GetReturnValue().Set(info.This());
}
#line 250 "./src/objects/statement.lzz"
#line 251 "./src/objects/statement.lzz"
void Statement::JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 250 "./src/objects/statement.lzz"
#line 251 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if (!stmt->returns_data) return ThrowTypeError("The raw() method is only for statements that return data");
@@ -1005,9 +1006,9 @@ void Statement::JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info)
stmt->mode = use ? Data::RAW : stmt->mode == Data::RAW ? Data::FLAT : stmt->mode;
info.GetReturnValue().Set(info.This());
}
#line 261 "./src/objects/statement.lzz"
#line 262 "./src/objects/statement.lzz"
void Statement::JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 261 "./src/objects/statement.lzz"
#line 262 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if ( stmt -> db -> GetState ( ) -> busy ) return ThrowTypeError ( "This database connection is busy executing a query" ) ;
@@ -1016,9 +1017,9 @@ void Statement::JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const &
else { if ( info . Length ( ) <= ( 0 ) || ! info [ 0 ] -> IsBoolean ( ) ) return ThrowTypeError ( "Expected " "first" " argument to be " "a boolean" ) ; stmt -> safe_ints = ( info [ 0 ] . As < v8 :: Boolean > ( ) ) -> Value ( ) ; }
info.GetReturnValue().Set(info.This());
}
#line 270 "./src/objects/statement.lzz"
#line 271 "./src/objects/statement.lzz"
void Statement::JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info)
#line 270 "./src/objects/statement.lzz"
#line 271 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
if (!stmt->returns_data) return ThrowTypeError("The columns() method is only for statements that return data");
@@ -1061,6 +1062,13 @@ void Statement::JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info)
info.GetReturnValue().Set(columns);
}
#line 314 "./src/objects/statement.lzz"
void Statement::JS_busy (v8::Local <v8 :: String> _, v8::PropertyCallbackInfo <v8 :: Value> const & info)
#line 314 "./src/objects/statement.lzz"
{
Statement* stmt = node :: ObjectWrap :: Unwrap <Statement>(info.This());
info.GetReturnValue().Set(stmt->alive && stmt->locked);
}
#line 4 "./src/objects/statement-iterator.lzz"
v8::Local <v8 :: Function> StatementIterator::Init (v8::Isolate * isolate, v8::Local <v8 :: External> data)
#line 4 "./src/objects/statement-iterator.lzz"
+40 -38
View File
@@ -312,71 +312,73 @@ class Statement : public node::ObjectWrap
public:
#line 4 "./src/objects/statement.lzz"
static v8::Local <v8 :: Function> Init (v8::Isolate * isolate, v8::Local <v8 :: External> data);
#line 20 "./src/objects/statement.lzz"
#line 21 "./src/objects/statement.lzz"
static bool Compare (Statement const * const a, Statement const * const b);
#line 25 "./src/objects/statement.lzz"
#line 26 "./src/objects/statement.lzz"
BindMap * GetBindMap (v8::Isolate * isolate);
#line 38 "./src/objects/statement.lzz"
#line 39 "./src/objects/statement.lzz"
void CloseHandles ();
#line 45 "./src/objects/statement.lzz"
#line 46 "./src/objects/statement.lzz"
~ Statement ();
#line 51 "./src/objects/statement.lzz"
#line 52 "./src/objects/statement.lzz"
private:
#line 54 "./src/objects/statement.lzz"
#line 55 "./src/objects/statement.lzz"
class Extras
{
#line 54 "./src/objects/statement.lzz"
friend class Statement;
#line 55 "./src/objects/statement.lzz"
explicit Extras (sqlite3_uint64 id);
friend class Statement;
#line 56 "./src/objects/statement.lzz"
BindMap bind_map;
explicit Extras (sqlite3_uint64 id);
#line 57 "./src/objects/statement.lzz"
BindMap bind_map;
#line 58 "./src/objects/statement.lzz"
sqlite3_uint64 const id;
};
#line 60 "./src/objects/statement.lzz"
#line 61 "./src/objects/statement.lzz"
explicit Statement (Database * db, sqlite3_stmt * handle, sqlite3_uint64 id, bool returns_data);
#line 84 "./src/objects/statement.lzz"
#line 85 "./src/objects/statement.lzz"
static void JS_new (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 148 "./src/objects/statement.lzz"
#line 149 "./src/objects/statement.lzz"
static void JS_run (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 171 "./src/objects/statement.lzz"
#line 172 "./src/objects/statement.lzz"
static void JS_get (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 186 "./src/objects/statement.lzz"
#line 187 "./src/objects/statement.lzz"
static void JS_all (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 207 "./src/objects/statement.lzz"
#line 208 "./src/objects/statement.lzz"
static void JS_iterate (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 217 "./src/objects/statement.lzz"
#line 218 "./src/objects/statement.lzz"
static void JS_bind (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 228 "./src/objects/statement.lzz"
#line 229 "./src/objects/statement.lzz"
static void JS_pluck (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 239 "./src/objects/statement.lzz"
#line 240 "./src/objects/statement.lzz"
static void JS_expand (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 250 "./src/objects/statement.lzz"
#line 251 "./src/objects/statement.lzz"
static void JS_raw (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 261 "./src/objects/statement.lzz"
#line 262 "./src/objects/statement.lzz"
static void JS_safeIntegers (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 270 "./src/objects/statement.lzz"
#line 271 "./src/objects/statement.lzz"
static void JS_columns (v8::FunctionCallbackInfo <v8 :: Value> const & info);
#line 313 "./src/objects/statement.lzz"
Database * const db;
#line 314 "./src/objects/statement.lzz"
sqlite3_stmt * const handle;
#line 315 "./src/objects/statement.lzz"
Extras * const extras;
#line 316 "./src/objects/statement.lzz"
bool alive;
#line 317 "./src/objects/statement.lzz"
bool locked;
#line 318 "./src/objects/statement.lzz"
bool bound;
static void JS_busy (v8::Local <v8 :: String> _, v8::PropertyCallbackInfo <v8 :: Value> const & info);
#line 319 "./src/objects/statement.lzz"
bool has_bind_map;
Database * const db;
#line 320 "./src/objects/statement.lzz"
bool safe_ints;
sqlite3_stmt * const handle;
#line 321 "./src/objects/statement.lzz"
char mode;
Extras * const extras;
#line 322 "./src/objects/statement.lzz"
bool alive;
#line 323 "./src/objects/statement.lzz"
bool locked;
#line 324 "./src/objects/statement.lzz"
bool bound;
#line 325 "./src/objects/statement.lzz"
bool has_bind_map;
#line 326 "./src/objects/statement.lzz"
bool safe_ints;
#line 327 "./src/objects/statement.lzz"
char mode;
#line 328 "./src/objects/statement.lzz"
bool const returns_data;
};
#line 1 "./src/objects/statement-iterator.lzz"
@@ -916,9 +918,9 @@ LZZ_INLINE Addon * Database::GetAddon ()
{
return addon;
}
#line 20 "./src/objects/statement.lzz"
#line 21 "./src/objects/statement.lzz"
LZZ_INLINE bool Statement::Compare (Statement const * const a, Statement const * const b)
#line 20 "./src/objects/statement.lzz"
#line 21 "./src/objects/statement.lzz"
{
return a->extras->id < b->extras->id;
}
+6
View File
@@ -13,6 +13,7 @@ public:
SetPrototypeMethod(isolate, data, t, "raw", JS_raw);
SetPrototypeMethod(isolate, data, t, "safeIntegers", JS_safeIntegers);
SetPrototypeMethod(isolate, data, t, "columns", JS_columns);
SetPrototypeGetter(isolate, data, t, "busy", JS_busy);
return t->GetFunction(OnlyContext).ToLocalChecked();
}
@@ -310,6 +311,11 @@ private:
info.GetReturnValue().Set(columns);
}
NODE_GETTER(JS_busy) {
Statement* stmt = Unwrap<Statement>(info.This());
info.GetReturnValue().Set(stmt->alive && stmt->locked);
}
Database* const db;
sqlite3_stmt* const handle;
Extras* const extras;
+8
View File
@@ -32,6 +32,7 @@ describe('Statement#iterate()', function () {
let count = 0;
let stmt = this.db.prepare("SELECT * FROM entries ORDER BY rowid");
expect(stmt.reader).to.be.true;
expect(stmt.busy).to.be.false;
const iterator = stmt.iterate();
expect(iterator).to.not.be.null;
@@ -41,22 +42,29 @@ describe('Statement#iterate()', function () {
expect(iterator.throw).to.not.be.a('function');
expect(iterator[Symbol.iterator]).to.be.a('function');
expect(iterator[Symbol.iterator]()).to.equal(iterator);
expect(stmt.busy).to.be.true;
for (const data of iterator) {
row.b = ++count;
expect(data).to.deep.equal(row);
expect(stmt.busy).to.be.true;
}
expect(count).to.equal(10);
expect(stmt.busy).to.be.false;
count = 0;
stmt = this.db.prepare("SELECT * FROM entries WHERE b > 5 ORDER BY rowid");
expect(stmt.busy).to.be.false;
const iterator2 = stmt.iterate();
expect(iterator).to.not.equal(iterator2);
expect(stmt.busy).to.be.true;
for (const data of iterator2) {
row.b = ++count + 5;
expect(data).to.deep.equal(row);
expect(stmt.busy).to.be.true;
}
expect(count).to.equal(5);
expect(stmt.busy).to.be.false;
});
it('should work with RETURNING clause', function () {
let stmt = this.db.prepare("INSERT INTO entries (a, b) VALUES ('bar', 888), ('baz', 999) RETURNING *");