Javascript 实现mysql的最快方法是什么;截断表名“;对于IndexedDB?

Javascript 实现mysql的最快方法是什么;截断表名“;对于IndexedDB?,javascript,html,indexeddb,Javascript,Html,Indexeddb,我正在试图找到最快的方法来清除对象存储区(表)中索引数据库中的数据 假设存储了5000多条记录 我只想到了.deleteObjectStore,但它会产生以下错误: InvalidStateError: A mutation operation was attempted on a database that did not allow mutations. 似乎您只能在versionchange事务中创建或删除对象存储 连接数据库时,对于IndexedDB,实现与mysql-truncate

我正在试图找到最快的方法来清除
对象存储区
(表)中
索引数据库中的数据

假设存储了5000多条记录

我只想到了
.deleteObjectStore
,但它会产生以下
错误

InvalidStateError: A mutation operation was attempted on a database that did not allow mutations.
似乎您只能在
versionchange事务中
创建
删除
对象存储


连接
数据库
时,对于
IndexedDB
,实现与
mysql
-
truncate tablename
等效的
最快的方法是什么?

您考虑过吗?

相同的问题。deleteObjectStore
给出了
变异错误。类似于
.clear
.deleteObjectStore
只能在
versionchange事务期间运行。除非我做错了什么。这是我试过的<代码>var store=db.obj.transaction(['cow']).objectStore('cow');store.clear()
k,刚刚在FireFox中测试了这个,并给了我一个错误:
TypeError:store.clear不是一个函数
这是我使用的代码:
var store=db.obj.transaction(['cow','readwrite');store.clear()
我必须添加
store.objectStore('cow').clear()
我真傻,竟然没有想到这一点