I am trying to figure out how to use the Safari JS database. The only
thing that I have been able to do successfully is to create the db,
the rest doesn't seem to be saving. All I really want to do is save
one entry and then be able to read and update it. Here is what I have
tried:


var mydb = openDatabase("testDB", "1.0", "test");


function nullDataHandler(transaction, results) { }
function createTables(db)

{

    db.transaction(

        function (transaction) {
            /* The first query causes the transaction to
(intentionally) fail if the table exists. */
            transaction.executeSql('CREATE TABLE people(id INTEGER NOT
NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL DEFAULT "John Doe",
shirt TEXT NOT NULL DEFAULT "Purple");', [], nullDataHandler,
errorHandler);

            transaction.executeSql('insert into people (name, shirt)
VALUES ("Joe", "Green");', [], nullDataHandler, errorHandler);

            transaction.executeSql('insert into people (name, shirt)
VALUES ("Mark", "Blue");', [], nullDataHandler, errorHandler);

            transaction.executeSql('insert into people (name, shirt)
VALUES ("Phil", "Orange");', [], nullDataHandler, errorHandler);

            transaction.executeSql('insert into people (name, shirt)
VALUES ("stupid", "Purple");', [], nullDataHandler, errorHandler);
        }

    );

}

Any help is much appreciated

Thanks,
Bryan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to