SQLite - Create Database?

Discussion in 'Mac Programming' started by Fritzables, Oct 8, 2011.

  1. Fritzables, Oct 8, 2011
    Last edited by a moderator: Oct 8, 2011

    Fritzables macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #1
    Hi All,

    As part of the application I am currently writing using XCode I want to use SQLite as the preferred database.

    From what I can gather, to create a database, you do this via a terminal session. For example: sqlite3 test.db

    If I wanted to create a database within XCode, how would I achieve this?

    I am happy with all the SQL statements as I used this when I was coding under Visual Studio using SQL Server.

    It just the creation of a database via XCode and SQLite. I am pretty new to all this Mac stuff.


    Pete
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    I'm assuming your asking how to create a database programmatically when your program runs, as opposed to clicking something in XCode itself to create a database.

    The sqlite3_open (or sqlite3_open16 or sqlite3_open_v2) function will create a database if the database attempting to be opened doesn't exist.
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    Xcode is a development tool. It's not a computer language.

    Xcode itself can work with a number of different computer languages, such as C, Java, Python, and shell scripts. None of those are the same language, and you'd create a sqlite database in very different ways in each language.

    So what language are you coding in?
     
  4. Fritzables thread starter macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #4
    Thanks Jimi,

    That's all I need to know. Yes, to create a database within the application I am writing.

    Chown33 - I am using Cocoa with XCode.


    Pete
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Cocoa isn't a language, either. It's a class library or framework.

    Objective-C is the language Cocoa is written in. Objective-C is a superset of the C language.
     

Share This Page