Thursday, September 11, 2025
HomeiOS Developmentios - Methods to delete all rows from all tables in DB...

ios – Methods to delete all rows from all tables in DB file utilizing FMDB


I am attempting to create a standard methodology to delete all rows from all DB recordsdata in my mission.
I do not wish to retailer and go all tables names, so it ought to work solely with a DB file path.
I attempted to get all tables from the DB file through this code:

    guard
        let path = getDBPath(for: .contacts),
        let dbQueue = FMDatabaseQueue(path: path)
    else { return }
    
    dbQueue.inDatabase { fmdb in
        do {
            let resultSet = strive fmdb.executeQuery(
                "SELECT identify FROM sqlite_master WHERE kind="desk"",
                values: nil
            )
            // what's subsequent?
        } catch {
            // log error
        }
    }

However I am unable to determine what I’ve to do after fmdb.executeQuery.
The place do I have to name "DELETE FROM (tableName)"?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments