Removed leftover MySQL prepared statement code

v3.0_4799_4827
Rahim Kanji 1 year ago
parent a22936164b
commit ac64bd5d21

@ -321,13 +321,7 @@ class PgSQL_Connection_Placeholder {
bool no_backslash_escapes;
} options;
struct {
unsigned long length;
char *ptr;
MYSQL_STMT *stmt;
MYSQL_RES *stmt_result;
stmt_execute_metadata_t *stmt_meta;
} query;
@ -360,7 +354,7 @@ public:
int async_connect(short event);
int async_query(short event, char* stmt, unsigned long length, MYSQL_STMT** _stmt = NULL, stmt_execute_metadata_t* _stmt_meta = NULL);
int async_query(short event, char* stmt, unsigned long length);
int async_ping(short event);
int async_reset_session(short event);
int async_send_simple_command(short event, char* stmt, unsigned long length); // no result set expected
@ -526,6 +520,10 @@ public:
void set_query(char* stmt, unsigned long length);
void reset();
struct {
unsigned long length;
char* ptr;
} query;
struct {
char* hostname;

@ -258,15 +258,8 @@ PgSQL_Connection_Placeholder::PgSQL_Connection_Placeholder() {
options.ldap_user_variable_sent=false;
options.session_track_gtids_int=0;
query.ptr=NULL;
query.length=0;
query.stmt=NULL;
query.stmt_meta=NULL;
query.stmt_result=NULL;
local_stmts=new MySQL_STMTs_local_v14(false); // false by default, it is a backend
@ -285,9 +278,7 @@ PgSQL_Connection_Placeholder::~PgSQL_Connection_Placeholder() {
}
if (query.stmt) {
query.stmt=NULL;
}
if (options.session_track_gtids) {
free(options.session_track_gtids);
@ -431,6 +422,8 @@ PgSQL_Connection::PgSQL_Connection() {
last_time_used = 0;
creation_time = 0;
auto_increment_delay_token = 0;
query.ptr = NULL;
query.length = 0;
userinfo = new PgSQL_Connection_userinfo();
for (int i = 0; i < PGSQL_NAME_LAST_HIGH_WM; i++) {
@ -1352,10 +1345,6 @@ void PgSQL_Connection::async_free_result() {
query.ptr = NULL;
query.length = 0;
}
if (query.stmt_result) {
mysql_free_result(query.stmt_result);
query.stmt_result = NULL;
}
if (userinfo) {
// if userinfo is NULL , the connection is being destroyed
// because it is reset on destructor ( ~PgSQL_Connection() )
@ -1423,7 +1412,7 @@ bool PgSQL_Connection::IsAutoCommit() {
// 0 when the query is completed
// 1 when the query is not completed
// the calling function should check pgsql error in pgsql struct
int PgSQL_Connection::async_query(short event, char* stmt, unsigned long length, MYSQL_STMT** _stmt, stmt_execute_metadata_t* stmt_meta) {
int PgSQL_Connection::async_query(short event, char* stmt, unsigned long length) {
PROXY_TRACE();
PROXY_TRACE2();
assert(pgsql_conn);
@ -1451,21 +1440,9 @@ int PgSQL_Connection::async_query(short event, char* stmt, unsigned long length,
myds->sess->transaction_started_at = myds->sess->thread->curtime;
}
}
if (stmt_meta == NULL)
set_query(stmt, length);
set_query(stmt, length);
async_state_machine = ASYNC_QUERY_START;
if (_stmt) {
query.stmt = *_stmt;
if (stmt_meta == NULL) {
async_state_machine = ASYNC_STMT_PREPARE_START;
}
else {
if (query.stmt_meta == NULL) {
query.stmt_meta = stmt_meta;
}
async_state_machine = ASYNC_STMT_EXECUTE_START;
}
}
default:
handler(event);
break;
@ -1481,29 +1458,6 @@ int PgSQL_Connection::async_query(short event, char* stmt, unsigned long length,
return 0;
}
}
if (async_state_machine == ASYNC_STMT_EXECUTE_END) {
PROXY_TRACE2();
query.stmt_meta = NULL;
async_state_machine = ASYNC_QUERY_END;
compute_unknown_transaction_status();
if (mysql_stmt_errno(query.stmt)) {
return -1;
}
else {
return 0;
}
}
if (async_state_machine == ASYNC_STMT_PREPARE_SUCCESSFUL || async_state_machine == ASYNC_STMT_PREPARE_FAILED) {
query.stmt_meta = NULL;
compute_unknown_transaction_status();
if (async_state_machine == ASYNC_STMT_PREPARE_FAILED) {
return -1;
}
else {
*_stmt = query.stmt;
return 0;
}
}
if (async_state_machine == ASYNC_USE_RESULT_START) {
// if we reached this point it measn we are processing a multi-statement
// and we need to exit to give control to MySQL_Session
@ -2327,7 +2281,4 @@ void PgSQL_Connection::set_query(char* stmt, unsigned long length) {
if (length > largest_query_length) {
largest_query_length = length;
}
if (query.stmt) {
query.stmt = NULL;
}
}

@ -3119,12 +3119,13 @@ __get_pkts_from_client:
handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY___not_mysql(pkt);
}
break;
case _MYSQL_COM_STMT_PREPARE:
/*case _MYSQL_COM_STMT_PREPARE:
handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_STMT_PREPARE(pkt);
break;
case _MYSQL_COM_STMT_EXECUTE:
handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_STMT_EXECUTE(pkt);
break;
*/
default:
// in this switch we only handle the most common commands.
// The not common commands are handled by "default" , that
@ -3398,13 +3399,14 @@ int PgSQL_Session::RunQuery(PgSQL_Data_Stream* myds, PgSQL_Connection* myconn) {
case PROCESSING_QUERY:
rc = myconn->async_query(myds->revents, myds->mysql_real_query.QueryPtr, myds->mysql_real_query.QuerySize);
break;
case PROCESSING_STMT_PREPARE:
/*case PROCESSING_STMT_PREPARE:
rc = myconn->async_query(myds->revents, (char*)CurrentQuery.QueryPointer, CurrentQuery.QueryLength, &CurrentQuery.mysql_stmt);
break;
case PROCESSING_STMT_EXECUTE:
PROXY_TRACE2();
rc = myconn->async_query(myds->revents, (char*)CurrentQuery.QueryPointer, CurrentQuery.QueryLength, &CurrentQuery.mysql_stmt, CurrentQuery.stmt_meta);
break;
*/
default:
// LCOV_EXCL_START
assert(0);
@ -3527,8 +3529,8 @@ handler_again:
}
break;
case PROCESSING_STMT_PREPARE:
case PROCESSING_STMT_EXECUTE:
//case PROCESSING_STMT_PREPARE:
//case PROCESSING_STMT_EXECUTE:
case PROCESSING_QUERY:
//fprintf(stderr,"PROCESSING_QUERY\n");
if (pause_until > thread->curtime) {
@ -3644,7 +3646,7 @@ handler_again:
}
}
}
if (status == PROCESSING_STMT_EXECUTE) {
/*if (status == PROCESSING_STMT_EXECUTE) {
CurrentQuery.mysql_stmt = myconn->local_stmts->find_backend_stmt_by_global_id(CurrentQuery.stmt_global_id);
if (CurrentQuery.mysql_stmt == NULL) {
MySQL_STMT_Global_info* stmt_info = NULL;
@ -3665,7 +3667,7 @@ handler_again:
PROXY_TRACE();
}
}
}
}*/
}
}
@ -5869,10 +5871,11 @@ void PgSQL_Session::RequestEnd(PgSQL_Data_Stream* myds) {
}
switch (status) {
case PROCESSING_STMT_EXECUTE:
/*case PROCESSING_STMT_EXECUTE:
case PROCESSING_STMT_PREPARE:
// if a prepared statement is executed, LogQuery was already called
break;
*/
default:
if (session_fast_forward == SESSION_FORWARD_TYPE_NONE) {
LogQuery(myds);
@ -6253,7 +6256,7 @@ void PgSQL_Session::set_previous_status_mode3(bool allow_execute) {
case PROCESSING_QUERY:
previous_status.push(PROCESSING_QUERY);
break;
case PROCESSING_STMT_PREPARE:
/*case PROCESSING_STMT_PREPARE:
previous_status.push(PROCESSING_STMT_PREPARE);
break;
case PROCESSING_STMT_EXECUTE:
@ -6261,6 +6264,7 @@ void PgSQL_Session::set_previous_status_mode3(bool allow_execute) {
previous_status.push(PROCESSING_STMT_EXECUTE);
break;
}
*/
default:
// LCOV_EXCL_START
assert(0); // Assert to indicate an unexpected status value

Loading…
Cancel
Save