GWT 客户端 HTML5 数据库存储(Web SQL 数据库)
我想知道 GWT 2.x 中是否有使用 数据库存储 的 API,或者我应该使用像这样的本机代码吗?
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!");
});
});
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!");
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gwt-mobile-webkit 项目提供了这些绑定,因此您无需自己编写它们。不要让这个名字欺骗了您,它也可以在桌面浏览器上运行。
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.
到目前为止,gwt-mobile-webkit 无法在最新的桌面浏览器上运行,因为它使用的 WebSQL API 不再受 Firefox 4+ 等最新浏览器的支持。
我编写了一个用于客户端存储的小型库。它可以与所有支持 localstorage-api 的浏览器(几乎所有 HTML5 浏览器,包括智能手机浏览器)配合使用,并允许您将数据存储在对象存储和数据库中。
你可以在这里查看:
https://code.google.com/p/gwt-localstorage-db/
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/