Skip to content

Commit e968096

Browse files
PaulMestandpor
authored andcommitted
* Use correct parameters for SQLite.openDatabase (#291)
* Apply consistent line endings/formatting
1 parent b39fb8a commit e968096

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

test/index.ios.promise.js

+23-23
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SQLiteDemo extends Component {
5454
this.setState({
5555
progress
5656
});
57-
}
57+
};
5858

5959
componentWillUnmount(){
6060
this.closeDatabase();
@@ -63,30 +63,30 @@ class SQLiteDemo extends Component {
6363
errorCB = (err) => {
6464
console.log("error: ",err);
6565
this.updateProgress("Error " + (err.message || err));
66-
}
66+
};
6767

6868
populateDatabase = (db) => {
69-
this.updateProgress("Database integrity check")
69+
this.updateProgress("Database integrity check");
7070
db.executeSql('SELECT 1 FROM Version LIMIT 1').then(() =>{
7171
this.updateProgress("Database is ready ... executing query ...");
7272
db.transaction(this.queryEmployees).then(() => {
7373
this.updateProgress("Processing completed")
7474
});
7575
}).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");
7878
db.transaction(this.populateDB).then(() =>{
79-
this.updateProgress("Database populated ... executing query ...")
79+
this.updateProgress("Database populated ... executing query ...");
8080
db.transaction(this.queryEmployees).then((result) => {
8181
console.log("Transaction is now finished");
8282
this.updateProgress("Processing completed");
8383
this.closeDatabase()});
8484
});
8585
});
86-
}
86+
};
8787

8888
populateDB = (tx) => {
89-
this.updateProgress("Executing DROP stmts")
89+
this.updateProgress("Executing DROP stmts");
9090

9191
tx.executeSql('DROP TABLE IF EXISTS Employees;');
9292
tx.executeSql('DROP TABLE IF EXISTS Offices;');
@@ -125,7 +125,7 @@ class SQLiteDemo extends Component {
125125
this.errorCB(error)
126126
});
127127

128-
this.updateProgress("Executing INSERT stmts")
128+
this.updateProgress("Executing INSERT stmts");
129129

130130

131131
tx.executeSql('INSERT INTO Departments (name) VALUES ("Client Services");');
@@ -148,12 +148,12 @@ class SQLiteDemo extends Component {
148148
tx.executeSql('INSERT INTO Employees (name, office, department) VALUES ("Dr DRE", 2, 2);');
149149
tx.executeSql('INSERT INTO Employees (name, office, department) VALUES ("Samantha Fox", 2, 1);');
150150
console.log("all config SQL done");
151-
}
151+
};
152152

153153
queryEmployees = (tx) => {
154154
console.log("Executing employee query");
155155
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");
157157
var len = results.rows.length;
158158
for (let i = 0; i < len; i++) {
159159
let row = results.rows.item(i);
@@ -162,14 +162,14 @@ class SQLiteDemo extends Component {
162162
}).catch((error) => {
163163
console.log(error);
164164
});
165-
}
165+
};
166166

167167
loadAndQueryDB = () => {
168168
this.updateProgress("Plugin integrity check ...");
169169
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) => {
173173
db = DB;
174174
this.updateProgress("Database OPEN");
175175
this.populateDatabase(DB);
@@ -179,12 +179,12 @@ class SQLiteDemo extends Component {
179179
}).catch(error => {
180180
this.updateProgress("echoTest failed - plugin not functional");
181181
});
182-
}
182+
};
183183

184184
closeDatabase = () => {
185185
if (db) {
186186
console.log("Closing database ...");
187-
this.updateProgress("Closing DB")
187+
this.updateProgress("Closing DB");
188188
db.close().then((status) => {
189189
this.updateProgress("Database CLOSED");
190190
}).catch((error) => {
@@ -193,31 +193,31 @@ class SQLiteDemo extends Component {
193193
} else {
194194
this.updateProgress("Database was not OPENED")
195195
}
196-
}
196+
};
197197

198198
deleteDatabase = () => {
199-
this.updateProgress("Deleting database")
199+
this.updateProgress("Deleting database");
200200
SQLite.deleteDatabase(database_name).then(() => {
201201
console.log("Database DELETED");
202202
this.updateProgress("Database DELETED")
203203
}).catch((error) => {
204204
this.errorCB(error);
205205
});
206-
}
206+
};
207207

208208
runDemo = () => {
209209
console.log('running');
210210
this.updateProgress("Starting SQLite Promise Demo",true);
211211
this.loadAndQueryDB();
212-
}
212+
};
213213

214214
renderProgressEntry = (entry) => {
215215
return (<View style={listStyles.li}>
216216
<View>
217217
<Text style={listStyles.liText}>{entry}</Text>
218218
</View>
219219
</View>)
220-
}
220+
};
221221

222222
render(){
223223
let ds = new ListView.DataSource({rowHasChanged: (row1, row2) => row1 !== row2 });
@@ -240,7 +240,7 @@ class SQLiteDemo extends Component {
240240
style={listStyles.liContainer}/>
241241
</View>);
242242
}
243-
};
243+
}
244244

245245
var listStyles = StyleSheet.create({
246246
li: {

0 commit comments

Comments
 (0)