@@ -529,19 +529,6 @@ SQLite3.prototype.toColumnValue = function(property, value) {
529
529
return b ;
530
530
case 'String' :
531
531
return value ;
532
- case 'GeoPoint' :
533
- case 'Point' :
534
- case 'List' :
535
- case 'Object' :
536
- case 'ModelConstructor' :
537
- return JSON . stringify ( value ) ;
538
- case 'JSON' :
539
- try {
540
- JSON . parse ( value ) ;
541
- } catch ( e ) {
542
- return new InvalidParam ( 'SQLITE3: Invalid JSON: ' + value ) ;
543
- }
544
- return String ( value ) ;
545
532
case 'Date' :
546
533
if ( ! isNaN ( value ) )
547
534
return Number ( value ) ;
@@ -552,13 +539,19 @@ SQLite3.prototype.toColumnValue = function(property, value) {
552
539
}
553
540
return new InvalidParam ( 'SQLITE3: Invalid JSON: ' + value ) ;
554
541
case 'Array' :
542
+ case 'GeoPoint' :
543
+ case 'Point' :
544
+ case 'List' :
545
+ case 'Object' :
546
+ case 'ModelConstructor' :
547
+ case 'JSON' :
555
548
default :
556
- return value ;
549
+ return JSON . stringify ( value ) ;
557
550
}
558
551
} ;
559
552
560
553
SQLite3 . prototype . fromColumnValue = function ( property , value ) {
561
- if ( value === null || ! property ) {
554
+ if ( value == null || ! property ) {
562
555
return value ;
563
556
}
564
557
switch ( property . type . name ) {
@@ -572,19 +565,17 @@ SQLite3.prototype.fromColumnValue = function(property, value) {
572
565
) ;
573
566
case 'String' :
574
567
return String ( value ) ;
568
+ case 'Date' :
569
+ return new Date ( value ) ;
575
570
case 'GeoPoint' :
576
571
case 'Point' :
577
572
case 'List' :
578
573
case 'Array' :
579
574
case 'Object' :
580
575
case 'ModelConstructor' :
581
- return JSON . parse ( value ) ;
582
576
case 'JSON' :
583
- return String ( value ) ;
584
- case 'Date' :
585
- return new Date ( value ) ;
586
577
default :
587
- return value ;
578
+ return JSON . parse ( value ) ;
588
579
}
589
580
} ;
590
581
@@ -593,6 +584,9 @@ SQLite3.prototype.buildInsertDefaultValues = function() {
593
584
return 'DEFAULT VALUES' ;
594
585
} ;
595
586
587
+ SQLite3 . prototype . ping = function ( cb ) {
588
+ if ( cb ) process . nextTick ( cb ) ;
589
+ } ;
596
590
597
591
//require('./discovery')(SQLite3);
598
592
require ( './migration' ) ( SQLite3 ) ;
0 commit comments