177
177
buff[0]=0; // No fields
178
178
pos=net_store_length(buff+1,affected_rows);
179
179
pos=net_store_length(pos, id);
180
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
182
int2store(pos, server_status);
185
/* We can only return up to 65535 warnings in two bytes */
186
uint tmp= min(total_warn_count, 65535);
190
else if (net->return_status) // For 4.0 protocol
192
int2store(pos, server_status);
181
int2store(pos, server_status);
184
/* We can only return up to 65535 warnings in two bytes */
185
uint tmp= min(total_warn_count, 65535);
195
189
thd->main_da.can_overwrite_status= true;
197
191
if (message && message[0])
250
242
uint server_status,
251
243
uint total_warn_count)
253
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
257
Don't send warn count during SP execution, as the warn_list
258
is cleared between substatements, and mysqltest gets confused
260
uint tmp= min(total_warn_count, 65535);
262
int2store(buff+1, tmp);
264
The following test should never be true, but it's better to do it
265
because if 'is_fatal_error' is set the server is not going to execute
266
other queries (see the if test in dispatch_command / COM_QUERY)
268
if (thd->is_fatal_error)
269
server_status&= ~SERVER_MORE_RESULTS_EXISTS;
270
int2store(buff + 3, server_status);
271
VOID(my_net_write(net, buff, 5));
274
VOID(my_net_write(net, eof_buff, 1));
247
Don't send warn count during SP execution, as the warn_list
248
is cleared between substatements, and mysqltest gets confused
250
uint tmp= min(total_warn_count, 65535);
251
buff[0]= DRIZZLE_PROTOCOL_NO_MORE_DATA;
252
int2store(buff+1, tmp);
254
The following test should never be true, but it's better to do it
255
because if 'is_fatal_error' is set the server is not going to execute
256
other queries (see the if test in dispatch_command / COM_QUERY)
258
if (thd->is_fatal_error)
259
server_status&= ~SERVER_MORE_RESULTS_EXISTS;
260
int2store(buff + 3, server_status);
261
VOID(my_net_write(net, buff, 5));
277
264
void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
526
512
prot.prepare_for_resend();
528
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
515
if (prot.store(STRING_WITH_LEN("def"), cs, thd_charset) ||
516
prot.store(field.db_name, (uint) strlen(field.db_name),
518
prot.store(field.table_name, (uint) strlen(field.table_name),
520
prot.store(field.org_table_name, (uint) strlen(field.org_table_name),
522
prot.store(field.col_name, (uint) strlen(field.col_name),
524
prot.store(field.org_col_name, (uint) strlen(field.org_col_name),
526
local_packet->realloc(local_packet->length()+12))
529
/* Store fixed length fields */
530
pos= (char*) local_packet->ptr()+local_packet->length();
531
*pos++= 12; // Length of packed fields
532
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
530
if (prot.store(STRING_WITH_LEN("def"), cs, thd_charset) ||
531
prot.store(field.db_name, (uint) strlen(field.db_name),
533
prot.store(field.table_name, (uint) strlen(field.table_name),
535
prot.store(field.org_table_name, (uint) strlen(field.org_table_name),
537
prot.store(field.col_name, (uint) strlen(field.col_name),
539
prot.store(field.org_col_name, (uint) strlen(field.org_col_name),
541
local_packet->realloc(local_packet->length()+12))
543
/* Store fixed length fields */
544
pos= (char*) local_packet->ptr()+local_packet->length();
545
*pos++= 12; // Length of packed fields
546
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
549
int2store(pos, field.charsetnr);
550
int4store(pos+2, field.length);
554
/* With conversion */
556
int2store(pos, thd_charset->number);
558
For TEXT/BLOB columns, field_length describes the maximum data
559
length in bytes. There is no limit to the number of characters
560
that a TEXT column can store, as long as the data fits into
561
the designated space.
562
For the rest of textual columns, field_length is evaluated as
563
char_count * mbmaxlen, where character count is taken from the
564
definition of the column. In other words, the maximum number
565
of characters here is limited by the column definition.
567
max_char_len= field.length / item->collation.collation->mbmaxlen;
568
int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
571
int2store(pos+7,field.flags);
572
pos[9]= (char) field.decimals;
573
pos[10]= 0; // For the future
574
pos[11]= 0; // For the future
535
int2store(pos, field.charsetnr);
536
int4store(pos+2, field.length);
579
if (prot.store(field.table_name, (uint) strlen(field.table_name),
581
prot.store(field.col_name, (uint) strlen(field.col_name),
583
local_packet->realloc(local_packet->length()+10))
585
pos= (char*) local_packet->ptr()+local_packet->length();
540
/* With conversion */
542
int2store(pos, thd_charset->number);
544
For TEXT/BLOB columns, field_length describes the maximum data
545
length in bytes. There is no limit to the number of characters
546
that a TEXT column can store, as long as the data fits into
547
the designated space.
548
For the rest of textual columns, field_length is evaluated as
549
char_count * mbmaxlen, where character count is taken from the
550
definition of the column. In other words, the maximum number
551
of characters here is limited by the column definition.
553
max_char_len= field.length / item->collation.collation->mbmaxlen;
554
int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
557
int2store(pos+7,field.flags);
558
pos[9]= (char) field.decimals;
559
pos[10]= 0; // For the future
560
pos[11]= 0; // For the future
588
int3store(pos+1,field.length);
592
int2store(pos+7,field.flags);
593
pos[9]= (char) field.decimals;
596
563
local_packet->length((uint) (pos - local_packet->ptr()));
597
564
if (flags & SEND_DEFAULTS)
598
565
item->send(&prot, &tmp); // Send default value