vendredi 13 mars 2015

How to create multiple tables in one SQLite database using JavaScript

My iOS phonegap app is using SQLite database. I was able to create one table in my database using JavaScript but now I want to create 2nd table in the same database but I'm not able.


I googled but so far I didn't see anything helpful.


Thanks for your help and time.


Joe


Here is my code:



<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<script src="http://ift.tt/13wBVXk" data-semver="2.1.3" data-require="jquery"></script>
<script src="http://ift.tt/1toXtPU"></script>
<script>
$(function () {
var databaseOptions = {
fileName: "test",
version: "1.0",
displayName: "test",
maxSize: 1024
};

var database = openDatabase(
databaseOptions.fileName,
databaseOptions.version,
databaseOptions.displayName,
databaseOptions.maxSize
);

database.transaction(
function (transaction) {
transaction.executeSql("CREATE TABLE IF NOT EXISTS 1 organism TEXT");
transaction.executeSql("CREATE TABLE IF NOT EXISTS 2 organism TEXT");

});


});
</script>
</HEAD>

<BODY BGCOLOR="#FFFFFF">

</BODY>
</HTML>

Aucun commentaire:

Enregistrer un commentaire