indexeddb的任何包装器都允许多个条件?

时间:2014-04-05 20:43:33

标签: indexeddb ydn-db

此代码中的所有内容都可以正常工作;除了最后的sqlcalls。

完整代码:

<!doctype html>
<html><head>
    <meta charset="UTF-8">
<script type = "text/javascript" src="jquery-1.11.0.js"></script>
<script type = "text/javascript" src="ydn.db-iswu-sql-e-dev.js"></script>
</head><body><script type = "text/javascript">
//ydn.db.deleteDatabase('BibleWay');
var context_bible_schema = {
  name: 'context',
  keyPath: 'vsid',
  autoIncrement: true,
  indexes: [
    {
      name: 'bid',
      keyPath: 'bid',
      unique: false,
      multiEntry: false
    }, {
      name: 'bk',
      keyPath: 'bk',
      unique: false,
      multiEntry: false
    } , {
      name: 'c',
      keyPath: 'c',
      unique: false,
      multiEntry: false
    } , {
      name: 'v',
      keyPath: 'v',
      unique: false,
      multiEntry: false
    }
  ]
};
schema = {
  stores: [context_bible_schema]
};
var db = new ydn.db.Storage('BibleWay',schema);
function downloadBible() {
    var i2=0;
    $.getJSON("http://bibleway.us/api/js/3.json", function(data){
        $.each(data, function( index, value ) {
            // bible id [bid]
            var split_bid=index;
            $.each(value, function( index, value ) {
                // bible book name
                console.log(index);
                var split_bk=index;
                  $.each(value, function( index, value ) {
                    // bible book chapter
                    var split_c=index;
                    $.each(value, function( index, value ) {

                        $doadd=new Object();
                        $doadd.bid=split_bid;
                        $doadd.bk=split_bk;
                        $doadd.c=split_c;
                        $doadd.v=index;
                        $doadd.t=value;
                        db.put('context',$doadd);
                        ++i2;
                    })

                  })
            })
        });
        showshv();
        }
    );
}
function showshv() {
    db.getSchema(function(schema) {
      console.log(schema);
    });
    req = db.get('context', 2050);
    req.done(function(record) {
      console.log(record);
    });
    req.fail(function(e) {
      throw e;
    });
    db.from('context').select('bk').unique(true).list().done(function(hobby) {
        console.log(hobby);
    });
}


db.from('context').select('bk').unique(true).list().done(function(hobby) {
  if (hobby[0] === undefined) {
    downloadBible();
  }else{
    showshv();
  }
});
document.write('hey<br>');
db.executeSql('SELECT * FROM context WHERE bid=\'3\' and bk = \'GEN\' AND c=\'50\'').then(function(results) {

  document.write(results);

}, function(e) {
  throw e;
});

db.executeSql('SELECT MAX(c) FROM context').then(function(results) {
  console.log(results);
}, function(e) {
  throw e;
});
</script></body></html>

我得到的错误是最后两个&#34; db.executeSql&#34;在底部。

  

未捕获ydn.error.NotSupportedException:条件太多。对于&#34;其中&#34;子句。

这是什么用途。是否有任何indexeddb的包装器允许多个条件?

谢谢

1 个答案:

答案 0 :(得分:0)

executeSql不支持,但我可以手动加入描述here