The ability to create a table and insert data into it is not of much use if we don't know how to retrieve that data and present it in some useful way to the user! We'll now introduce the concept of a resultSet (or recordSet if you prefer) in SQLite and how to retrieve data via this resultSet object that can be collected and returned to an array format suitable for usage within a TableView.
In your database.js
file, add the following function:
function getFavorites() { var sql = "SELECT * FROM favorites ORDER BY title ASC"; var results = []; var resultSet = db.execute(sql); while (resultSet.isValidRow()) { results.push({ id: resultSet.fieldByName('id'), title: resultSet.fieldByName('title'), description: resultSet.fieldByName('description'), link: resultSet.fieldByName('link') }); //iterates to the next...