Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry SQLite optimal performance
    primarykey
    data
    text
    <p>I've overcome many hurdles while trying to work with SQLite on Blackberry. Now I've reached the point where everything seems to work fine and I'm looking for ways to speed up my queries.</p> <p>Sometimes my app retrieves a lot of data from a web service call, this data is parsed and stored into my database. A lot of DELETE, INSERT and UPDATE going on. The database calls seem to be taking a lot of time.</p> <p>I would like to know some best practices when dealing with SQLite. Preferably from people who have experience with it on the Blackberry platform specifically. Any tricks to speed up DELETEs or INSERTs etc....</p> <p>Links to good tutorials would be great. Or some snippets of useful code even better.</p> <p>Thanks in advance.</p> <p>EDIT:</p> <p>Here is some sample code from Blackberry using transactions.</p> <pre><code>import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.database.*; import net.rim.device.api.io.*; public class UsingTransactions extends UiApplication { public static void main(String[] args) { UsingTransactions theApp = new UsingTransactions(); theApp.enterEventDispatcher(); } public UsingTransactions() { } } class UsingTransactionsScreen extends MainScreen { Database d; public UsingTransactionsScreen() { LabelField title = new LabelField("SQLite Using Transactions Sample", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); setTitle(title); add(new RichTextField( "Updating data in one transaction in MyTestDatabase.db.")); try { URI myURI = URI.create("file:///SDCard/Databases/SQLite_Guide/" + "MyTestDatabase.db"); d = DatabaseFactory.open(myURI); d.beginTransaction(); Statement st = d.createStatement("UPDATE People SET Age=7 " + "WHERE Name='Sophie'"); st.prepare(); st.execute(); st.close(); st = d.createStatement("UPDATE People SET Age=4 " + "WHERE Name='Karen'"); st.prepare(); st.execute(); st.close(); d.commitTransaction(); d.close(); } catch ( Exception e ) { System.out.println( e.getMessage() ); e.printStackTrace(); } } } </code></pre> <p>Is there a reason why they're closing the statement every time?? Isn't it better just to close it once at the end (in a Finally block perhaps??).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload