how to delete all tables in a FMDB database ?

601 views
Skip to first unread message

Gianfrancesco Arcuri

unread,
Jul 7, 2014, 5:49:30 AM7/7/14
to fm...@googlegroups.com
Hi guys, I'm working on iPhone apps with FMDB,
I'd like to empty a database completely, without knowing the names of the tables in it.

I've tried the .tables command to list all tables in the database but it doesn't work

So the only solution I've found is to remove the database and create it again.

Is there a working command to remove all tables without removing the database itself ?

Thanks in advance

Gianfry

Gus Mueller

unread,
Jul 7, 2014, 1:43:28 PM7/7/14
to fm...@googlegroups.com
On Jul 7, 2014, at 2:49 AM, Gianfrancesco Arcuri <gianfrances...@gmail.com> wrote:

> Is there a working command to remove all tables without removing the database itself ?

You can get the schema with getSchema (<https://github.com/ccgus/fmdb/blob/master/src/fmdb/FMDatabaseAdditions.h#L132>) and then get the table names out of that, stick them in an array, and then loop through and delete all those tables in another query.

-gus
Reply all
Reply to author
Forward
0 new messages