GWT client-side HTML5 database storage (Web SQL Database)
Asked Answered
P

2

6

I wonder if there is an API for using Database Storage in GWT 2.x or I should use native code like this instead?

var database = openDatabase("Database Name", "Database Version"); 
database.executeSql("SELECT * FROM test", function(result1) { 
    // do something with the results 
    database.executeSql("DROP TABLE test", function(result2) { 
        // do some more stuff 
        alert("My second database query finished executing!"); 
    }); 
});  
Pyszka answered 13/2, 2011 at 8:58 Comment(0)
P
7

The gwt-mobile-webkit project provides these bindings so you don't have to write them yourself. Don't let the name fool you, it'll work on a desktop browser too.

Pironi answered 13/2, 2011 at 10:13 Comment(0)
B
4

gwt-mobile-webkit as of now, will not run on the latest desktop browsers, since it uses the WebSQL API that is no longer supported by the latest browsers like Firefox 4+.

I have written a small library for doing client side storage. It can work with all browsers that support localstorage-api (practically all HTML5 browsers including the smart phone browsers) and allows you to store data in object stores and databases.

You can check it out here: https://code.google.com/p/gwt-localstorage-db/

Buddy answered 30/1, 2012 at 10:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.