#include <connection.h>
Public Methods | |
Connection () | |
Create object without connecting it to the MySQL server. | |
Connection (bool te) | |
Connection (const char *db, const char *host="", const char *user="", const char *passwd="", bool te=true) | |
For connecting to database without any special options. | |
Connection (const char *db, const char *host, const char *user, const char *passwd, uint port, my_bool compress=0, unsigned int connect_timeout=60, bool te=true, cchar *socket_name=0, unsigned int client_flag=0) | |
Connect to database, allowing you to specify all connection parameters. | |
bool | connect (cchar *db="", cchar *host="", cchar *user="", cchar *passwd="") |
Open connection to MySQL database. | |
bool | real_connect (cchar *db="", cchar *host="", cchar *user="", cchar *passwd="", uint port=0, my_bool compress=0, unsigned int connect_timeout=60, cchar *socket_name=0, unsigned int client_flag=0) |
Connect to database after object is created. | |
void | close () |
Close connection to MySQL server. | |
std::string | info () |
Calls MySQL C API function mysql_info() and returns result as a C++ string. | |
bool | connected () const |
return true if connection was established successfully | |
bool | success () const |
Return true if the last query was successful. | |
Query | query () |
Return a new query object. | |
operator bool () | |
Alias for success(). | |
const char * | error () |
Return last error message. |
|
Create object without connecting it to the MySQL server. Use real_connect() method to establish the connection. |
|
Same as default ctor except that it allows you to choose whether exceptions are enabled.
|
|
For connecting to database without any special options.
This constructor takes the minimum parameters needed for most programs' use of MySQL. There is a more complicated constructor that lets you specify everything that the C API function
|
|
Connect to database, allowing you to specify all connection parameters.
This constructor allows you to most fully specify the options used when connecting to the MySQL database. It is the thinnest layer in MySQL++ over the MySQL C API function
|
|
Close connection to MySQL server. Closes the connection to the MySQL server. |
|
Open connection to MySQL database. Open connection to the MySQL server, using defaults for all but the most common parameters. It's better to use one of the connect-on-create constructors if you can. See this for parameter documentation. |
|
return true if connection was established successfully
|
|
Return last error message.
Simply wraps |
|
Alias for success(). Alias for success() member function. Allows you to have code constructs like this:
Connection conn; .... use conn if (conn) { ... last SQL query was successful } else { ... error occurred in SQL query } |
|
Return a new query object. The returned query object is tied to this MySQL connection, so when you call a method like execute() on that object, the query is sent to the server this object is connected to. |
|
Connect to database after object is created. It's better to use one of the connect-on-create constructors if you can.
Despite the name, this function is not a direct wrapper for the MySQL C API function See this for parameter documentation. |
|
Return true if the last query was successful. Return true if the most recent query was successful |