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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011

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? 

Please use plain text.
Developer
shnuffy
Posts: 268
Registered: ‎08-19-2009

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!

Please use plain text.
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011

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?

Please use plain text.
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011

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?

 

Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 514
Registered: ‎07-18-2011
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)
Please use plain text.
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011

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
Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 514
Registered: ‎07-18-2011
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)
Please use plain text.
Trusted Contributor
icecappacino
Posts: 152
Registered: ‎02-12-2011

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
Please use plain text.
Developer
shnuffy
Posts: 268
Registered: ‎08-19-2009

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.

Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 514
Registered: ‎07-18-2011
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)
Please use plain text.