如何以编程方式在WebSQL中删除数据库? [英] How to delete a database in WebSQL programmatically?
问题描述
我是 Web SQL数据库新手,我用它将数据保存在网页的本地数据库中。
我可以通过
<$ c 创建 a 数据库 $ c> var db = openDatabase('database','1.0','my database',2 * 1024 * 1024); $ b
我可以 创建 一个 表 b
$ b < pre $ db.transaction(函数(tx){
tx.executeSql('CREATE TABLE IF NOT EXISTS mytable(blah,blah)');
});
我可以 删除 由
db.transaction(function(tx){
tx.executeSql('DROP TABLE mytable');
});
但是有没有办法删除 数据库
/www.w3.org/TR/webdatabase/\">规格说:
4.1数据库
每个来源都有一组关联的数据库。每个数据库都有一个名称和一个当前版本。 无法枚举或删除可用于此API的原始数据库。
I am new to Web SQL database and I use it to save data in a local database in a web page.
I can create a database by
var db = openDatabase('database', '1.0', 'my database', 2 * 1024 * 1024);
and I can create a table by doing this
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS mytable (blah,blah)');
});
I can delete the table by
db.transaction(function (tx) {
tx.executeSql('DROP TABLE mytable');
});
but is there a way to delete the database
programmatically?
Spec says:
4.1 Databases
Each origin has an associated set of databases. Each database has a name and a current version. There is no way to enumerate or delete the databases available for an origin from this API.
这篇关于如何以编程方式在WebSQL中删除数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!