U3d web h5 db 内容查询

 

 1 function TestDB() {
 2 var request = window.indexedDB.open("/idbfs");
 3 request.onsuccess = function (event) {
 4 var db = request.result;
 5 console.log(‘数据库打开成功‘);
 6 
 7 var objectStore = db.transaction(‘FILE_DATA‘).objectStore(‘FILE_DATA‘);
 8 objectStore.openCursor().onsuccess = function (event) {
 9 var cursor = event.target.result;
10 if (cursor) {
11 console.log(‘key: ‘ + cursor.key);
12 console.log(‘mode: ‘ + cursor.value.mode);
13 if(cursor.value.contents){
14 console.log(‘contents: ‘ + Uint8ArrayToString(cursor.value.contents));
15 }
16 cursor.continue();
17 } else {
18 console.log(‘没有更多数据了!‘);
19 }
20 };
21 };
22 }
23 
24 function Uint8ArrayToString(fileData){
25 var dataString = "";
26 for (var i = 0; i < fileData.length; i++) {
27 dataString += String.fromCharCode(fileData[i]);
28 }
29 return dataString
30 }

 

U3d web h5 db 内容查询

上一篇:java线程总结(3/5)


下一篇:sqlite中插入单引号