luvieere
luvieere

Reputation: 37494

How to export to CSV from sqlite3 on the iPhone?

How can I export data from an sqlite3 database in Objective-c? Can I issue a dump command at least? What options do I have for exporting?

Upvotes: 0

Views: 1537

Answers (2)

user120587
user120587

Reputation:

You can look into how the .dump command is implemented by the sqlite shell, to see how you can accomplish the same thing. In particular take a look at the dump_callback function and also the actions taken when the word dump is seen by the shell

Shell.c source code: dump_callback()

Upvotes: 1

Ed Marty
Ed Marty

Reputation: 39700

I'm not aware of any built-in method for dumping a SQLite database in the sqlite api. However, I imagine you could probably cook something up to find all tables and their schemas, then SELECT * FROM each one and export it as a text file manually.

Upvotes: 1

Related Questions