Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
araskin
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

OS 5 webkit programming with HTML5_init.js (Google Gears)

[ Edited ]

Testing on a 9300 5.0.0.955 

 

I have created a simple page which creates a DB and a table

 

<html>
<head>
<script type="text/javascript" src="http://mydomain.com:8000/mw_mimes_public/common/html5_init.js" id="html5_init"></script>
<script type="text/javascript" src="http://mydomain.com:8000/mw_mimes_public/common/html5_worker.js"></script>
<script type="text/javascript">

function openDB() {
  try{
    var dbSize = 1 * 1024 * 1024; //1MB
    var db = openDatabase("testDB","1.0","testDB",dbSize);

    if (db) {
      alert("db instance is here");
      db.transaction(function(tx){
        tx.executeSql("CREATE TABLE IF NOT EXISTS testTable (Name, PhoneNum)");
      });
    }
    }
    catch(e){
     alert('DB Error:' + e.message + '.');
    }
}
</script>
</head>

<body onload="openDB()">

</body>
</html>

 

As you can see from the above I am using the html5_init.js to translate my HTML5 calls to Google Gears.

 

When I run I get the Gears Security Warning (which is great). I click on ALLOW. I noticed that the variable db is null afterwards and it never tries to executed the create table code. So I started digging deeper. It turns out that the openDatabase function inside html5_init.js is returning an exception when it tries to create the Gears DB. The exception is :

 

DB Error: Temporary Error Message

 

Has anyone seen this or know how to make it go away?


Alon 

Please use plain text.
Developer
araskin
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

Re: OS 5 webkit programming with HTML5_init.js (Google Gears)

A colleague of mine worked it out. The device did not have a memory card inserted and hence why the DB could not be created.

 

Alon

Please use plain text.