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
New Contributor
Posts: 4
Registered: ‎08-19-2011
My Device: Style
My Carrier: Sprint

webworks app with sqlite closes automatically

I am developing a webwork application to store data locally using sqlite database. In torch it works fine. However, in Style(9670 v6.0.0.248) all the subsequent read/write transactions after the first read/write transaction is failing.

On thing i noticed is that the database in style is getting stored in media card , the one in torch is stored on the device.

 

Any ideas why this is failing in styles.

 

Thanks in advance

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: webworks app with sqlite closes automatically

[ Edited ]

Welcome to the forums!

is this a physical device or a simulator?

The Torch has 4 GB of internal storage while the Style does not.

SQLite databases need to be stored either on internal storage (not RAM) or on an SD card.

Check for the presence of an SD card on the Style before attempting to create/access your database.

Use blackberry.system.hasCapability('storage.memorycard') to find out.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
New Contributor
Posts: 4
Registered: ‎08-19-2011
My Device: Style
My Carrier: Sprint

Re: webworks app with sqlite closes automatically

Thanks for the reply..

 

This is the physical device. It has the media card. The database is getting created. It has 4000 employee records in it. My app  has three pages. The first page will allow the user to seach for an employee by entering first name and lastname. Once the user clicks on the serach button on the first page, the second page displays a list of employees having the lastname. When the user click any individual item on the list, it will display the details on a detail page.

 

No error comes if the user search for one employee and close the application. If the user decides to search for multiple employees, then clicking the search button after first search will close the application without giving any error.

 

In code behind the search button, i am opening the database in read/write mode that  is db.transaction. The display to the third page is read transaction that is db.readTransaction.

 

My guessing is that  there is a lock on database that happened from the previous reading/writing. Is there anyway we can unlock the database before running a transaction?

 

 

Retired
Posts: 46
Registered: ‎07-08-2010
My Device: Superberry
My Carrier: Rogers

Re: webworks app with sqlite closes automatically

SQLLite should handle the closing of the transaction automatically.

Can you search for multiple employees on the first shot?
-------------------------------------------------------------------------------------------------
Useful resources, food for the brain:
Web(Works) KB - http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/tkb-p/browser_dev%40tkb
Highlighted
Developer
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch
My Carrier: AT&T

Re: webworks app with sqlite closes automatically


Use blackberry.system.hasCapability('storage.memorycard') to find out.


OK, I'm confused by this. I attempted to put it into an if statement, but the line fails to execute even in the Ripple emulator.

	if (!blackberry.system.hasCapability('storage.memorycard'))
	{
		alert("This device has no SD Card!");
		return;
	}

 Is that not appropriate?

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Retired
Posts: 46
Registered: ‎07-08-2010
My Device: Superberry
My Carrier: Rogers

Re: webworks app with sqlite closes automatically

Which device are you running on, and does it have an SD Card? If yes, this API will return true even if it's not inserted. It's intended to be used to see if a device supports a particular capability.
-------------------------------------------------------------------------------------------------
Useful resources, food for the brain:
Web(Works) KB - http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/tkb-p/browser_dev%40tkb
Developer
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch
My Carrier: AT&T

Re: webworks app with sqlite closes automatically

So using that statement in an IF is ok? When I said "fails to execute" , I mean that the developer tools in Chrome shows that the statement had an error like something was undefined.

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids