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

JSON vs SQL

Hello,

 

I am developing and application for which I am fetching a JSON object from a remote server. Rather than fetching the this data everytime on demand I would like to keep a "cache" of this data as long as the application is in use( don't need it when exiting application). I am worried however about memory and performance issues as I would prefer that for every "request" for the data that a cache of it be stored for when needed( in cases such as pagination, reloading). 

 

I'm considering using Lawnchair however I note blackberry's openDatabase and wonder which is more effecient/...

 

using a JSON/ DOM object storage or openDatabse SQLlite? 

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

Re: JSON vs SQL

I'd probably use the SQLite option due to somewhat severe memory issue in WebWorks apps. There will be a slight performance trade-off versus the object, as it will take a little bit of time to call the database, but it's better than crashing when you run out of memory!

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

Re: JSON vs SQL


shnuffy wrote:

I'd probably use the SQLite option due to somewhat severe memory issue in WebWorks apps. There will be a slight performance trade-off versus the object, as it will take a little bit of time to call the database, but it's better than crashing when you run out of memory!


Wow! that bad huh?

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

Re: JSON vs SQL

Ok here is another question that I need advice on...

 

The fetched data json objects are used to iterate over in order to display master/ details recrods sets. 

 

Would it be effecient to 

 

  1. Store each iteration as a sql record item?
  2. Or store the object as a blob?

 

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: JSON vs SQL

Hi 

 

 



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

Re: JSON vs SQL

I'm wondering if you are right...I find that using the html5 shim for OS5 seems a bit risky seeing it requires you have an SDCARD. but i am worried about "bogging" down performance with memory json objects all the time
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: JSON vs SQL

Hi 

 

 



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

Re: JSON vs SQL

thanks for your reply very interesting and informative...please indulge me here but wouldn't it just be less bulky then to use straight html5 sqlite...? It is stated that it is already compiled for OS 5 and already while i still see some lag it ultimately serves its purpose. In the interim here rather than iterate the json into records I just kept it as a dump. Seems to work out fine...though I detect a lag...I think
Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: JSON vs SQL

The "straight" HTML5 SQLite (WebDB) on OS5 uses the SD Card. I believe this is done through the Google Gears bridge.

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: JSON vs SQL

Shnuffy is correct about how it works, and yes icedcappucino, using plaing HTML5 SQL databases will be faster than lawnchair.

 

But lawnchair is pretty small (3.4k minified) and if thats where you feel more comfortable I wouldn't expect a HUGE performance hit. Plus its even smaller if you exclude all the unecessary adapters.



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)