14- DB - Database-driven iPhone App CSE to Fall 2010...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style 5/7/11 Database-driven iPhone App CSE 390 Fall 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/7/11 The purpose of this demo In the previous demo we explored the Navigation application template for iOS, how to populate a table view from an array, how to build a multiple screen application, and how to load resources such as images and videos based on a user’s selection of an item in the table view.
Background image of page 2
5/7/11 SQLite 3 The are numerous options in iOS for storing data: plists (for small amounts of simple data, like a score in a game), Core data, and SQLite, among others. SQLite is a pretty well known and widely supported database, and that’s the one we will be using in this demo. Even here there are a few choices. On the Mac you can open up the terminal window and use the command line to create and populate your database. Or you can use a graphical database management tool like SQLite Manager (a free Firefox plug-in) or Navicat, a free stand- alone editor. To get SQLite Manager, just open up Firefox and select Add-ons from the Tools menu. Follow the links to the Add-ons web page and search for SQLite – then click to download it and add it to Firefox,
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/7/11 Navicat Connecting to the (or creating a) database Double-click the database to view its tables Double-click the table to edit it and add items
Background image of page 4
5/7/11 SQLite from the command line In the Terminal window (Applications > Utilities > Terminal) you can begin by typing at the prompt a few simple lines to create your database. The first line changes the directory to where you want the db to be created, and the next one creates the directory to hold it. The third line switches to that directory and the fourth line creates
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/7/11 Populating the database The first task is to create a table ( CREATE TABLE ), give the table a name, then give it the values you want. The main thing is to have a key to address the records in the table (the primary key , typically an integer). Then add the values you want for the data (the fields for each record). In this case they were a name (for the list in the
Background image of page 6
5/7/11 Creating the table and records CREATE TABLE projects ( id INTEGER PRIMARY KEY, name VARCHAR(50), description TEXT, imageURL VARCHAR(255) ); INSERT INTO projects (name, description, imageURL) VALUES ('SmartStep', 'SmartStep is a computer game that uses a dance pad to teach kids math.', 'http://www.mm.cs.sunysb.edu/MMpics/SmartStep.jpg'); INSERT INTO projects (name, description, imageURL) VALUES ('iSign', 'iSign is a speech recognition application that converts spoken English to video clips of American Sign Language.', 'http://www.mm.cs.sunysb.edu/MMpics/iSign.jpg'); INSERT INTO projects (name, description, imageURL) VALUES ('FingerSpell', 'FingerSpell is a gesture recognition application that
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2011 for the course CSE 390 taught by Professor Scarlatos during the Fall '11 term at SUNY Stony Brook.

Page1 / 26

14- DB - Database-driven iPhone App CSE to Fall 2010...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online