Home  +  Forums  +  C++ and Sockets  +  C++ and SQL: MySQL, sqlite, ODBC  +  Miscellaneous Projects
Logo
~Database~
~ C++ ~
~Contact~

SQL / C++ Tutorial using sqlwrapped

6. Changing data

PreviousNextIndex Use execute() and an update sql query to change data in your database. To enable error logging, create a class that implements the pure virtual class IError. The sqlwrapped libraries come with two derived classes, StderrLog and SysLog, that logs to stderr resp. syslog. The following example has been complemented with logging to stderr. example
int main() { StderrLog log; Database db("localhost", "root", "", "tutorialdb", &log); // MySQL specific if (!db.Connected()) { printf("Database not connected - exiting\n"); exit(-1); } Query q(db); q.execute("update player set name='Lorangrym' where num=1"); }
example4_mysql.cppexample4_sqlite3.cpp
PreviousNext
Page, code, and content Copyright (C) 2021 by Anders Hedström