<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 第八節:IDBIndex 對象 `IDBIndex`對象代表數據庫的索引,通過這個對象可以獲取數據庫里面的記錄。數據記錄的主鍵默認就是帶有索引,`IDBIndex`對象主要用于通過除主鍵以外的其他鍵,建立索引獲取對象。 `IDBIndex`是持久性的鍵值對存儲。只要插入、更新或刪除數據記錄,引用的對象庫中的記錄,索引就會自動更新。 `IDBObjectStore.index()`方法可以獲取`IDBIndex`對象。 ~~~ var transaction = db.transaction(['contactsList'], 'readonly'); var objectStore = transaction.objectStore('contactsList'); var myIndex = objectStore.index('lName'); myIndex.openCursor().onsuccess = function (event) { var cursor = event.target.result; if (cursor) { var tableRow = document.createElement('tr'); tableRow.innerHTML = '<td>' + cursor.value.id + '</td>' + '<td>' + cursor.value.lName + '</td>' + '<td>' + cursor.value.fName + '</td>' + '<td>' + cursor.value.jTitle + '</td>' + '<td>' + cursor.value.company + '</td>' + '<td>' + cursor.value.eMail + '</td>' + '<td>' + cursor.value.phone + '</td>' + '<td>' + cursor.value.age + '</td>'; tableEntry.appendChild(tableRow); cursor.continue(); } else { console.log('Entries all displayed.'); } }; ~~~ `IDBIndex`對象有以下屬性。 * `IDBIndex.name`:字符串,索引的名稱。 * `IDBIndex.objectStore`:索引所在的對象倉庫。 * `IDBIndex.keyPath`:索引的主鍵。 * `IDBIndex.multiEntry`:布爾值,針對`keyPath`為數組的情況,如果設為`true`,創建數組時,每個數組成員都會有一個條目,否則每個數組都只有一個條目。 * `IDBIndex.unique`:布爾值,表示創建索引時是否允許相同的主鍵。 `IDBIndex`對象有以下方法,它們都是異步的,立即返回的都是一個 IDBRequest 對象。 * `IDBIndex.count()`:用來獲取記錄的數量。它可以接受主鍵或`IDBKeyRange`對象作為參數,這時只返回符合主鍵的記錄數量,否則返回所有記錄的數量。 * `IDBIndex.get(key)`:用來獲取符合指定主鍵的數據記錄。 * `IDBIndex.getKey(key)`:用來獲取指定的主鍵。 * `IDBIndex.getAll()`:用來獲取所有的數據記錄。它可以接受兩個參數,都是可選的,第一個參數用來指定主鍵,第二個參數用來指定返回記錄的數量。如果省略這兩個參數,則返回所有記錄。由于獲取成功時,瀏覽器必須生成所有對象,所以對性能有影響。如果數據集比較大,建議使用 IDBCursor 對象。 * `IDBIndex.getAllKeys()`:該方法與`IDBIndex.getAll()`方法相似,區別是獲取所有主鍵。 * `IDBIndex.openCursor()`:用來獲取一個 IDBCursor 對象,用來遍歷索引里面的所有條目。 * `IDBIndex.openKeyCursor()`:該方法與`IDBIndex.openCursor()`方法相似,區別是遍歷所有條目的主鍵。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看