web sql - WebSQL in ClojureScript?

I'm having some trouble formatting a ClojureScript wrapper for websql. The main problem is that JavaScript uses tx and err arguments for websql that work without being defined. When the ClojureScript version runs, the code throws an error because tx was undefined. Here is some sample code to follow along with a websql tutorial from PhoneGap I was trying:(defn populateDB [tx] (.executeSql tx ("CREATE TABLE IF NOT EXISTS foo (id unique, text)")) (.log js/console "table added"))(defn errorCB [err] (.log js/console (str "There was an error" (...Read more

web sql - How do I execute multiple statements in Web SQL?

Is there a way to execute multiple statements in a single transaction? I want to do something like:db.transaction(function (tx) { tx.executeSql( "CREATE TABLE Foo(ID INTEGER); CREATE TABLE Bar(ID INTEGER)", function (tx, result) { alert("success!"); }); });But instead, I'm finding I have to do something like this instead:db.transaction(function (tx) { tx.executeSql("CREATE TABLE Foo(ID INTEGER)"); tx.executeSql("CREATE TABLE Bar(ID INTEGER)", function (tx, result) { alert("success!"...Read more

web sql - JayData- Retrieval of Complex Data From Database

Saving the records in jaydata- web sql database is successful. How do we retrieve the record(Todo) from the database including Location.$data.Entity.extend("Location", { City: { type: String }, Country: { type: String }});$data.Entity.extend("Todo", { Id: { type: "int", key: true, computed: true }, Task: { type: String, required: true, maxLength: 200 }, DueDate: { type: Date }, Completed: { type: Boolean }, Location: { type: Location }});$data.EntityContext.extend("TodoDatabase", { Todos: { type: $data.EntitySet, element...Read more

web sql - JayData orderBy function produce strange result

I have table in websql to get data from that i am using JayData and write this _context.FoodLog.include("FoodItem").orderByDescending("it.TotalCalories").toArray().then(function(foodLogs){ $scope.$apply(function () { try { for(var i=0; i<foodLogs.length; i++) { console.log(foodLogs[i].TotalCalories); } } catch(error) { console.log("Inner Try "+error); } })});in console the result is738.0031.56 ...Read more

web sql - View the last query that execute in jaydata,websql

I am using the JayData and WebSql for my mobile application. And query data like below_context.FoodLog.filter('it.DateTime == '+dateObj+'').toArray().then(function(foodLogs).....I want to know is there anyway or method through which i get the last executed queryScenario (In Code Igniter (PHP Framwork) ig we make query using active record class than we can get last executed query by using this $this->db->last_query(); so how can i get in JayData)...Read more

web sql - How to stop the HTML 5 database from being deleted in iOS 5.1

This is basically the same question as this one, except that I'm not using PhoneGap (so I don't think any of the solutions offered there are applicable).I have a pure HTML/JS webapp that works offline (using WebSQL for storage, and AppCache for disconnected use).The app has an 'export' option which serializes the data as JSON and uploads it to an AWS S3 bucket for backup; and a corresponding 'import' option for restoring. However as this is a full dump/restore of the entire db, the process is not all that fast so typically I backup on a weekly...Read more

web sql - How to save data to websql in a single transaction using YDN-DB

I have an app where I can manually choose to go offline. When a user does that I fire an ajax requests to get data and save it in websql db. My retrieved data consists of a collection of models, which I want to write separately in a single transaction. (each model has its own id, which I want to use as a keypath for easier queries afterwards)The closest method that I can use is add(store_name, values) but I don't know exactly how to use it. There is no example, and I can't figure it out. I am also not sure that this method is exactly what I nee...Read more

web sql - how to provide security to the database in websql

my question is how to provide the security to the database in the websql, so that no other person can open the database or modify the database. for example:var db = openDatabase("AddressBook", "1.0", "Address Book", 200000); creates the database by name AddressBook. so how do i provide the security to the database "AddressBook" so that no other person can open or modify the database "AddressBook".thank you...Read more

web sql - WebSQL and jQuery - DB vanishes on refresh

I have a very simple app (the beginnings of a larger app) which does one thing at this point. All it does is create a new database and table and inserts a single row of data. The problem is, when I hit "refresh" on the browser, the data and table is gone. I'm using Chrome and the developer inspection tools to see the data in the WebSQL tables. Anyone had this before? What am I doing wrong? I thought the point of HTML5 was persistant data so even on refresh the DB should stick around. Am I wrong on that?Here's my simple code:index.html <div ...Read more

web sql - WebSQL Select with AND + OR

Is it possible to query a websql database using both AND and OR in the same statement?This will not work:tx.executeSql('SELECT * FROM people WHERE name="'+name1+'" OR name="'+name2+'" AND category=1', [], function (tx, results) {Both these do:tx.executeSql('SELECT * FROM people WHERE name="'+name1+'" OR name="'+name2+'", [], function (tx, results) {tx.executeSql('SELECT * FROM people WHERE name="'+name1+'" AND category=1', [], function (tx, results) {Is it not possible to achieve this or is my syntax / query incorrect?...Read more

web sql - COUNT(*) in Web SQL is not working

I am using following code to get the count of records in emp table, code is as follows :var myDb = initDB(); myDb.transaction(function(trans) { var query = "SELECT COUNT(*) AS c from emp"; trans.executeSql(query, [], function(trans, res) { var count = res.rows[0].c; console.log("--- After Count ---"+count); }, errorHandler); });The query is giving error : Uncaught TypeError: Cannot read property 'c' of undefined. How to solve this issue?Appreciate any help....Read more

web sql - Format date in websql

I am using websql, but problem is, not finding any date functions in websql. I have date stored in the format Mon Apr 09 2012 15:23:54 GMT+530(India Standard Time), and I want the query result in the format 04/09/2012. Can any body help please?...Read more