I want to get number of rows in result set. I am using FMDB for database operations. There is also one function hasAnotherRow()
but it returns true
everytime. Below is my code.
let selectQuery = "SELECT * FROM \(tableName) WHERE chrSync = 'Y'"
if let rs = database.executeQuery(selectQuery, withArgumentsIn: [])
{
// Here I want to check if rs has more than 0 rows
while(rs.next()){
let dir = rs.resultDictionary
let json = JSON(dir)
data.append(json)
print("Has another: \(rs.hasAnotherRow())") // It always returns true
}
let json = JSON(data)
return json
}
I am new in IOS, so please share me link if is there already answered.
Thanks.