Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Andy_W_
Beginner
331 Views

SQLitePlugin.js:452 - Uncaught TypeError: Cannot read property 'type' of undefined"

Hi,

I'm getting grief from the cordova-sqlite-storage plugin within the XDK simulator.  Whenever I try to execute a transaction, I get the following error in the console:

"Uncaught TypeError:  Cannot read property 'type' of undefined"  SQLitePlugin.js:452

Here is my code:

function onDeviceReady() {
    document.addEventListener('deviceready', createSQLDB, false);
}

function createSQLDB() {
    var db = null;
    db = window.sqlitePlugin.openDatabase({name: 'database.db', location: 'default'});
    setTimeout(function() {
		db.transaction(function(transaction) {
			transaction.executeSql('CREATE TABLE IF NOT EXISTS settings (id integer primary key, option1 text, option2 text)', [],
			function(tx, result) {
				alert("Table created successfully");
			},
			function(error) {
				alert("Error occurred while creating the table.");
			});
		});

		
    }, 1000);
}

 

Is there something obvious I've missed or is this the simulator failing to support the plugin, please?  Any help would be greatly appreciated!

Cheers

Andy

Tags (2)
0 Kudos
1 Reply
PaulF_IntelCorp
Employee
331 Views

The simulate tab does not simulate that plugin. See these two doc pages:

Especially the second-half of the second doc...

Reply