Template for reset_all_backends()

v2.x_pg_PrepStmtBase_240714
Rene Cannao 2 years ago
parent 7563659198
commit 80928395cc

@ -112,6 +112,7 @@ class Base_Session {
virtual void RequestEnd(DS *) = 0;
virtual void SQLite3_to_MySQL(SQLite3_result*, char*, int, MySQL_Protocol*, bool in_transaction = false, bool deprecate_eof_active = false) = 0;
bool has_any_backend();
void reset_all_backends();
};
#endif // CLASS_BASE_SESSION_H

@ -416,7 +416,7 @@ class MySQL_Session: public Base_Session<MySQL_Session, MySQL_Data_Stream, MySQL
int FindOneActiveTransaction(bool check_savepoint=false);
unsigned long long IdleTime();
void reset_all_backends();
//void reset_all_backends();
//void writeout();
void Memory_Stats();
void create_new_session_and_reset_connection(MySQL_Data_Stream *_myds);

@ -394,7 +394,7 @@ public:
int FindOneActiveTransaction(bool check_savepoint = false);
unsigned long long IdleTime();
void reset_all_backends();
//void reset_all_backends();
//void writeout();
void Memory_Stats();
void create_new_session_and_reset_connection(PgSQL_Data_Stream* _myds);

@ -48,6 +48,9 @@ template void Base_Session<PgSQL_Session, PgSQL_Data_Stream, PgSQL_Backend, PgSQ
template bool Base_Session<MySQL_Session, MySQL_Data_Stream, MySQL_Backend, MySQL_Thread>::has_any_backend();
template bool Base_Session<PgSQL_Session, PgSQL_Data_Stream, PgSQL_Backend, PgSQL_Thread>::has_any_backend();
template void Base_Session<MySQL_Session, MySQL_Data_Stream, MySQL_Backend, MySQL_Thread>::reset_all_backends();
template void Base_Session<PgSQL_Session, PgSQL_Data_Stream, PgSQL_Backend, PgSQL_Thread>::reset_all_backends();
template<typename S, typename DS, typename B, typename T>
Base_Session<S,DS,B,T>::Base_Session() {
};
@ -347,3 +350,23 @@ bool Base_Session<S,DS,B,T>::has_any_backend() {
}
return false;
}
/**
* @brief Reset all MySQL backends associated with this session.
*
* This function resets all MySQL backends associated with the current session.
* It iterates over all backends stored in the session, resets each backend, and then deletes it.
*
*/
template<typename S, typename DS, typename B, typename T>
void Base_Session<S,DS,B,T>::reset_all_backends() {
B *mybe;
while(mybes->len) {
mybe=(B *)mybes->remove_index_fast(0);
mybe->reset();
delete mybe;
}
};

@ -822,6 +822,7 @@ void MySQL_Session::update_expired_conns(const vector<function<bool(MySQL_Connec
}
}
#if 0
/**
* @brief Reset all MySQL backends associated with this session.
*
@ -838,7 +839,6 @@ void MySQL_Session::reset_all_backends() {
}
};
#if 0
/**
* @brief Writes data from the session to the network with optional throttling and flow control.
*

@ -732,6 +732,7 @@ void PgSQL_Session::update_expired_conns(const vector<function<bool(PgSQL_Connec
}
}
#if 0
void PgSQL_Session::reset_all_backends() {
PgSQL_Backend* mybe;
while (mybes->len) {
@ -741,7 +742,6 @@ void PgSQL_Session::reset_all_backends() {
}
};
#if 0
void PgSQL_Session::writeout() {
int tps = 10; // throttling per second , by default every 100ms
int total_written = 0;

Loading…
Cancel
Save