Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Webkit SQL Databases Problem
Forum Updated to NodeBB v4.3 + New Features

Webkit SQL Databases Problem

Scheduled Pinned Locked Moved Qt WebKit
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    peterfhannon
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved