@@ -173,15 +173,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
173
173
[ "number" ]
174
174
) ;
175
175
176
-
177
- function isNullOrUndefined ( val ) {
178
- return val === null || val === undefined ;
179
- }
180
- function throwError ( err ) {
181
- throw err ;
182
- }
183
-
184
- /* Represents a prepared statement.
176
+ /** Represents a prepared statement.
185
177
186
178
Prepared statements allow you to have a template sql string,
187
179
that you can execute multiple times with different parameters.
@@ -194,11 +186,9 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
194
186
195
187
@see Database.html#prepare-dynamic
196
188
@see https://en.wikipedia.org/wiki/Prepared_statement
197
- */
198
- /*
189
+
199
190
Statements can't be created by the API user, only by Database::prepare
200
191
@private
201
- @nodoc
202
192
*/
203
193
function Statement ( stmt1 , db ) {
204
194
this . stmt = stmt1 ;
@@ -288,15 +278,15 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
288
278
that has been executed
289
279
*/
290
280
Statement . prototype . getNumber = function getNumber ( pos ) {
291
- if ( isNullOrUndefined ( pos ) ) {
281
+ if ( pos == null ) {
292
282
pos = this . pos ;
293
283
this . pos += 1 ;
294
284
}
295
285
return sqlite3_column_double ( this . stmt , pos ) ;
296
286
} ;
297
287
298
288
Statement . prototype . getString = function getString ( pos ) {
299
- if ( isNullOrUndefined ( pos ) ) {
289
+ if ( pos == null ) {
300
290
pos = this . pos ;
301
291
this . pos += 1 ;
302
292
}
@@ -308,7 +298,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
308
298
var ptr ;
309
299
var result ;
310
300
var size ;
311
- if ( isNullOrUndefined ( pos ) ) {
301
+ if ( pos == null ) {
312
302
pos = this . pos ;
313
303
this . pos += 1 ;
314
304
}
@@ -338,7 +328,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
338
328
var field ;
339
329
var ref ;
340
330
var results1 ;
341
- if ( ! isNullOrUndefined ( params ) && this [ "bind" ] ( params ) ) {
331
+ if ( params != null && this [ "bind" ] ( params ) ) {
342
332
this [ "step" ] ( ) ;
343
333
}
344
334
results1 = [ ] ;
@@ -431,7 +421,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
431
421
@param [Array,Object] Value to bind to the statement
432
422
*/
433
423
Statement . prototype [ "run" ] = function run ( values ) {
434
- if ( ! isNullOrUndefined ( values ) ) {
424
+ if ( values != null ) {
435
425
this [ "bind" ] ( values ) ;
436
426
}
437
427
this [ "step" ] ( ) ;
@@ -441,7 +431,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
441
431
Statement . prototype . bindString = function bindString ( string , pos ) {
442
432
var bytes ;
443
433
var strptr ;
444
- if ( isNullOrUndefined ( pos ) ) {
434
+ if ( pos == null ) {
445
435
pos = this . pos ;
446
436
this . pos += 1 ;
447
437
}
@@ -460,7 +450,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
460
450
461
451
Statement . prototype . bindBlob = function bindBlob ( array , pos ) {
462
452
var blobptr ;
463
- if ( isNullOrUndefined ( pos ) ) {
453
+ if ( pos == null ) {
464
454
pos = this . pos ;
465
455
this . pos += 1 ;
466
456
}
@@ -478,7 +468,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
478
468
479
469
Statement . prototype . bindNumber = function bindNumber ( num , pos ) {
480
470
var bindfunc ;
481
- if ( isNullOrUndefined ( pos ) ) {
471
+ if ( pos == null ) {
482
472
pos = this . pos ;
483
473
this . pos += 1 ;
484
474
}
@@ -492,15 +482,15 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
492
482
} ;
493
483
494
484
Statement . prototype . bindNull = function bindNull ( pos ) {
495
- if ( isNullOrUndefined ( pos ) ) {
485
+ if ( pos == null ) {
496
486
pos = this . pos ;
497
487
this . pos += 1 ;
498
488
}
499
489
return sqlite3_bind_blob ( this . stmt , pos , 0 , 0 , 0 ) === SQLITE_OK ;
500
490
} ;
501
491
502
492
Statement . prototype . bindValue = function bindValue ( val , pos ) {
503
- if ( isNullOrUndefined ( pos ) ) {
493
+ if ( pos == null ) {
504
494
pos = this . pos ;
505
495
this . pos += 1 ;
506
496
}
@@ -514,7 +504,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
514
504
if ( val === null ) {
515
505
return this . bindNull ( pos ) ;
516
506
}
517
- if ( ! isNullOrUndefined ( val . length ) ) {
507
+ if ( val . length != null ) {
518
508
return this . bindBlob ( val , pos ) ;
519
509
}
520
510
break ;
@@ -602,7 +592,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
602
592
*/
603
593
function Database ( data ) {
604
594
this . filename = "dbfile_" + ( 0xffffffff * Math . random ( ) >>> 0 ) ;
605
- if ( ! isNullOrUndefined ( data ) ) {
595
+ if ( data != null ) {
606
596
FS . createDataFile ( "/" , this . filename , data , true , true ) ;
607
597
}
608
598
this . handleError ( sqlite3_open ( this . filename , apiTemp ) ) ;
@@ -641,8 +631,6 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
641
631
stmt = this [ "prepare" ] ( sql , params ) ;
642
632
try {
643
633
stmt [ "step" ] ( ) ;
644
- } catch ( errCaught ) {
645
- throwError ( errCaught ) ;
646
634
} finally {
647
635
stmt [ "free" ] ( ) ;
648
636
}
@@ -805,7 +793,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
805
793
throw "Nothing to prepare" ;
806
794
}
807
795
stmt = new Statement ( pStmt , this ) ;
808
- if ( ! isNullOrUndefined ( params ) ) {
796
+ if ( params != null ) {
809
797
stmt . bind ( params ) ;
810
798
}
811
799
this . statements [ pStmt ] = stmt ;
@@ -960,7 +948,7 @@ Module["onRuntimeInitialized"] = (function onRuntimeInitialized() {
960
948
case "object" :
961
949
if ( result === null ) {
962
950
sqlite3_result_null ( cx ) ;
963
- } else if ( ! isNullOrUndefined ( result . length ) ) {
951
+ } else if ( result . length != null ) {
964
952
blobptr = allocate ( result , "i8" , ALLOC_NORMAL ) ;
965
953
sqlite3_result_blob ( cx , blobptr , result . length , - 1 ) ;
966
954
_free ( blobptr ) ;
0 commit comments