· 9 years ago · Jan 09, 2017, 02:04 AM
1constructor is called
2main.js:1 Native: tried accessing the SQLite plugin but it's not installed.
3x @ main.js:1
4main.js:1 Install the SQLite plugin: 'ionic plugin add cordova-sqlite-storage'
5x @ main.js:1
6cordova.js:1223 deviceready has not fired after 5 seconds.
7cordova.js:1216 Channel not fired: onFileSystemPathsReady
8main.js:4 Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
9(anonymous) @ main.js:4
10main.js:4 DEVICE READY FIRED AFTER 2684 ms
11error getting scheduled matches TypeError: Cannot read property 'executeSql' of undefined
12at _ (main.js:1)
13at main.js:1
14at main.js:1
15at new t (polyfills.js:3)
16at e (main.js:1)
17at s (main.js:1)
18at t.<anonymous> (main.js:1)
19at t.value [as executeSql] (main.js:1)
20at t.getScheduledMatches (main.js:9)
21at t.getMatchInfo (main.js:23)
22
23if(!this.isOpen){
24 this.db = new SQLite();
25 this.db.openDatabase({name: "aces.db", location: "default"}).then(() => {
26 console.log("open Database"); // not called
27
28 this.db.executeSql('PRAGMA user_version = 0', []).then(()=>console.log("yesss")) // not called
29 this.db.executeSql('PRAGMA user_version', []).then(data => {
30 if(data.rows.item(0).user_version !== current_version){
31 console.log("versions do not match");
32 }
33 })
34
35 this.db.executeSql('PRAGMA foreign_keys = ON', []).then(()=>{
36 let query_matches = 'CREATE TABLE IF NOT EXISTS matches '+
37 '(id INTEGER PRIMARY KEY AUTOINCREMENT,'+
38 ...';
39 let query_comments = 'CREATE TABLE IF NOT EXISTS comments '+
40 '(id INTEGER PRIMARY KEY AUTOINCREMENT, '+
41 ...';
42 let query_points = 'CREATE TABLE IF NOT EXISTS undo'+
43 '(point_id INTEGER PRIMARY KEY AUTOINCREMENT,'+
44 ...';
45 let query_organizations = 'CREATE TABLE IF NOT EXISTS organizations '...
46 let query_users = 'CREATE TABLE IF NOT EXISTS users '+
47 '(id INTEGER PRIMARY KEY AUTOINCREMENT,'+
48 ...';
49 Promise.all([
50 this.db.executeSql(query_matches, {}).then(() => {
51 console.log("table created");
52 }, (err) => console.error('Unable to execute sql for matches: ', err)),
53 this.db.executeSql(query_comments, {}).then(() => {
54 console.log("comment table created");
55 }, (err) => console.error('Unable to execute sql for create comment table: ', err)),
56 this.db.executeSql(query_organizations, {}).then(() => {
57 console.log("table organizations created");
58 }, (err) => console.error('Unable to execute sql: ', err)),
59 this.db.executeSql(query_points, {}).then(() => {
60 console.log("undo table created");
61 }, (err) => console.error('Unable to execute sql for undo table: ', err)),
62 this.db.executeSql(query_users, {}).then(() => {
63 console.log("table users created");
64 }, (err) => console.error('Unable to execute sql: ', err))
65 ]).then(()=> {
66 console.log("called promise all");
67 this.isOpen = true
68 })
69 })
70 }, (error) => console.log("ERROR couldn't open database from sqlite service: ", error));
71 }
72
73}