Replaced the use of the shared MySQLSession structure with an internal variable
that tracks the currently active database.
This commit is contained in:
Markus Makela
2015-10-29 20:24:26 +02:00
parent 18c53bebf1
commit d5c38b93f6
6 changed files with 27 additions and 56 deletions

View File

@ -100,17 +100,17 @@ void create_error_reply(char* fail_str,DCB* dcb)
}
/**
* Read new database name from MYSQL_COM_INIT_DB packet or a literal USE ... COM_QUERY packet, check that it exists
* in the hashtable and copy its name to MYSQL_session.
* Read new database name from MYSQL_COM_INIT_DB packet or a literal USE ... COM_QUERY
* packet, check that it exists in the hashtable and copy its name to MYSQL_session.
*
* @param mysql_session The MySQL session structure
* @param dest Destination where the database name will be written
* @param dbhash Hashtable containing valid databases
* @param buf Buffer containing the database change query
*
* @return true if new database is set, false if non-existent database was tried
* to be set
*/
bool change_current_db(MYSQL_session* mysql_session,
bool change_current_db(char* dest,
HASHTABLE* dbhash,
GWBUF* buf)
{
@ -139,7 +139,7 @@ bool change_current_db(MYSQL_session* mysql_session,
}
else
{
strncpy(mysql_session->db,db,MYSQL_DATABASE_MAXLEN);
strncpy(dest,db,MYSQL_DATABASE_MAXLEN);
skygw_log_write(LOGFILE_TRACE,"change_current_db: database is on server: '%s'.",target);
succp = true;
goto retblock;