Core dumped while running this program:
int main(void) {
sqlite3 *conn;
int error = 0;
error = sqlite3_open("cloud_db.sqlite3", &conn);
if (error) {
puts("Can not open database");
exit(0);
}
error = sqlite3_exec(conn,
"update server set servername=\'Laks\' where ipaddress=\'192.168.1.111\'",
0, 0, 0);
if (error) {
puts("Can not update table");
exit(0);
}
sqlite3_close(conn);
return 0;
}
I have tried accessing (select query) sqlite using C and it shows the contents - that's fine. How can I use queries like update? Above I'm trying to execute a query like:
update server set servername="Laks" where ipaddress="192.168.1.111";
running this query with in sqlite> works fine. How to execute (update query) it from C program?