Hi guys, please help me with sqlite database. When I save the data in the table, it always saves the wrong data in the columns. They don't match the submitted data at all. I don't know where I am making a mistake. Thank you!
I think the issue is related to the lifetime of the strings. Try changing
sqlite3_bind_text(insertStatement, sqlite3_bind_parameter_index(insertStatement, ":name"), name, -1, nil)
etc. to
sqlite3_bind_text(insertStatement, sqlite3_bind_parameter_index(insertStatement, ":name"), name, -1, SQLITE_TRANSIENT)
Re String(describing: …)
, isn’t it sufficient to have the String(cStirng: …)
? Why have you wrapped that in describing:
? That seems unnecessary / unhelpful to me, but maybe I have missed something.