Webkit SQL Databases Problem



  • Hi All,

    I'm trying to create 2 separate databases. The first one seems to create okay when I call openDatabase, and I can create a table when I run an SQL CREATE TABLE statement. I can see that the database has been created on the filesystem, and the table has been created.
    However, when I then try to create another database with openDatabase, qtWebkit just hangs.
    
    Heres my code:
    
     @
    

    function createDatabases()
    {
    alert("STARTING UP");

    var shortName = 'db1';
    var displayName = 'DB1';
    var maxSize = 100000; // in bytes

    alert("Open Database 1");

            //open the database
            dbConnection = openDatabase(shortName, "", displayName, maxSize);
    

    setTimeout(createTables1, 2000);
    }

    function createTables1()
    {
    alert("Create Tables in DB1");

    alert(dbConnection);

    dbConnection.transaction(
    function(transaction) {
    transaction.executeSql('CREATE TABLE IF NOT EXISTS playerstate(playerid INTEGER NOT NULL PRIMARY KEY, name TEXT NOT NULL DEFAULT "");', [], createTableHandler, errorHandler);
    });
    }

    function createTableHandler(var1, var2)
    {
    alert(var1);
    alert(var2);

    setTimeout(function(){
    alert("HERE");
    var shortName2 = 'db2';
    var displayName2 = 'DB2';
    var maxSize2 = 100000; // in bytes

    alert("Open Database 2");
    
    //open the database
    dbConnection2 = openDatabase(shortName2, "", displayName2, maxSize2, function(){alert('anything??');});  
    
    alert("BEATS ME"); 
    

    },5000);

    alert("WHATS UP?");
    }

    function errorHandler(var1, var2)
    {
    alert(var1);
    alert(var2);
    }
    @

    Can anyone explain what could be going wrong?

    Please note, I'm using setTimeouts because my transaction fails if I try to call immediately after openDatabase - this seems odd to me as well - could both problems be caused by the same underlying issue?

    Many thanks in advance,

    Peter


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.