In this video, learn how to execute queries against SQLite. Annyce explains how the query results are returned to you as a Cursor.
- [Instructor] Now let's look at another way…of retrieving records with SQLite…using the rawQuery method.…We're going to open up our data source class,…that's TopsyTurveyDataSource,…and we'll add a new method called getAllRecipes…that we'll use to return the list of our stored recipes.…Right underneath Line 70…we'll create a new public method.…This time it's going to return a list of recipes…and it's going to be called getAllRecipes.…
We can instantiate and return…an empty list of recipes for now.…So let's create a list of Recipe objects.…We'll call it recipes,…and we'll set it equal to a new array list.…Hit Enter, and then on Line 77…let's just return this list of recipes.…Great, in order to retrieve records from our database,…we're going to need to use a query method.…There are several different variations…that are available to you…depending on how you want to handle the selection.…
The most basic query has the following,…a string, which contains the select statement,…and then a string array for the values of said statement.…
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 59m Intermediate
1. SQLite Basics
2. SQLite Beyond the Basics
3. Working with Cupboard
4. Realm Basics
5. Realm Beyond the Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.