Page 1 of 1

Transfer JSON from ACL column of database into SQLite

Posted: Fri Apr 04, 2014 3:39 pm
by Mark Bowen6778362

Hi

I am trying to transfer the contents of the acl column from my database into a SQLite database to use for local storage

I have used the tutorial and it is working for every column except the acl one. I have defined the entry in my SQLite database as TEXT - and when they didn't work tried as BLOB

When I examine the console it just returns (undefined) - the ACL does contain text

This is the code (from the tutorial)

var db = window.openDatabase("practices", "", "practices", 1024*1000);

db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS "Tables" (objectId TEXT, practice TEXT, address1 TEXT, address2 TEXT, city TEXT, postcode TEXT, country TEXT, telephone TEXT, pemail TEXT, website TEXT, consent TEXT, icon TEXT, permissions BLOB)', []);
tx.executeSql('SELECT * FROM "Tables" WHERE "objectId" = "' + value.id + '"', [], function(tx, results){
if (results.rows.length === 0){
tx.executeSql('INSERT INTO "Tables" (objectId, practice, address1, address2, city, postcode, country, telephone, pemail, website, consent, icon, permissions) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)', [value._id, value.Practice, value.Address1, value.Address2, value.City, value.Postcode, value.Country, value.pTelephone, value.pemail, value.website, value.consent, value.Logo, value.permissions]);
}
});
});

return;


Transfer JSON from ACL column of database into SQLite

Posted: Fri Apr 04, 2014 6:26 pm
by Maryna Brodina

Hello!

Where in your code you call to acl field?


Transfer JSON from ACL column of database into SQLite

Posted: Fri Apr 04, 2014 8:15 pm
by Mark Bowen6778362

Oh yes! Thank you.... its been a long week.