@@ -529,19 +529,6 @@ SQLite3.prototype.toColumnValue = function(property, value) {
529529 return b ;
530530 case 'String' :
531531 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 ) ;
545532 case 'Date' :
546533 if ( ! isNaN ( value ) )
547534 return Number ( value ) ;
@@ -552,13 +539,19 @@ SQLite3.prototype.toColumnValue = function(property, value) {
552539 }
553540 return new InvalidParam ( 'SQLITE3: Invalid JSON: ' + value ) ;
554541 case 'Array' :
542+ case 'GeoPoint' :
543+ case 'Point' :
544+ case 'List' :
545+ case 'Object' :
546+ case 'ModelConstructor' :
547+ case 'JSON' :
555548 default :
556- return value ;
549+ return JSON . stringify ( value ) ;
557550 }
558551} ;
559552
560553SQLite3 . prototype . fromColumnValue = function ( property , value ) {
561- if ( value === null || ! property ) {
554+ if ( value == null || ! property ) {
562555 return value ;
563556 }
564557 switch ( property . type . name ) {
@@ -572,19 +565,17 @@ SQLite3.prototype.fromColumnValue = function(property, value) {
572565 ) ;
573566 case 'String' :
574567 return String ( value ) ;
568+ case 'Date' :
569+ return new Date ( value ) ;
575570 case 'GeoPoint' :
576571 case 'Point' :
577572 case 'List' :
578573 case 'Array' :
579574 case 'Object' :
580575 case 'ModelConstructor' :
581- return JSON . parse ( value ) ;
582576 case 'JSON' :
583- return String ( value ) ;
584- case 'Date' :
585- return new Date ( value ) ;
586577 default :
587- return value ;
578+ return JSON . parse ( value ) ;
588579 }
589580} ;
590581
@@ -593,6 +584,9 @@ SQLite3.prototype.buildInsertDefaultValues = function() {
593584 return 'DEFAULT VALUES' ;
594585} ;
595586
587+ SQLite3 . prototype . ping = function ( cb ) {
588+ if ( cb ) process . nextTick ( cb ) ;
589+ } ;
596590
597591//require('./discovery')(SQLite3);
598592require ( './migration' ) ( SQLite3 ) ;
0 commit comments