Abstract the session default database

The default database can now be manipulated with a set of functions
exposed by the maxscale/protocol/mysql.h header. This removes the need to
handle the structures themselves in the modules and is a step towards
moving the dcb->data contents inside the session.
This commit is contained in:
Markus Mäkelä
2017-06-13 12:33:50 +03:00
parent 93660c19ed
commit bd7a26d830
11 changed files with 66 additions and 45 deletions

View File

@ -485,4 +485,23 @@ mysql_server_cmd_t mxs_mysql_current_command(MXS_SESSION* session);
void mysql_num_response_packets(GWBUF *buf, uint8_t cmd,
int* npackets, size_t *nbytes);
/**
* @brief Return current database of the session
*
* If no active database is in use, the database is an empty string.
*
* @param session Session to inspect
*
* @return The current database
*/
const char* mxs_mysql_get_current_db(MXS_SESSION* session);
/**
* @brief Set the currently active database for a session
*
* @param session Session to modify
* @param db The new database
*/
void mxs_mysql_set_current_db(MXS_SESSION* session, const char* db);
MXS_END_DECLS