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
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified
Accepted Solution

openDatabase Issue with O.S. 6 Simulators

[ Edited ]

I'm using the following code

 

var Dataset = function() {
this.database = null;
this.currentData = null;
this.onTransact = null;
this.onDataLoaded = null;
try {
alert('a')
if(window.openDatabase != "undefined"){
alert('b');
try {
this.database = window.openDatabase("trinisceneapp", '1.0', 'gallery', 50 * 1024,function(){ alert('ok open'); });
alert('cc');
this.database.transaction(
function(c){ alert('c');
c.executeSql("CREATE TABLE IF NOT EXISTS cache (key int unique, uri text unique, json text)",[],function(){ alert('ok create'); });
},function(){ alert('ok tx'); },function(){ alert('fail tx'); });
alert('dd')
}catch (e) {
alert('fail');
}


}else{ alert('fail b'); }
}catch (e){
alert('fail to open database');
}
};

 

on a 9780 O.S. 6 simulator.

 

on executing a var d = new Dataset(); the code fails after alert('b');

 

IF i were to run this code on a 8520 O.S. 5 simulator The code would be executed successfully 

 

What is the problem with O.S. 6 and openDatabase....I thought this was a HTML5/ OS 6 feature?

Retired
Tohman
Posts: 34
Registered: ‎10-24-2011
My Device: Curve

Re: openDatabase Issue

Code is fine, the issue should be with the simulator.

Try Curve 9330 6.0.0.436, I like it.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified

Re: openDatabase Issue


Tohman wrote:

Code is fine, the issue should be with the simulator.

Try Curve 9330 6.0.0.436, I like it.


ARe you sure man? I seem to have a similar issue with a 9330 and 9800 O.S. 6. Can it be that I maybe trying to access it too early? does webworks have any sort of "deviceready" rather than using the <body onload=""> method? 

Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified

Re: openDatabase Issue

the openDatabase doesn't work in the 9780 O.S. 6 Simulator...I should assume therefore that it doesn;t work on the real 9870 O.S.6 device

Retired
Tohman
Posts: 34
Registered: ‎10-24-2011
My Device: Curve

Re: openDatabase Issue

It works well on a real device after inserting SD Card.

Pick another simulator, and then simulate SD Card insertion before launching your app.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified

Re: openDatabase Issue

I did...I don't know whats going on but I can't wait....I'm going to have to assume it will work on a real device and hope for the best. 

 

But if it doesn't work on the simulator why should I expect it to work on a real device?

Developer
shnuffy
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: openDatabase Issue

[ Edited ]

Because simulator != real device. This isn't specific to RIM either: no mobile simulators are sufficient for final testing. They are simply not representative enough of the actual device. They are close, often very close, but I guarantee you'll always find new bugs not experienced on a simulator, and the simulator won't always behave like a real device. It's just the nature of simualtion. 

 

It's easier said than done, but you really need to test on as many real devices as possible before production.

Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011
My Device: Not Specified

Re: openDatabase Issue

Well I guess you are right but I really don't have that kind of resources so I guess I'll have to take the chance
Developer
shnuffy
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: openDatabase Issue

[ Edited ]

You are right, a lot of us don't have those resources and so we rely on simulators when we have to. It's really a matter of weighing the risks since it's unlikely you'd ever be able to fully test on every environment you support (different resolutions, devices, operating systems, networks, transports, etc.).

 

You have to find a reasonable subset, mixing and matching these elements, until you are comfortable with the test coverage. I use my current phone, and old Storm laying around, but mostly I try to use my friends' phones when they let me. This gives me a good breadth of networks, old and new devices, data plans and no data plans. Obviously I can't do this all the time so I wait until I feel the app is ready to be released before bugging my friends for their devices for "final" testing.

 

Well-planned test coverage should give you confidence in releasing your app into the wild - for the most part. There are always weird edge cases your users will let you know about!

 

Best of luck in your development!