Software Archive
Read-only legacy content
17061 Discussions

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

Andy_W_
Beginner
943 Views

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

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
943 Views

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

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

0 Kudos
Reply