sqlite - SQLitePlugin with cordova and ANDROID -
i need use 2 sqlite database app 2 databases have structure because 1 of storicdb
in procedure need use both db.
i code:
var ondeviceready = function () { testwith2db(); }; document.addeventlistener("deviceready", ondeviceready, true); function testwith2db (){ var dbcurrent_path = "/sdcard/android/data/mydatabase/dbcurrent" var dbstoric_poath = "/sdcard/android/data/mydatabase/dbstoric" // work fine var db_current = window.sqliteplugin.opendatabase(dbcurrent_path , "1.0", "dbcurrent", 10000000); db_current.transaction(doquerycurrent, on_tran_error, on_tran_success); //this work fine var db_storic = window.sqliteplugin.opendatabase(dbstoric_poath , "1.0", "dbstoric", 10000000); db_storic.transaction(doquerystoric, on_tran_error, on_tran_success); /* following lines problem because if do:... query on currentdb, query alwais executed on last db opened me impossible use currentdb again */ var db_current = window.sqliteplugin.opendatabase(dbcurrent_path , "1.0", "dbcurrent", 10000000); db_current.transaction(doquerycurrent, on_tran_error, on_tran_success); } function doquerycurrent(txc){ // strange behaviour // query executed on storic db if have opened txc.executesql("select * table1", [],[]); } function doquerystoric(txs){ txs.executesql("select * table1", [],[]); }
i have tried attach db form query unsupported android ????
tx.executesql("attach database '/mnt/sdcard/android/data/mydatabase/dbstoric' s",[], on_query_success) // line return error
please me thanks
Comments
Post a Comment