views:

84

answers:

1

Hello everyone, I am able to import .csv files into a SQlite table through the command line. It works nice and fine. What i wanted to know was is it possible to do the exact same thing through Objective C code..meaning execute commands like .mode csv && .import file.csv table.

The interface sqlite3 does all normal SQL statement execution like selecting, deleting etc..But i am not sure about the importing part.

Any guidance anyone? Thanks in advance Regards

+1  A: 

You can try the virtual table described on the ImportingFiles page. However, you may best off just using an existing Objective-C CSV parser, then inserting each row yourself (within a transaction). See Anyone know of a good csv to NSArray parser for objective-c for a start.

Matthew Flaschen
+1 that's my csv parser! :)
Dave DeLong
Thanks for your response guys. Actually, i came across a few parsers(and efficient ones too), but my feeling was if there was support in SQLite itself, i should be using it. Thats why i wanted to go with the import rather than try parsing myself or use a wrapper. Anyways I'm trying it with the virtual table features. Thanks again