web-sql

Developing a HTML5 offline storage solution for iOS/Android in 2011

半城伤御伤魂 提交于 2019-12-31 07:53:24
问题 The problem: I need a device agnostic (e.g. HTML5) solution for storing and querying 250,000+ rows of data offline on a phone or tablet type device (e.g. iOS/Android). The idea being I have people working in remote areas without any cellular data connection and they need to run queries on this data and edit it while offline. Partly it will be geo-location based so if there are assets in the area they are in (uses GPS) then it will show those assets and let them be edited. When they return to

How to open an existing WebSQL database?

爱⌒轻易说出口 提交于 2019-12-31 02:49:17
问题 I'm building an HTML5/Phonegap mobile application and I want to use an existing SQLite database through WebSQL. By an "existing" database I mean I had already created the db.sqlite file outside of the app. I did this because there are several tables and it is pre-populated with some data. What I wanna do is copy this db file into my project and be able to open it with Javascript just like this: var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024); It seems like this

Where is data stored when using an HTML 5 Web SQL Database

妖精的绣舞 提交于 2019-12-28 05:29:38
问题 I just read something about HTML 5 Web SQL Databases. I did a little search on here and Google but couldn't find a simple to the point answer. Can someone tell me, where is the data stored when using this? In memory or a text file or something else? Also what browsers support this? 回答1: It's stored in a SQLite database. Here is a browser support chart I found: . That said, the W3C has officially dropped support for WebSQL in favor of IndexedDB. Here's the equivalent chart for that: You may

Jaydata indexedDb database creation issues

人走茶凉 提交于 2019-12-25 18:34:54
问题 I have this problem on jayData: I try to create this simple database: var x=$data.Entity.extend("Person", { ID: {type: "int", key:true, required: true}, Name: {type: "string", required: true} }); $data.EntityContext.extend("PersonDatabase", { People: {type: $data.EntitySet, elementType: Person} }); var DB1=new PersonDatabase({ provider: 'webSql', databaseName:'DB1', }); Which works perfectly. But when I simply switch the database type to indexxedDb, it doesn't do anything. var x=$data.Entity

Deleting an entry and releasing from unique key index

允我心安 提交于 2019-12-25 04:59:26
问题 For a project with offline storage, I created a database with a primary key for the id and also a unique field holding the date. When I delete an entry, I can not create a new one with the same date the deleted entry had. What can I do to get the date out of the index when I delete that entry? This is how I create Table: CREATE TABLE IF NOT EXISTS userdata (id INTEGER PRIMARY KEY ASC, entrydate DATE UNIQUE, strength, comments I wonder if I need to add something to tell the DB server to allow

page before database - phonegap

∥☆過路亽.° 提交于 2019-12-25 02:34:16
问题 I have a page that has to display information from a websql database. However the page loads with blanks, even though the information is in the database. I am guessing that the page gets populated before the database is open / active? Is there anything I can do so slow the page load or speed up the database load? 回答1: I was struggling with the same issue. Below is the sample db service function code. Reason this was happening because web-sql calls are asynchronous. For example, below

compare date in sql statement

久未见 提交于 2019-12-25 00:50:33
问题 I am making an alert tool using web sql. I want to selects all events that occur in a specific day. when I insert the event I insert the date as a date object with this format "2011-10-14" , What should I write in select statement to select all events that occur today ? I make like this cur =new Date(); alert(cur); db.transaction(function(tx){ tx.executeSql("select NOTE_DESC,NOTE_DATE,NOTE_TIME,ALERT_TIME,NOTES_MORE_DETAILS from NOTES where NOTE_DATE = "+cur+" order by NOTE_TIME asc limit 0,1

Web SQL insert data into multiple rows

拈花ヽ惹草 提交于 2019-12-24 04:09:31
问题 I've tried to insert variables into multiple rows at once in Web SQL database but with all known to me methods I'm getting errors: ("INSERT INTO tab (a,b) VALUES (?,?),(?,?)",[v1,v2,v3,v4]) >> could not prepare statement (1 near ",": syntax error) ("INSERT INTO tab (a,b) VALUES (?,?,?,?)",[v1,v2,v3,v4]) >> could not prepare statement (1 4 values for 2 columns) ("INSERT INTO tab (a,b) VALUES (?,?)",[v1,v2,v3,v4]) >> number of '?' does not match arguments count Which one is correct for Web SQL

Ionic 2 - Get token from Storage value and set Header before HTTP Request

扶醉桌前 提交于 2019-12-23 17:15:03
问题 I am using the ionic/storage package to store the api_token for users after they logged in so I can use the unique token to interact with an API. The problem I am facing is that I need to get the value via storage.get which returns a promise and results in the headers I want to set not being set in time. I need to return an instance of RequestOptions but can't figure out how to add the header I retrieve when it comes from a promise. Adding a header synchronous with localStorage is working

Make function call wait for web SQL query

三世轮回 提交于 2019-12-23 10:54:31
问题 Primecheck function is supposed to return true or false whether passed number is prime or not. If the number is prime, function adds it to PRIMES table. This is a Sieve of Eratosthenes algorithm, but it's not finished yet. function primecheck (number) { var isprime = true; if (number%10 == 1 || number%10 == 3 || number%10 == 7 || number%10 == 9) { db.transaction(function (tx) { tx.executeSql('SELECT * from Primes', [], function (tx, result) { for (var i = 1; i < result.rows.length; i++) { if