1

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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
how to direct import csv file to sqlite database objective c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.