sqlite - phonegap database error code 5 - non an error -


i using phonegap access phone database. create process calls everytime error routine error code: 5 , message: non error?

isn't possible execute multiple sql statements in 1 transaction?

sqlite expert couldnt find syntax error...

createdb: function(error, success) {         if(typeof error != 'function') error = this.errordb;         if(typeof success != 'function') success = this.successdb;         sql = "drop table if exists `boiler`; "             +"create table if not exists `boiler` ( "             +" `id` int not null, `object` int not null, `number` varchar(100) not null, "             +" `volume` double default null, `brand` varchar(100) default null, `year` year(4) default null, "             +" `price_before` float not null default '0', `price_after` float not null default '0',  `description` text default null, "             +" `img1` varchar(200) default null, `img2` varchar(200) default null, `img3` varchar(200) default null, "             +" `img4` varchar(200) default null, `img5` varchar(200) default null,  `img6` varchar(200) default null, "             +" `img7` varchar(200) default null, `img8` varchar(200) default null, `img9` varchar(200) default null, "             +"primary key (`id`)); "              +"drop table if exists `counter`; "             +"create table if not exists `counter` ( "             +" `number` varchar(100) not null, `object` int not null, `type` tinyint not null default '0', "             +" `value` double default null, `access` varchar(100) default null, "             +"primary key (`number`)); "              +"drop table if exists `link`; "             +"create table if not exists `link` ( "             +" `id` int not null, `boiler` int not null, `name` varchar(100) default null, "             +" `units` tinyint default null, `price` float not null default '0', "             +"primary key (`id`)); "              +"drop table if exists `manager`; "             +"create table if not exists `manager` ( "             +" `id` int not null, `company` varchar(100) default null, `name` varchar(100) not null, "             +" `phone` varchar(15) default null, "             +"primary key (`id`)); "              +"drop table if exists `object`; "             +"create table if not exists `object` ( "             +" `id` int not null,  `state` tinyint not null default '0', `user` varchar(50) default null, "             +" `date` char(15) default null,  `street` varchar(100) default null, `number` varchar(16) default null, "             +" `zip` char(5) default null, `city` varchar(100) default null, `manager` int not null default '0', "             +" `units` int not null default '0', "             +"primary key (`id`));";         console.log(sql);         this.db.transaction(function (tx) { tx.executesql(sql); }, error, success);     }, 

don't know error code: 5 can execute multiple sql statements

         // wait phonegap load              document.addeventlistener("deviceready", ondeviceready, false);              // phonegap ready              function ondeviceready() {                 var db = window.opendatabase("database", "1.0", "phonegap demo", 200000);                 db.transaction(populatedb, errorcb, successcb);             }              // populate database               function populatedb(tx) {                  tx.executesql('drop table if exists demo');                  tx.executesql('create table if not exists demo (id unique, data)');                  tx.executesql('insert demo (id, data) values (1, "first row")');                  tx.executesql('insert demo (id, data) values (2, "second row")');         //here can  multiple sql statements.             }              // transaction error callback              function errorcb(err) {                 alert("error processing sql: "+err);             }              // transaction success callback              function successcb() {                 alert("success!");             } 

link here


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -