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

Native Development

Reply
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10
Accepted Solution

SQL UPDATE/DELETE Issues

[ Edited ]

Once I have created a connection to my local DB Table, I can INSERT as many times as I want.  Using that same DB Table, I cannot UPDATE/DELETE that same row (the one I just inserted).  SELECT works just fine and I haven't received any SQL errors.

 

I am positive all of my SQL commands are typed properly and function as I have tested them on other data in the same DB table that was created outside of my application.  It seems that once my application has altered any of the information in that row, the row becomes locked

 

Any ideas?  Thanks

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: SQL UPDATE/DELETE Issues

Could you post the code for update? Are you using QSqlDatabase/QSqlQuery or SqlDataAccess?

Andrey Fidrya, @zmeyc on twitter
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: SQL UPDATE/DELETE Issues

#include <bb/data/DataSource>
#include <bb/data/SqlConnection

 

 

I am having the same issue using the customsqldatasource from  quotes sample app (issue is in my app not the sample app)

 

I use the same execute function for all my queries, I only have an issue after I have done an INSERT/UPDATE to any given row.  If I run those queries on data already in the db (I created my assets/xxx.db with data included) they work fine...the first time, if I run the same queries on the now altered row, the queries do nothing

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: SQL UPDATE/DELETE Issues

[ Edited ]

I'm not sure if this could be the reason, but assets folder is readonly (at least in signed builds). In order to be modified, the database should be copied to data folder and opened from there. This can be done on the first run of the application.

 

Example of accessing the data folder:

http://supportforums.blackberry.com/t5/Cascades-Development/Problem-accessing-assets/m-p/2001979#M67...


Andrey Fidrya, @zmeyc on twitter
Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: SQL UPDATE/DELETE Issues

Every time I open the SQL connection, I check that the DB has been copied to the data folder

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: SQL UPDATE/DELETE Issues

what erro do you get when you try to UPDATE/DELETE? anything interesting in app's log?

Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: SQL UPDATE/DELETE Issues

no errors, the queries are valid and run on the table...they just don't do anything to the table

Developer
aklowther
Posts: 47
Registered: ‎01-15-2013
My Device: Z10

Re: SQL UPDATE/DELETE Issues

[ Edited ]

I was able to solve the issue, guess I wasn't paying enough attention when I was rereading my INSERT queries, I had put single quotes around the int index, so I needed those quotes on the other queries