@@ -117,12 +117,6 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
117117 [ "number" , "number" , "number" ]
118118 ) ;
119119
120- var sqlite3_bind_int64 = cwrap (
121- "sqlite3_bind_int64" ,
122- "number" ,
123- [ "number" , "number" ]
124- ) ;
125-
126120 var sqlite3_bind_parameter_index = cwrap (
127121 "sqlite3_bind_parameter_index" ,
128122 "number" ,
@@ -371,6 +365,10 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
371365 this . pos += 1 ;
372366 }
373367 var text = sqlite3_column_text ( this . stmt , pos ) ;
368+ if ( typeof BigInt !== "function" ) {
369+ throw new Error ( "BigInt is not supported" ) ;
370+ }
371+ /* global BigInt */
374372 return BigInt ( text ) ;
375373 } ;
376374
@@ -411,7 +409,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
411409 var stmt = db.prepare("SELECT * FROM test");
412410 while (stmt.step()) console.log(stmt.get(null, {useBigInt: true}));
413411 */
414- Statement . prototype [ "get" ] = function get ( params , config = { } ) {
412+ Statement . prototype [ "get" ] = function get ( params , config ) {
415413 if ( params != null && this [ "bind" ] ( params ) ) {
416414 this [ "step" ] ( ) ;
417415 }
@@ -420,7 +418,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
420418 for ( var field = 0 ; field < ref ; field += 1 ) {
421419 switch ( sqlite3_column_type ( this . stmt , field ) ) {
422420 case SQLITE_INTEGER :
423- var getfunc = config . useBigInt
421+ var getfunc = config && config . useBigInt
424422 ? this . getBigInt ( field )
425423 : this . getNumber ( field ) ;
426424 results1 . push ( getfunc ) ;
@@ -476,7 +474,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
476474 console.log(stmt.getAsObject());
477475 // Will print {nbr:5, data: Uint8Array([1,2,3]), null_value:null}
478476 */
479- Statement . prototype [ "getAsObject" ] = function getAsObject ( params , config = { } ) {
477+ Statement . prototype [ "getAsObject" ] = function getAsObject ( params , config ) {
480478 var values = this [ "get" ] ( params , config ) ;
481479 var names = this [ "getColumnNames" ] ( ) ;
482480 var rowObject = { } ;
@@ -572,15 +570,6 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
572570 return true ;
573571 } ;
574572
575- Statement . prototype . bindBigInt = function bindBigInt ( num , pos ) {
576- if ( pos == null ) {
577- pos = this . pos ;
578- this . pos += 1 ;
579- }
580- this . db . handleError ( sqlite3_bind_int64 ( this . stmt , pos , num ) ) ;
581- return true ;
582- } ;
583-
584573 Statement . prototype . bindNull = function bindNull ( pos ) {
585574 if ( pos == null ) {
586575 pos = this . pos ;
@@ -938,7 +927,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
938927 (separated by `;`). This limitation does not apply to params as an object.
939928 * @return {Database.QueryExecResult[] } The results of each statement
940929 */
941- Database . prototype [ "exec" ] = function exec ( sql , params , config = { } ) {
930+ Database . prototype [ "exec" ] = function exec ( sql , params , config ) {
942931 if ( ! this . db ) {
943932 throw "Database closed" ;
944933 }
@@ -1010,7 +999,9 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
1010999 function (row){console.log(row.name + " is a grown-up.")}
10111000 );
10121001 */
1013- Database . prototype [ "each" ] = function each ( sql , params , callback , done , config = { } ) {
1002+ Database . prototype [ "each" ] = function each (
1003+ sql , params , callback , done , config
1004+ ) {
10141005 var stmt ;
10151006 if ( typeof params === "function" ) {
10161007 done = callback ;
0 commit comments