简体   繁体   中英

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?

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.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM