I need to write a wrapper (based on MySQL Connector/C++) which encapsulate specific SQL statements and provide user friendly interfaces, like: insert(), update(), delete(), select(), etc.
In MySQL's native C API, every SQL statement could be executed by simply call "mysql_real_query()", but now, in MySQL Connector/C++, things get a little confused. There's 3 execute functions in sql::Statment class and 6 execute functions in sql::PreparedStatement class:
mysql-connector-c++-1.1.5\driver\mysql_statement.h:
bool execute(const sql::SQLString& sql);
sql::ResultSet* executeQuery(const sql::SQLString& sql);
int executeUpdate(const sql::SQLString& sql);
mysql-connector-c++-1.1.5\driver\mysql_prepared_statement.h, 104:
bool execute();
bool execute(const sql::SQLString& sql);
sql::ResultSet executeQuery();
sql::ResultSet executeQuery(const sql::SQLString& sql);
int executeUpdate();
int executeUpdate(const sql::SQLString& sql);
I wondered why there're so many execution functions rather than a simple and unified one? And which execute function should i use for specify SQL statements?
Note: I'm using MySQL Connector/C++ 1.1.5 with MySQL Server 5.6 as backend.