IT tutorials
 
Mobile
 

iOS SDK : Adding a SQLite Database

10/20/2011 11:42:40 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
Xcode project. The first task also illustrates adding the SQLite library to your Xcode project. After creating the database and loading it, you can then use the database programmatically via its C programming interface.

Try This: Creating a Simple Database Using FireFox SQLite Manager

  1. If you don’t already have Firefox, download and install it.

  2. Select Add-ons from the Tools menu (Figure 1).

    Figure 1. Adding SQLite Manager to Firefox
  3. Select Get Add-ons, type SQLite in the search box, and install SQLite Manager.

  4. Once installed and you have restarted Firefox, select Tools | SQLite Manager.

  5. Select the New icon (the blank paper graphic), and create a new database named myDatabase. Save the database file some place where you can easily find it later. Note SQLite Manager automatically adds the .sqlite extension.

  6. Click Create Table and create a new table named photos.

  7. Add three columns: id, name, and photo. Make id an INTEGER and check Primary Key and Autoinc check boxes.

  8. Make name a VARCHAR and check only Allow Null.

  9. Make photo a BLOB and check only Allow Null.

  10. Your screen should resemble Figure 2.

    Figure 2. Creating a database using SQLite Manager
  11. Click OK and the SQLite Manager generates the database table.

    Note

    SQLite does not enforce foreign key relationships. You must instead write triggers manually to enforce foreign key relationships. SQLite does not support right outer joins or full outer joins. SQLite views are read-only.


  12. Click the Browse & Search tab, and then click the Add Record button.

  13. In the action sheet, leave id blank. Type Icon One for the name. Notice the small paper clip beside photo. Move your mouse over the paper clip, and the tooltip should say “Add File as a Blob” (Figure 3). Click the paper clip and add any photo from your computer. If the photo column doesn’t say something like BLOB (Size: 65984), the file was not correctly added as a blob.

    Figure 3. Adding a record using SQLite Manager
  14. Click OK, and the record will be added. Add another record, selecting any other image from your computer.

  15. From the menu, select Database | Close Database from the main menus to close the database. You can now exit SQLite Manager and quit Firefox.

  16. Open Xcode and create a new View-based Application. Name the application MyDBProject.

  17. Expand Frameworks in the Navigator and right-click on any one of the frameworks (e.g., UIKit) and select Show in Finder from the pop-up menu. This will get you to the folder with all of your frameworks on your computer. Move up two folder levels from there to the SDK folder and then open user/lib.

  18. Drag and drop the libsqlite3.0.dylib framework from that folder to Frameworks in the Navigator in Xcode. In the dialog that pops up, be sure to uncheck “Copy items into destination group’s folder” and click Finish.

  19. Add the database file that you created earlier to the Resources folder. Be sure to check the Copy Items check box so that the database file gets copied into MyDBProject.

  20. This task is now complete with the SQLite library added to the project and the database file copied into the project’s resources. Do not delete the project or database.


Note

Adding binary data using SQLite Manager in Firefox seems to be buggy. Sometimes it works, sometimes not. If after adding a record the photo column is blank, just edit the row and add the photo file’s content again. Updating the blob seems to be more stable in SQLite Manager.

 
Others
 
- The Anatomy of a Mobile Site : Navigation and menu systems (part 3) - Paving Mobile Pathways & Switcher Links
- The Anatomy of a Mobile Site : Navigation and menu systems (part 2) - Breadcrumbs, Header and Footer Navigation
- The Anatomy of a Mobile Site : Navigation and menu systems (part 1) - Navigational Lists & Decorating Menus
- iPad Troubleshooting : No Sound in Music or Video
- iPad Troubleshooting : How to Hard-Reset Your iPad & How to Soft-Reset Your iPad
- iPad : 3G Cellular Data Connection
- Beginning Android 3 : Set Up the Device
- Beginning Android 3 : Set Up the Emulator
- Getting Started with XNA : Your First XNA Project (part 3) - Examining the Solution in More Detail
- Getting Started with XNA : Your First XNA Project (part 2) - Moving the Graphic
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us