Phonegap SQLite错误5

时间:2013-03-22 17:19:36

标签: javascript sqlite cordova

我正在为应用程序使用phonegap,我需要使用SQLite数据库。我的问题是,在加载时,我得到一个SQL错误,这是有问题的代码:

//Open DB
    function findLocalNotes() {
        var db = window.openDatabase("rev_aLocalNotes", "1.0", "Revision App Local Notes", 200000);
        db.transaction(functionDB, errorCB, successCB);
    }

    //Create if needed DB
    function functionDB(db) {
        db.executeSql("CREATE TABLE IF NOT EXISTS local_notes (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, group TEXT, note TEXT, lastupdated DATE, created DATE)");
    }

    //If error, say
    function errorCB(e) {
        alert("SQL ERROR " + e.code);   
    }

    //If DB exist/created Open it.
    function successCB() {
        var db = window.openDatabase("rev_aLocalNotes", "1.0", "Revision App Local Notes", 200000);
        db.transaction(queryDB, errorCB);
    } 

    //Run query
    function queryDB(db) {
        db.executeSql('SELECT * FROM local_notes', [], querySuccess, errorCB);
    }

    //Run with returned query rows
    function querySuccess(db, results) {
        var len = results.rows.length;
        if(len != 0) {
            for (var i=0; i<len; i++){
                alert(results.rows.item(i).title)
            }
        }
        else {
            main_content.append("<div href='write_note.html' id='no_notes'><p>It looks like you have no notes! Tap here to add one!</p><img src='img/note_add.png'/></div>");
            $('#no_notes').click(function() { $.mobile.changePage( 'write_note.html', {transition: "none"}, true, true); });
        }
        return false;
    }

任何想法是什么引发了错误?在此先感谢:)

编辑:抱歉忘了添加它!错误代码5

0 个答案:

没有答案