javascript - How to create 2 websql TABLES when the page opens -
I have no problem in creating 1 table, but how can I create 2 in a WebSQL database when the page opens ?
// Create a tab curutio.webdb.createTable = function () {var db = curatio.webdb.db; Var db2 = curatio.webdb.db; Db.transaction (function (tx) {tx.executeSql ("do not login if AE does not enter AE (ID primary primary ASC, TODO TEXT, added dite, reminder text, name text, email text, blood group lesson, dub Text, icoe text, work text, mobile text, address text, allergic lesson, relevant text, medication text) ", []); db2.transaction (function (tx) {tx.executeSQL (" Create table if personalization is not ( ID integer primary key ASC, name text, added, DATETIME, note text, note text, gender text, emergency Lean contact text, emergency contact number text, ppsn text, mcn text, mse text, text here, hin text, text here, allergy text, relevant text, medication text, mobile, TEXT) ", []);});}
Your code is not telling what happens in Curatiio.webdb.db But if you want to create 2 tables in the same DB, then it should be used like this:
var dbVersion = "1.0" dbHandle = openDatabase ('yourDB', dbVersion , 'Test db', 5 * 1024 * 1024); DbHandle.transaction (function (TX) {tx.executeSql () 'table does not create TBL1 (id text unique primary key, DESC text) present,'}); DbHandle.transaction (function (TX) {tx.executeSql ('TBL2 (key primary unique key text, data text) if table creation does not exist')});
i.e. You open the database once and reuse the same handle for each transaction.
Comments
Post a Comment