ios - How to check SQLite table is empty or not in Swift -


i using fmdb. need function tells table empty or not tried this. table empty writing somedata

 var count = shoppingpad.executestatements("select count(*) mytable")               print("count",count)             if(!count )             {                print("empty table")             }             else             {                 print("somedata")             } 

executestatements update/insert statements. data out of database use executequery, returns resultset, have fetch actual data , integer value of first row.

    let result = database.executequery("select count(*) mytable", withargumentsinarray: [])     if result.next() {         let count = result.intforcolumnindex(0)         if count > 0 {             print("somedata")         } else {             print("empty table")         }     } else {         print("database error")     } 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -