@@ -15,6 +15,22 @@ var Sqlite3Driver = Base.extend({
15
15
this . connection = connection ;
16
16
} ,
17
17
18
+ _translateSpecialDefaultValues : function (
19
+ spec ,
20
+ options ,
21
+ tableName ,
22
+ columnName
23
+ ) {
24
+ switch ( spec . defaultValue . special ) {
25
+ case 'CURRENT_TIMESTAMP' :
26
+ spec . defaultValue . prep = 'CURRENT_TIMESTAMP' ;
27
+ break ;
28
+ default :
29
+ this . super ( spec , options , tableName , columnName ) ;
30
+ break ;
31
+ }
32
+ } ,
33
+
18
34
createDatabase : function ( cb ) {
19
35
// sqlite does this automatically if needed
20
36
return Promise . resolve ( null ) . nodeify ( cb ) ;
@@ -84,7 +100,11 @@ var Sqlite3Driver = Base.extend({
84
100
85
101
if ( typeof spec . defaultValue === 'string' ) {
86
102
constraint . push ( '"' + spec . defaultValue + '"' ) ;
87
- } else constraint . push ( spec . defaultValue ) ;
103
+ } else if ( typeof spec . defaultValue . prep === 'string' ) {
104
+ constraint . push ( spec . defaultValue . prep ) ;
105
+ } else {
106
+ constraint . push ( spec . defaultValue ) ;
107
+ }
88
108
}
89
109
90
110
return constraint . join ( ' ' ) ;
@@ -139,9 +159,15 @@ var Sqlite3Driver = Base.extend({
139
159
} ,
140
160
141
161
all : function ( ) {
142
- this . log . sql . apply ( null , arguments ) ;
162
+ var params = arguments ;
163
+
164
+ this . log . sql . apply ( null , params ) ;
143
165
144
- this . connection . all . apply ( this . connection , arguments ) ;
166
+ return new Promise ( ( resolve , reject ) => {
167
+ this . connection . all ( params [ 0 ] , function ( err , result ) {
168
+ return err ? reject ( err ) : resolve ( result ) ;
169
+ } ) ;
170
+ } ) . nodeify ( params [ 1 ] ) ;
145
171
} ,
146
172
147
173
close : function ( callback ) {
0 commit comments