Expose MySQL connection state
This commit is contained in:
@@ -71,6 +71,14 @@ inline MySQL* mysql_connect(String host = "localhost", String username = "root",
|
||||
return(db);
|
||||
}
|
||||
|
||||
// A failed connection retains a request-owned wrapper so mysql_error() remains
|
||||
// available. Callers that need to decide whether to issue work must test the
|
||||
// connection state rather than only the wrapper pointer.
|
||||
inline bool mysql_connected(MySQL* m)
|
||||
{
|
||||
return(m != 0 && m->connection != 0);
|
||||
}
|
||||
|
||||
inline void mysql_disconnect(MySQL* m)
|
||||
{
|
||||
if(!m)
|
||||
|
||||
Reference in New Issue
Block a user