I trying to write a twiiter client using webworks for the playbook. I use JSON, I want to put the parsed data in a DB for usage later. Problem is sometimes the executeSql command runs, sometimes it doesnt, as example:
TwitterDB.transaction(
function (transaction) {
alert("Creating tables");
transaction.executeSql('CREATE TABLE IF NOT EXISTS VIEWS(VIEW_ID TEXT NOT NULL PRIMARY KEY, VIEW_DESC TEXT NOT NULL);', [], nullDataHandler, errorHandler);
transaction.executeSql('CREATE TABLE IF NOT EXISTS TWEET_TO_VIEWS(VIEW_ID TEXT NOT NULL, TWEET_ID TEXT NOT NULL, PRIMARY KEY (VIEW_ID, TWEET_ID));', [], nullDataHandler, errorHandler);
transaction.executeSql('CREATE TABLE IF NOT EXISTS TWEETER_DETAILS(TWEETER_ID TEXT NOT NULL PRIMARY KEY, NAME TEXT, FOLLOWING BOOLEAN, SCREEN_NAME TEXT);', [], nullDataHandler, errorHandler);
transaction.executeSql('CREATE TABLE IF NOT EXISTS TWEET_MAIN(TWEET_ID TEXT NOT NULL PRIMARY KEY, IN_REPLY_TO_USER_NAME TEXT, TWEET_SOURCE TEXT, IN_REPLY_TO_STATUS_ID TEXT, RETWEETED BOOLEAN, RETWEET_ID TEXT, TWEETER_ID TEXT, FOREIGN KEY (TWEETER_ID) REFERENCES TWEETER_DETAILS(TWEETER_ID));', [],nullDataHandler, errorHandler);
}
);
When using Ripple and I run the debugger I step through the code, I have the alert, and then it skips all the other code. Ive tested the SQL and it creates the tables. Later in my code I do checks in the content of some of the tables, and depending on the results ill maybe do a insert, but then the queries all fail because the tables might not exists or values ive inserted did go in.
Thanks in advance!