| 317 | */ |
| 318 | |
| 319 | static bool write_eof_packet(THD *thd, NET *net, |
| 320 | uint server_status, |
| 321 | uint statement_warn_count) |
| 322 | { |
| 323 | bool error; |
| 324 | if (thd->client_capabilities & CLIENT_PROTOCOL_41) |
| 325 | { |
| 326 | uchar buff[5]; |
| 327 | /* |
| 328 | Don't send warn count during SP execution, as the warn_list |
| 329 | is cleared between substatements, and mysqltest gets confused |
| 330 | */ |
| 331 | uint tmp= min(statement_warn_count, 65535U); |
| 332 | buff[0]= 254; |
| 333 | int2store(buff+1, tmp); |
| 334 | /* |
| 335 | The following test should never be true, but it's better to do it |
| 336 | because if 'is_fatal_error' is set the server is not going to execute |
| 337 | other queries (see the if test in dispatch_command / COM_QUERY) |
| 338 | */ |
| 339 | if (thd->is_fatal_error) |
| 340 | server_status&= ~SERVER_MORE_RESULTS_EXISTS; |
| 341 | int2store(buff + 3, server_status); |
| 342 | error= my_net_write(net, buff, 5); |
| 343 | } |
| 344 | else |
| 345 | error= my_net_write(net, eof_buff, 1); |
| 346 | |
| 347 | return error; |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | @param thd Thread handler |