O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving data locally using a SQLite database

Saving and updating data to our SQLite database is just a matter of creating a function for each Create, Read, Update, and Delete (CRUD) operation that we need, and forming the SQL statement before we execute it against the local database (our db object).

In this recipe, we'll edit the database.js module file to return a db object that contains two new functions, one for inserting a record into our favorites table and one for deleting a record. We'll also capture the click events on our table rows to allow the user to view the record in a detailed subwindow, and add a button for creating and deleting favorites.

How to do it...

Open the JavaScript file called database.js, and replace its contents with the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required