1
1
import { Injectable } from '@angular/core' ;
2
- import { Cordova , CordovaInstance , Plugin , CordovaCheck , InstanceProperty , IonicNativePlugin } from '@ionic-native/core' ;
2
+ import {
3
+ Cordova ,
4
+ CordovaCheck ,
5
+ CordovaInstance ,
6
+ InstanceProperty ,
7
+ IonicNativePlugin ,
8
+ Plugin
9
+ } from '@ionic-native/core' ;
3
10
4
11
declare const sqlitePlugin : any ;
5
12
@@ -17,8 +24,8 @@ export interface SQLiteDatabaseConfig {
17
24
*/
18
25
iosDatabaseLocation ?: string ;
19
26
/**
20
- * support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext
21
- */
27
+ * support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext
28
+ */
22
29
createFromLocation ?: number ;
23
30
/**
24
31
* support encrypted databases with https://github.com/litehelpers/Cordova-sqlcipher-adapter
@@ -31,8 +38,18 @@ export interface SQLiteDatabaseConfig {
31
38
*/
32
39
export interface SQLiteTransaction {
33
40
start : ( ) => void ;
34
- executeSql : ( sql : any , values : any , success : Function , error : Function ) => void ;
35
- addStatement : ( sql : any , values : any , success : Function , error : Function ) => void ;
41
+ executeSql : (
42
+ sql : any ,
43
+ values : any ,
44
+ success : Function ,
45
+ error : Function
46
+ ) => void ;
47
+ addStatement : (
48
+ sql : any ,
49
+ values : any ,
50
+ success : Function ,
51
+ error : Function
52
+ ) => void ;
36
53
handleStatementSuccess : ( handler : Function , response : any ) => void ;
37
54
handleStatementFailure : ( handler : Function , response : any ) => void ;
38
55
run : ( ) => void ;
@@ -45,8 +62,7 @@ export interface SQLiteTransaction {
45
62
* @hidden
46
63
*/
47
64
export class SQLiteObject {
48
-
49
- constructor ( public _objectInstance : any ) { }
65
+ constructor ( public _objectInstance : any ) { }
50
66
51
67
@InstanceProperty databaseFeatures : { isSQLitePluginDatabase : boolean } ;
52
68
@@ -55,7 +71,7 @@ export class SQLiteObject {
55
71
@CordovaInstance ( {
56
72
sync : true
57
73
} )
58
- addTransaction ( transaction : ( tx : SQLiteTransaction ) => void ) : void { }
74
+ addTransaction ( transaction : ( tx : SQLiteTransaction ) => void ) : void { }
59
75
60
76
/**
61
77
* @param fn {any}
@@ -65,51 +81,62 @@ export class SQLiteObject {
65
81
successIndex : 2 ,
66
82
errorIndex : 1
67
83
} )
68
- transaction ( fn : any ) : Promise < any > { return ; }
84
+ transaction ( fn : any ) : Promise < any > {
85
+ return ;
86
+ }
69
87
70
88
/**
71
89
* @param fn {Function}
72
90
* @returns {Promise<any> }
73
91
*/
74
92
@CordovaInstance ( )
75
- readTransaction ( fn : ( tx : SQLiteTransaction ) => void ) : Promise < any > { return ; }
93
+ readTransaction ( fn : ( tx : SQLiteTransaction ) => void ) : Promise < any > {
94
+ return ;
95
+ }
76
96
77
97
@CordovaInstance ( {
78
98
sync : true
79
99
} )
80
- startNextTransaction ( ) : void { }
100
+ startNextTransaction ( ) : void { }
81
101
82
102
/**
83
103
* @returns {Promise<any> }
84
104
*/
85
105
@CordovaInstance ( )
86
- open ( ) : Promise < any > { return ; }
106
+ open ( ) : Promise < any > {
107
+ return ;
108
+ }
87
109
88
110
/**
89
111
* @returns {Promise<any> }
90
112
*/
91
113
@CordovaInstance ( )
92
- close ( ) : Promise < any > { return ; }
114
+ close ( ) : Promise < any > {
115
+ return ;
116
+ }
93
117
94
118
/**
95
119
* Execute SQL on the opened database. Note, you must call `create` first, and
96
120
* ensure it resolved and successfully opened the database.
97
121
*/
98
122
@CordovaInstance ( )
99
- executeSql ( statement : string , params : any ) : Promise < any > { return ; }
123
+ executeSql ( statement : string , params : any ) : Promise < any > {
124
+ return ;
125
+ }
100
126
101
127
/**
102
128
* @param sqlStatements {Array<string | string[] | any>}
103
129
* @returns {Promise<any> }
104
130
*/
105
131
@CordovaInstance ( )
106
- sqlBatch ( sqlStatements : Array < string | string [ ] | any > ) : Promise < any > { return ; }
132
+ sqlBatch ( sqlStatements : Array < string | string [ ] | any > ) : Promise < any > {
133
+ return ;
134
+ }
107
135
108
136
@CordovaInstance ( {
109
137
sync : true
110
138
} )
111
- abortallPendingTransactions ( ) : void { }
112
-
139
+ abortallPendingTransactions ( ) : void { }
113
140
}
114
141
115
142
/**
@@ -159,7 +186,6 @@ export class SQLiteObject {
159
186
} )
160
187
@Injectable ( )
161
188
export class SQLite extends IonicNativePlugin {
162
-
163
189
/**
164
190
* Open or create a SQLite database file.
165
191
*
@@ -171,7 +197,11 @@ export class SQLite extends IonicNativePlugin {
171
197
@CordovaCheck ( )
172
198
create ( config : SQLiteDatabaseConfig ) : Promise < SQLiteObject > {
173
199
return new Promise ( ( resolve , reject ) => {
174
- sqlitePlugin . openDatabase ( config , ( db : any ) => resolve ( new SQLiteObject ( db ) ) , reject ) ;
200
+ sqlitePlugin . openDatabase (
201
+ config ,
202
+ ( db : any ) => resolve ( new SQLiteObject ( db ) ) ,
203
+ reject
204
+ ) ;
175
205
} ) ;
176
206
}
177
207
@@ -180,21 +210,26 @@ export class SQLite extends IonicNativePlugin {
180
210
* @returns {Promise<any> }
181
211
*/
182
212
@Cordova ( )
183
- echoTest ( ) : Promise < any > { return ; }
184
-
213
+ echoTest ( ) : Promise < any > {
214
+ return ;
215
+ }
216
+
185
217
/**
186
218
* Automatically verify basic database access operations including opening a database
187
219
* @returns {Promise<any> }
188
220
*/
189
221
@Cordova ( )
190
- selfTest ( ) : Promise < any > { return ; }
222
+ selfTest ( ) : Promise < any > {
223
+ return ;
224
+ }
191
225
192
226
/**
193
227
* Deletes a database
194
228
* @param config {SQLiteDatabaseConfig} database configuration
195
229
* @returns {Promise<any> }
196
230
*/
197
231
@Cordova ( )
198
- deleteDatabase ( config : SQLiteDatabaseConfig ) : Promise < any > { return ; }
199
-
232
+ deleteDatabase ( config : SQLiteDatabaseConfig ) : Promise < any > {
233
+ return ;
234
+ }
200
235
}
0 commit comments