オブジェクトスキーマ(テーブル)の一覧を取得 |
オブジェクトスキーマ(テーブル)の一覧 |
async function tableList(dbName)
{
return new Promise((resolve, reject) =>
{
const request = indexedDB.open(dbName);
request.onsuccess = function(event)
{
const db = event.target.result;
const objectStoreNames = Array.from(db.objectStoreNames);
db.close();
resolve(objectStoreNames);
};
request.onerror = function(event)
{
reject(event.target.error);
};
});
}
function tableListArray(dbName)
{
tableList(dbName)
.then((tables) =>
{
printArray(tables)
})
.catch((error) =>
{
console.error("error:", error);
return null;
});
}
function printArray(ary)
{
let count = ary.length;
if(count === null)
{
console.log("ary is null");
return;
}
for(i=0; i < count; i++)
{
console.log("i:" + i + " ary:" + ary[i]);
}
}
| ホームページおよプリ等に掲載されている情報等については、いかなる保障もいたしません。 ホームページおよびアプリ等を通じて入手したいかなる情報も複製、販売、出版または使用させたり、 または公開したりすることはできません。 当方は、ホームペーよびアプリ利用したいかなる理由によっての障害等が発生しても、 その結果ホームページおよびアプリ等を利用された本人または他の第三者が被った損害について 一切の責任を負わないものとします。 |