Expose MySQL connection state
This commit is contained in:
@@ -11,7 +11,7 @@ return value : pointer to the MySQL connection struct
|
||||
>mysql
|
||||
|
||||
:content
|
||||
Establishes a connection to a MySQL server and returns a pointer to the connection struct.
|
||||
Establishes a connection to a MySQL server and returns a request-owned pointer to the connection struct. A failed connection also returns a wrapper so that `mysql_error()` can report the failure; use `mysql_connected()` before issuing optional work that requires a live server handle.
|
||||
|
||||
This connection handle is then used with helpers such as `mysql_query()`, `mysql_error()`, and `mysql_disconnect()`.
|
||||
|
||||
@@ -19,5 +19,5 @@ MySQL handles are request-scoped framework resources. Repeated `mysql_connect()`
|
||||
|
||||
:example
|
||||
MySQL* db = mysql_connect();
|
||||
print(db != 0 ? "connected to MySQL" : "no MySQL server reachable with these credentials", "\n");
|
||||
print(mysql_connected(db) ? "connected to MySQL" : "no MySQL server reachable with these credentials", "\n");
|
||||
if(db != 0) mysql_disconnect(db);
|
||||
|
||||
Reference in New Issue
Block a user