@@ -112,11 +112,18 @@ void spectrum_thread_fill(THD *thd, spectrum::Thread *spectrum_thread) {
112112 spectrum_thread_fill_system_variables (thd, spectrum_thread);
113113}
114114
115- void spectrum_print_row (char * method, TABLE* table) {
115+ void spectrum_repoint_field_to_record (TABLE *table, const uchar *old_rec, const uchar *new_rec) {
116+ Field **fields = table->field ;
117+ ptrdiff_t ptrdiff = new_rec - old_rec;
118+ for (uint i = 0 ; i < table->s ->fields ; i++)
119+ fields[i]->move_field_offset (ptrdiff);
120+ }
121+
122+ void spectrum_print_row (const char * method, TABLE* table) {
116123 spectrum_print_row (method, table, table->record [0 ]);
117124}
118125
119- void spectrum_print_row (char * method, TABLE* table, uchar* record) {
126+ void spectrum_print_row (const char * method, TABLE* table, const uchar* record) {
120127 std::string row;
121128 char value_buffer[1024 ];
122129 String value (value_buffer, sizeof (value_buffer), &my_charset_bin);
@@ -130,7 +137,7 @@ void spectrum_print_row(char* method, TABLE* table, uchar* record) {
130137
131138 temp_read_set = table->read_set ;
132139 table->read_set = nullptr ;
133- repoint_field_to_record (table, table->record [0 ], record);
140+ spectrum_repoint_field_to_record (table, table->record [0 ], record);
134141
135142 for (Field **field = table->field ; *field; field++) {
136143 row += (*field)->field_name ;
@@ -148,19 +155,19 @@ void spectrum_print_row(char* method, TABLE* table, uchar* record) {
148155 }
149156 sql_print_information (" %s[%s:%s:%d]: %s" , method, table->s ->db .str , table->s ->table_name .str , hander_id, row.c_str ());
150157
151- repoint_field_to_record (table, record, table->record [0 ]);
158+ spectrum_repoint_field_to_record (table, record, table->record [0 ]);
152159 table->read_set = temp_read_set;
153160}
154161
155162void spectrum_row_fill_fields (TABLE* table, spectrum::Row *spectrum_row) {
156163 spectrum_row_fill_fields (table, table->record [0 ], spectrum_row);
157164}
158165
159- void spectrum_row_fill_fields (TABLE* table, uchar* record, spectrum::Row *spectrum_row) {
166+ void spectrum_row_fill_fields (TABLE* table, const uchar* record, spectrum::Row *spectrum_row) {
160167 char value_buffer[1024 ];
161168 String value (value_buffer, sizeof (value_buffer), &my_charset_bin);
162169
163- repoint_field_to_record (table, table->record [0 ], record);
170+ spectrum_repoint_field_to_record (table, table->record [0 ], record);
164171
165172 for (Field **field = table->field ; *field; field++) {
166173 spectrum::Field *spectrum_field = spectrum_row->add_fields ();
@@ -174,19 +181,19 @@ void spectrum_row_fill_fields(TABLE* table, uchar* record, spectrum::Row *spectr
174181 }
175182 }
176183
177- repoint_field_to_record (table, record, table->record [0 ]);
184+ spectrum_repoint_field_to_record (table, record, table->record [0 ]);
178185}
179186
180- void spectrum_row_extract_fields (TABLE *table, spectrum::Row *spectrum_row) {
187+ void spectrum_row_extract_fields (TABLE *table, const spectrum::Row *spectrum_row) {
181188 spectrum_row_extract_fields (table, table->record [0 ], spectrum_row);
182189}
183190
184- void spectrum_row_extract_fields (TABLE *table, uchar* record, spectrum::Row *spectrum_row) {
191+ void spectrum_row_extract_fields (TABLE *table, uchar* record, const spectrum::Row *spectrum_row) {
185192 MY_BITMAP *temp_write_set;
186193
187194 temp_write_set = table->write_set ;
188195 table->write_set = nullptr ;
189- repoint_field_to_record (table, table->record [0 ], record);
196+ spectrum_repoint_field_to_record (table, table->record [0 ], record);
190197
191198 memset (record, 0 , table->s ->null_bytes );
192199 for (int i = 0 ; i < spectrum_row->fields ().size (); i++) {
@@ -204,7 +211,7 @@ void spectrum_row_extract_fields(TABLE *table, uchar* record, spectrum::Row *spe
204211 }
205212
206213 table->write_set = temp_write_set;
207- repoint_field_to_record (table, record, table->record [0 ]);
214+ spectrum_repoint_field_to_record (table, record, table->record [0 ]);
208215}
209216
210217TABLE *spectrum_open_table (
0 commit comments