@@ -2582,6 +2582,13 @@ void PgSQL_Session::handler_minus1_HandleBackendConnection(PgSQL_Data_Stream* my
25822582 }
25832583}
25842584
2585+ inline void build_backend_stmt_name (char * buf, unsigned int stmt_backend_id) {
2586+ char * p = buf;
2587+ const char * prefix = PROXYSQL_PS_PREFIX;
2588+ while (*prefix) *p++ = *prefix++;
2589+ p = fast_uint32toa (stmt_backend_id, p);
2590+ }
2591+
25852592// this function was inline
25862593int PgSQL_Session::RunQuery (PgSQL_Data_Stream* myds, PgSQL_Connection* myconn) {
25872594 PROXY_TRACE2 ();
@@ -2599,9 +2606,10 @@ int PgSQL_Session::RunQuery(PgSQL_Data_Stream* myds, PgSQL_Connection* myconn) {
25992606 this , myconn, myconn->pgsql_conn , backend_stmt_id);
26002607 }
26012608 // this is used to generate the name of the prepared statement in the backend
2602- const std::string& backend_stmt_name = std::string (PROXYSQL_PS_PREFIX) + std::to_string (CurrentQuery.extended_query_info .stmt_backend_id );
2609+ char backend_stmt_name[32 ];
2610+ build_backend_stmt_name (backend_stmt_name, CurrentQuery.extended_query_info .stmt_backend_id );
26032611 rc = myconn->async_query (myds->revents , (char *)CurrentQuery.QueryPointer , CurrentQuery.QueryLength ,
2604- backend_stmt_name. c_str () , PGSQL_EXTENDED_QUERY_TYPE_PARSE, &CurrentQuery.extended_query_info );
2612+ backend_stmt_name, PGSQL_EXTENDED_QUERY_TYPE_PARSE, &CurrentQuery.extended_query_info );
26052613 }
26062614 break ;
26072615 case PROCESSING_STMT_DESCRIBE:
@@ -2610,9 +2618,10 @@ int PgSQL_Session::RunQuery(PgSQL_Data_Stream* myds, PgSQL_Connection* myconn) {
26102618 {
26112619 PgSQL_Extended_Query_Type type =
26122620 (status == PROCESSING_STMT_DESCRIBE) ? PGSQL_EXTENDED_QUERY_TYPE_DESCRIBE : PGSQL_EXTENDED_QUERY_TYPE_EXECUTE;
2613- const std::string& backend_stmt_name =
2614- std::string (PROXYSQL_PS_PREFIX) + std::to_string (CurrentQuery.extended_query_info .stmt_backend_id );
2615- rc = myconn->async_query (myds->revents , nullptr , 0 , backend_stmt_name.c_str (), type, &CurrentQuery.extended_query_info );
2621+
2622+ char backend_stmt_name[32 ];
2623+ build_backend_stmt_name (backend_stmt_name, CurrentQuery.extended_query_info .stmt_backend_id );
2624+ rc = myconn->async_query (myds->revents , nullptr , 0 , backend_stmt_name, type, &CurrentQuery.extended_query_info );
26162625 }
26172626 break ;
26182627/* case PROCESSING_STMT_EXECUTE:
0 commit comments