indexedDB:为对象库

时间:2015-07-07 11:14:32

标签: internet-explorer-11 indexeddb

在onUpgradeNeeded块中,我为该商店创建了objectStore和43个索引。当Chrome和Firefox可以创建ObjectStore时,IE11会出现AbortError。

如果我减少了索引的数量(例如减少到30),它在IE11中工作正常。

知道可能导致这种情况的原因吗?

dbOpenRequest.onupgradeneeded = function(event)
{
    console.log("Upgrading");

    //Get the resulting DB from the Open Request
    indDB = dbOpenRequest.result;

    var versionNum = event.oldVersion;

    //First time the request is made.
    if (!(versionNum < 1)) 
    {
        console.log("Deleting Old Version");
        indDB.deleteObjectStore("storename");
    }

    console.log("Creating Object Store");

    // Create the object store to hold the information. The "Primary Key" is specified here.
    dbObjectStore = indDB.createObjectStore("storename", { keyPath : "storePrimaryKey" });

    // Visit Details
    dbObjectStore.createIndex("one", "one", { unique: false });
    dbObjectStore.createIndex("two", "two", { unique: false });
    dbObjectStore.createIndex("three", "three", { unique: false });
    dbObjectStore.createIndex("four", "four", { unique: false });
    dbObjectStore.createIndex("five", "five", { unique: false });
    dbObjectStore.createIndex("six", "six", { unique: false });
    dbObjectStore.createIndex("seven", "seven", { unique: false });
    dbObjectStore.createIndex("eight", "eight", { unique: false });
    dbObjectStore.createIndex("nine", "nine", { unique: false });
    dbObjectStore.createIndex("ten", "ten", { unique: false });
    dbObjectStore.createIndex("eleven", "eleven", { unique: false });
    dbObjectStore.createIndex("twelve", "twelve", { unique: false });
    dbObjectStore.createIndex("thirteen", "thirteen", { unique: false });
    dbObjectStore.createIndex("fourteen", "fourteen", { unique: false });
    dbObjectStore.createIndex("fifteen", "fifteen", { unique: false });
    dbObjectStore.createIndex("sixteen", "sixteen", { unique: false });
    dbObjectStore.createIndex("seventeen", "seventeen", { unique: false });
    dbObjectStore.createIndex("eighteen", "eighteen", { unique: false });
    dbObjectStore.createIndex("ninteen", "ninteen", { unique: false });
    dbObjectStore.createIndex("twenty", "twenty", { unique: false });
    dbObjectStore.createIndex("twentyone", "twentyone", { unique: false });
    dbObjectStore.createIndex("twentytwo", "twentytwo", { unique: false });
    dbObjectStore.createIndex("twentythree", "twentythree", { unique: false });
    dbObjectStore.createIndex("twentyfour", "twentyfour", { unique: false });
    dbObjectStore.createIndex("twentyfive", "twentyfive", { unique: false });
    dbObjectStore.createIndex("twentysix", "twentysix", { unique: false });
    dbObjectStore.createIndex("twentyseven", "twentyseven", { unique: false });
    dbObjectStore.createIndex("twentyeight", "twentyeight", { unique: false });
    dbObjectStore.createIndex("twentynine", "twentynine", { unique: false });
    dbObjectStore.createIndex("thirty", "thirty", { unique: false });
    dbObjectStore.createIndex("thirtyone", "thirtyone", { unique: false });
    dbObjectStore.createIndex("thirtytwo", "thirtytwo", { unique: false });
    dbObjectStore.createIndex("thirtythree", "thirtythree", { unique: false });
    dbObjectStore.createIndex("thirtyfour", "thirtyfour", { unique: false });
    dbObjectStore.createIndex("thirtyfive", "thirtyfive", { unique: false });
    dbObjectStore.createIndex("thirtysix", "thirtysix", { unique: false });
    dbObjectStore.createIndex("thirtyseven", "thirtyseven", { unique: false });
    dbObjectStore.createIndex("thirtyeight", "thirtyeight", { unique: false });
    dbObjectStore.createIndex("thirtynine", "thirtynine", { unique: false });
    dbObjectStore.createIndex("forty", "forty", { unique: false });
    dbObjectStore.createIndex("fortyone", "fortyone", { unique: false });
    dbObjectStore.createIndex("fortytwo", "fortytwo", { unique: false });
    dbObjectStore.createIndex("fortythree", "fortythree", { unique: false });
    console.log("Object Store Setup Complete");
};

1 个答案:

答案 0 :(得分:0)

IE中有a bug report这个索引限制,这不符合规范。

无论如何,你真的需要42索引,我感觉到一些不恰当的用例。