@@ -54,7 +54,7 @@ class SQLiteDemo extends Component {
54
54
this . setState ( {
55
55
progress
56
56
} ) ;
57
- }
57
+ } ;
58
58
59
59
componentWillUnmount ( ) {
60
60
this . closeDatabase ( ) ;
@@ -63,30 +63,30 @@ class SQLiteDemo extends Component {
63
63
errorCB = ( err ) => {
64
64
console . log ( "error: " , err ) ;
65
65
this . updateProgress ( "Error " + ( err . message || err ) ) ;
66
- }
66
+ } ;
67
67
68
68
populateDatabase = ( db ) => {
69
- this . updateProgress ( "Database integrity check" )
69
+ this . updateProgress ( "Database integrity check" ) ;
70
70
db . executeSql ( 'SELECT 1 FROM Version LIMIT 1' ) . then ( ( ) => {
71
71
this . updateProgress ( "Database is ready ... executing query ..." ) ;
72
72
db . transaction ( this . queryEmployees ) . then ( ( ) => {
73
73
this . updateProgress ( "Processing completed" )
74
74
} ) ;
75
75
} ) . catch ( ( error ) => {
76
- console . log ( "Received error: " , error )
77
- this . updateProgress ( "Database not yet ready ... populating data" )
76
+ console . log ( "Received error: " , error ) ;
77
+ this . updateProgress ( "Database not yet ready ... populating data" ) ;
78
78
db . transaction ( this . populateDB ) . then ( ( ) => {
79
- this . updateProgress ( "Database populated ... executing query ..." )
79
+ this . updateProgress ( "Database populated ... executing query ..." ) ;
80
80
db . transaction ( this . queryEmployees ) . then ( ( result ) => {
81
81
console . log ( "Transaction is now finished" ) ;
82
82
this . updateProgress ( "Processing completed" ) ;
83
83
this . closeDatabase ( ) } ) ;
84
84
} ) ;
85
85
} ) ;
86
- }
86
+ } ;
87
87
88
88
populateDB = ( tx ) => {
89
- this . updateProgress ( "Executing DROP stmts" )
89
+ this . updateProgress ( "Executing DROP stmts" ) ;
90
90
91
91
tx . executeSql ( 'DROP TABLE IF EXISTS Employees;' ) ;
92
92
tx . executeSql ( 'DROP TABLE IF EXISTS Offices;' ) ;
@@ -125,7 +125,7 @@ class SQLiteDemo extends Component {
125
125
this . errorCB ( error )
126
126
} ) ;
127
127
128
- this . updateProgress ( "Executing INSERT stmts" )
128
+ this . updateProgress ( "Executing INSERT stmts" ) ;
129
129
130
130
131
131
tx . executeSql ( 'INSERT INTO Departments (name) VALUES ("Client Services");' ) ;
@@ -148,12 +148,12 @@ class SQLiteDemo extends Component {
148
148
tx . executeSql ( 'INSERT INTO Employees (name, office, department) VALUES ("Dr DRE", 2, 2);' ) ;
149
149
tx . executeSql ( 'INSERT INTO Employees (name, office, department) VALUES ("Samantha Fox", 2, 1);' ) ;
150
150
console . log ( "all config SQL done" ) ;
151
- }
151
+ } ;
152
152
153
153
queryEmployees = ( tx ) => {
154
154
console . log ( "Executing employee query" ) ;
155
155
tx . executeSql ( 'SELECT a.name, b.name as deptName FROM Employees a, Departments b WHERE a.department = b.department_id and a.department=?' , [ 3 ] ) . then ( ( [ tx , results ] ) => {
156
- this . updateProgress ( "Query completed" )
156
+ this . updateProgress ( "Query completed" ) ;
157
157
var len = results . rows . length ;
158
158
for ( let i = 0 ; i < len ; i ++ ) {
159
159
let row = results . rows . item ( i ) ;
@@ -162,14 +162,14 @@ class SQLiteDemo extends Component {
162
162
} ) . catch ( ( error ) => {
163
163
console . log ( error ) ;
164
164
} ) ;
165
- }
165
+ } ;
166
166
167
167
loadAndQueryDB = ( ) => {
168
168
this . updateProgress ( "Plugin integrity check ..." ) ;
169
169
SQLite . echoTest ( ) . then ( ( ) => {
170
- this . updateProgress ( "Integrity check passed ..." )
171
- this . updateProgress ( "Opening database ..." )
172
- SQLite . openDatabase ( { name : "test5.db" , createFromLocation : "~/db/andrew.db" } ) . then ( ( DB ) => {
170
+ this . updateProgress ( "Integrity check passed ..." ) ;
171
+ this . updateProgress ( "Opening database ..." ) ;
172
+ SQLite . openDatabase ( database_name , database_version , database_displayname , database_size ) . then ( ( DB ) => {
173
173
db = DB ;
174
174
this . updateProgress ( "Database OPEN" ) ;
175
175
this . populateDatabase ( DB ) ;
@@ -179,12 +179,12 @@ class SQLiteDemo extends Component {
179
179
} ) . catch ( error => {
180
180
this . updateProgress ( "echoTest failed - plugin not functional" ) ;
181
181
} ) ;
182
- }
182
+ } ;
183
183
184
184
closeDatabase = ( ) => {
185
185
if ( db ) {
186
186
console . log ( "Closing database ..." ) ;
187
- this . updateProgress ( "Closing DB" )
187
+ this . updateProgress ( "Closing DB" ) ;
188
188
db . close ( ) . then ( ( status ) => {
189
189
this . updateProgress ( "Database CLOSED" ) ;
190
190
} ) . catch ( ( error ) => {
@@ -193,31 +193,31 @@ class SQLiteDemo extends Component {
193
193
} else {
194
194
this . updateProgress ( "Database was not OPENED" )
195
195
}
196
- }
196
+ } ;
197
197
198
198
deleteDatabase = ( ) => {
199
- this . updateProgress ( "Deleting database" )
199
+ this . updateProgress ( "Deleting database" ) ;
200
200
SQLite . deleteDatabase ( database_name ) . then ( ( ) => {
201
201
console . log ( "Database DELETED" ) ;
202
202
this . updateProgress ( "Database DELETED" )
203
203
} ) . catch ( ( error ) => {
204
204
this . errorCB ( error ) ;
205
205
} ) ;
206
- }
206
+ } ;
207
207
208
208
runDemo = ( ) => {
209
209
console . log ( 'running' ) ;
210
210
this . updateProgress ( "Starting SQLite Promise Demo" , true ) ;
211
211
this . loadAndQueryDB ( ) ;
212
- }
212
+ } ;
213
213
214
214
renderProgressEntry = ( entry ) => {
215
215
return ( < View style = { listStyles . li } >
216
216
< View >
217
217
< Text style = { listStyles . liText } > { entry } </ Text >
218
218
</ View >
219
219
</ View > )
220
- }
220
+ } ;
221
221
222
222
render ( ) {
223
223
let ds = new ListView . DataSource ( { rowHasChanged : ( row1 , row2 ) => row1 !== row2 } ) ;
@@ -240,7 +240,7 @@ class SQLiteDemo extends Component {
240
240
style = { listStyles . liContainer } />
241
241
</ View > ) ;
242
242
}
243
- } ;
243
+ }
244
244
245
245
var listStyles = StyleSheet . create ( {
246
246
li : {
0 commit comments