@@ -133,6 +133,7 @@ void *StmtLongDataHandler::get(uint32_t _stmt_id, uint16_t _param_id,
133
133
MySQL_STMT_Global_info::MySQL_STMT_Global_info (uint64_t id,
134
134
char *u, char *s, char *q,
135
135
unsigned int ql,
136
+ char *fc,
136
137
MYSQL_STMT *stmt, uint64_t _h) {
137
138
pthread_rwlock_init (&rwlock_, NULL );
138
139
statement_id = id;
@@ -145,6 +146,11 @@ MySQL_STMT_Global_info::MySQL_STMT_Global_info(uint64_t id,
145
146
memcpy (query, q, ql);
146
147
query[ql] = ' \0 ' ; // add NULL byte
147
148
query_length = ql;
149
+ if (fc) {
150
+ first_comment = strdup (fc);
151
+ } else {
152
+ first_comment = NULL ;
153
+ }
148
154
MyComQueryCmd = MYSQL_COM_QUERY__UNINITIALIZED;
149
155
num_params = stmt->param_count ;
150
156
num_columns = stmt->field_count ;
@@ -476,6 +482,9 @@ MySQL_STMT_Global_info::~MySQL_STMT_Global_info() {
476
482
free (username);
477
483
free (schemaname);
478
484
free (query);
485
+ if (first_comment) {
486
+ free (first_comment);
487
+ }
479
488
if (num_columns) {
480
489
uint16_t i;
481
490
for (i = 0 ; i < num_columns; i++) {
@@ -812,10 +821,10 @@ bool MySQL_STMTs_local_v14::client_close(uint32_t client_statement_id) {
812
821
813
822
MySQL_STMT_Global_info *MySQL_STMT_Manager_v14::add_prepared_statement (
814
823
char *u, char *s, char *q, unsigned int ql,
815
- MYSQL_STMT *stmt, bool lock) {
824
+ char *fc, MYSQL_STMT *stmt, bool lock) {
816
825
MySQL_STMT_Global_info *ret = NULL ;
817
826
uint64_t hash = stmt_compute_hash (
818
- u, s, q, ql); // this identifies the prepared statement
827
+ u, s, q, ql); // this identifies the prepared statement
819
828
if (lock) {
820
829
pthread_rwlock_wrlock (&rwlock_);
821
830
}
@@ -847,7 +856,7 @@ MySQL_STMT_Global_info *MySQL_STMT_Manager_v14::add_prepared_statement(
847
856
848
857
// next_statement_id++;
849
858
MySQL_STMT_Global_info *a =
850
- new MySQL_STMT_Global_info (next_id, u, s, q, ql, stmt, hash);
859
+ new MySQL_STMT_Global_info (next_id, u, s, q, ql, fc, stmt, hash);
851
860
// insert it in both maps
852
861
map_stmt_id_to_info.insert (std::make_pair (a->statement_id , a));
853
862
map_stmt_hash_to_info.insert (std::make_pair (a->hash , a));
0 commit comments