web-sql

why foreign key doesn't work in websql..?

断了今生、忘了曾经 提交于 2019-12-07 09:00:54
问题 i try to use foreign key in my app using web sql.. i test it in chrome.. no error.. but when i test with manual insert to table img (contain FK) i expect to fail.. but insert is still succes.. this is my code.. please help me.. tx.executeSql("PRAGMA foreign_keys = ON;"); tx.executeSql("CREATE TABLE IF NOT EXISTS img (ID INTEGER PRIMARY KEY ASC,imgID VARCHAR, image VARCHAR, FOREIGN KEY (imgID) REFERENCES trans (ID) )", []); i this case i try to use FK method for save my image name data and

WKWebView gives SecurityError when bundling html and javascript with app

独自空忆成欢 提交于 2019-12-06 15:02:30
We are trying to migrate a hybrid app from UIWebView (iOS < 8) to WKWebView (iOS 8), but we are getting SecurityErrors when trying to store stuff using the DOM WebDatabase API (i.e. 'web sql databases'). The following throws an error if the index.html has been loaded from a bundled file with the app // throws SecurityError: DOM Exception 18 var db = openDatabase('mydb', '1.0', 'key value store', 1); The same code works fine with UIWebView. I can fallback to using Local Storage for some reason, but using WebSQL databases is a no go. I can only speculate that this has something to do with the

Could not find SDK “SQLite.WinRT” - Add Reference shows “Missing value for TargetPlatformWinMDLocation property”

≡放荡痞女 提交于 2019-12-06 14:14:51
I'm trying to create a Multi-device hybrid app that uses Typescript, WinJS, and a persistent local database. I've got it working to the point of rendering WinJS controls. However, when I attempt to add WebSQL functionality according to the instructions for adding a Cordova plugin (go to config.xml file--> under plugins tab, check WebSQL Polyfill), it will no longer compile. The compiler error is C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1886,5): error MSB3774: Could not find SDK "SQLite.WinRT, Version=3.8.2". [C:\Users\Lee\Documents\JSApps

SQL Insert Statement not Working in Javascript

廉价感情. 提交于 2019-12-06 13:20:40
问题 I'm trying to get my WebSQL database to popluate using a JSON array (Object is called myJSONObject , array is called costcodes ). The function runs on click, the database successfully creates, but the data is not inserted into the database. It doesn't even throw and error, it just doesn't do anything. My initial thought was that the data isn't escaped properly, but I don't know exactly where/how to escape it. So I'm stumped. localDB = null; function initDB() { if (localDB==null) { var

web sql database foreign key support

允我心安 提交于 2019-12-06 10:31:32
问题 I'm testing this statement in Safari 5.0.5, but I get an error before FOREIGN: CREATE TABLE IF NOT EXISTS Idea ( id INTEGER PRIMARY KEY, title TEXT NOT NULL, content TEXT NOT NULL, created TIMESTAMP NOT NULL, sketchID INTEGER, categoryID INTEGER NOT NULL, FOREIGN KEY (sketchID) REFERENCES (Sketch), FOREIGN KEY (categoryID) REFERENCES (Category)); I get the following error message: SQLStatementError 1 [DATABASE] near "(": syntax error Where is the error in this SQL statement? 回答1: (Adding my

Return a COUNT from a WebSQL query in a javaScript function

ⅰ亾dé卋堺 提交于 2019-12-06 05:03:21
I want to return the number of rows in a particular table in a database in WebSQL inside a javascript function. Below is my code. function getCustomerCount(){ var count = 0; db.transaction(function(tx) { tx.executeSql('SELECT * FROM contacts', [], function(tx, results) { count = results.rows.length; }); }); return count; } I am new to WebSQL and rather unfamiliar with javascript also. Any suggestions? Another way is to use promises, here is an example with the Jquery deferred object function getCustomerCount() { //setup the deferred object var defer = $.Deferred(); var count = 0; db

IndexedDB very slow compared to WebSQL, what am i doing wrong?

吃可爱长大的小学妹 提交于 2019-12-06 04:53:02
问题 I made a demo chrome extension to compare websql and indexeddb and to learn how both worked in more detail. To my surprise it showed that indexeddb is a lot slower even compared to the most naive sql command. Since websql have been deprecated in favor of indexeddb i assumed indexeddb would be as fast or faster than websql. I'm assuming i'm doing something wrong in the indexeddb code. Because deprecating something that is much faster would be stupid and i assume they knew what they were doing

why foreign key doesn't work in websql..?

梦想与她 提交于 2019-12-05 17:20:15
i try to use foreign key in my app using web sql.. i test it in chrome.. no error.. but when i test with manual insert to table img (contain FK) i expect to fail.. but insert is still succes.. this is my code.. please help me.. tx.executeSql("PRAGMA foreign_keys = ON;"); tx.executeSql("CREATE TABLE IF NOT EXISTS img (ID INTEGER PRIMARY KEY ASC,imgID VARCHAR, image VARCHAR, FOREIGN KEY (imgID) REFERENCES trans (ID) )", []); i this case i try to use FK method for save my image name data and connect to trans table.. my insert code tx.executeSql("insert into img (imgID,image) values ('100','23.jpg

Phonegap: WebSql or SqLite?

坚强是说给别人听的谎言 提交于 2019-12-05 16:24:53
问题 I have been working with phonegap for little time, and i'm having some trouble with the concept of storage in it. So, the documentation states that there is this database that you can open, and it is a SQLite implementation."window.openDatabase returns a new Database object. This method will create a new SQL Lite Database and return a Database object. Use the Database Object to manipulate the data." http://docs.phonegap.com/en/2.2.0/cordova_storage_storage.md.html#Database I'm using it at my

Pass extra parameters to WebSQL callback function?

心不动则不痛 提交于 2019-12-05 08:32:49
I am calling a function db.transaction with following code: db.transaction(createSheetDB, function(){alert("Sheet creation error!")}, function(){alert("Sheet created!")}); The function createSheetDB is a callback function which is implicitly called by db.transaction() which also passes it a parameter tx. I have implemented function createSheetDB(tx) like this: function createSheetDB(tx) { var nextId = getNextId(); tx.executeSql("INSERT INTO SHEET(id, name, desc) VALUES("+nextId+",'"+sheetName+"','"+desc+"')", [], function(){alert("Sheet row inserted!")}, function(tx, err){alert("Sheet row