I want to get any answer (for know if my query it was success or failure) of the following query:
let rs = try self.database.executeQuery
("insert into Practice(old, number) values (?, ?)",
values: [old, number])
but only i get this
<FMResultSet: 0x60000289ab20>
while i try iterate the collection, never into inside the cycle while
while rs.next(){
print("never")
}
which is wrong in my code, why I get a clean collection
You want to use
executeUpdatewhen performing an query that updates your database, such as anINSERT,UPDATE, orDELETESQL statement:Needless to say, the way you know whether
INSERTsucceeded or not is whether it throws an error.But
executeQueryis only used if the SQL returns rows (e.g. aSELECTstatement).In the case of
UPDATEandDELETE, an error is thrown only if there was an error during the update. But (especially if you have aWHEREclause), you may also want to examinedatabase.changesto see how many rows were affected.