Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-13-2011, 09:55 AM   #1 (permalink)
btm
Registered Member
 
Join Date: Dec 2011
Posts: 2
btm is on a distinguished road
Default Adding a database to my app

Good morning everyone,

I'm new here, and I would like to start saying thank you to this forum, since its content is wonderful and very useful.

I'm starting my first app in iPhone, and it's based in loading data from a database and creating queries.

So I'd like to know which is the best SQL manager available to fill my tables, and establish the relationships between my tables, so I could export my database to the app.

I have read that the compatible format is SQLite to work after with XCode, so it should be a SQL manager that can be compatible with SQLite.

I don't need a connection to server/FTP/sockets, etc, because my database it's going to be part of my app, if it's not too large.

Thank you very much in advance, and have a nice day :-)
btm is offline   Reply With Quote
Old 12-13-2011, 03:19 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

you probably want to use Core Data which allows you to easily set up tables, columns and relationships.

a couple of warnings though: The learning curve with core data is pretty steep and the way they have set it up doesn't make a whole lot of sense.

also a big warning: any time you make changes to your database schema (add tables, add columns, change columns etc) you have to completely delete your old database schema including all data and then recompile your code which will automatically create a new database. kind of a pain.

This means whatever echema you launch your 1.0 app to the app store is the schema you will keep for the entire lifetime of your app... so be VERY careful! I always add extra tables and columns to anticaipate future additions.

now there is, technically, a way to change the schema but it looks way too complicated to me and has too much risk that my app will not work once changed, so I would never, personally , ever change a schema once the app is released.
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 12-14-2011, 05:09 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 33
X-RaY is on a distinguished road
Default

My suggestion would be to create a .sql file with terminal
open up terminal and type "sqlite3 myDatabase.sql" in the prompt.
create a table (eg: create table test (x integer primary key))
that way the database is created in the directory your terminal was at (by default your home directory)

Drag and drop the sql file into your Xcode project and look for some code to create a mutable copy of the database from your NSBundle to the app's Document directory.

from there i suggest using FMDB to communicate with the database.
It's a very easy to use sqlite database wrapper.

Last edited by X-RaY; 12-14-2011 at 05:14 AM.
X-RaY is offline   Reply With Quote
Old 12-14-2011, 05:42 AM   #4 (permalink)
Registered Member
 
SundialSoft's Avatar
 
Join Date: Oct 2010
Location: Scotland
Posts: 176
SundialSoft is on a distinguished road
Default

Quote:
Originally Posted by btm View Post
Good morning everyone,

I'm new here, and I would like to start saying thank you to this forum, since its content is wonderful and very useful.

I'm starting my first app in iPhone, and it's based in loading data from a database and creating queries.

So I'd like to know which is the best SQL manager available to fill my tables, and establish the relationships between my tables, so I could export my database to the app.

I have read that the compatible format is SQLite to work after with XCode, so it should be a SQL manager that can be compatible with SQLite.

I don't need a connection to server/FTP/sockets, etc, because my database it's going to be part of my app, if it's not too large.

Thank you very much in advance, and have a nice day :-)
Use CoreData. It's simple to use compared to SQLITE and the management tool is built-in. You can get DB tools such as the Firefox plugin to work on tables for the DB or use other methods to load data. Lots of resources on web for you to Google.
SundialSoft is offline   Reply With Quote
Old 12-21-2011, 10:38 AM   #5 (permalink)
btm
Registered Member
 
Join Date: Dec 2011
Posts: 2
btm is on a distinguished road
Default

Thank you very much to everyone for your kind replies.

I'll try with the choices you gave me.

The main problem is that the database is going to be updated monthly since the app is launched. So the best solution is to put the database as an external file in a server. How can I access to that file inside the code of my app? Because I have seen it's pretty easy to "call" the file if it is in the same folder of the app itself, but I don't know how to write the path of a file in a folder of an external server.

Thank you again.
btm is offline   Reply With Quote
Reply

Bookmarks

Tags
database, sql

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 397
14 members and 383 guests
7twenty7, AppsBlogger, Creativ, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, sacha1996, Sami Gh, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0