if sqlite3_prepare_v2(db, "select a from aaa", -1, &q,nil) == SQLITE_OK {
while sqlite3_step(q) == SQLITE_ROW {
let res = sqlite3_column_text(q, 1)
print(res)
}
} else {
print("NOT WORKING")
NSLog("%s", sqlite3_errmsg(db))
}
In my table aaa I have a field named 'a' and values 1,2,3 as shown here :
I'm trying to put the values in an array or just print them, but when I print (print(res))
, the values are just "nil
".
How can I get the real values?
EDIT: the values (1,2,3) are strings and not intagers, that why i chose sqlite3_column_text() and not sqlite3_column_int()