| 3529 | |
| 3530 | |
| 3531 | static my_bool cli_read_query_result(MYSQL *mysql) |
| 3532 | { |
| 3533 | uchar *pos; |
| 3534 | ulong field_count; |
| 3535 | MYSQL_DATA *fields; |
| 3536 | ulong length; |
| 3537 | #ifdef MYSQL_CLIENT |
| 3538 | my_bool can_local_infile= mysql->auto_local_infile != WAIT_FOR_QUERY; |
| 3539 | #endif |
| 3540 | DBUG_ENTER("cli_read_query_result"); |
| 3541 | |
| 3542 | if (mysql->auto_local_infile == ACCEPT_FILE_REQUEST) |
| 3543 | mysql->auto_local_infile= WAIT_FOR_QUERY; |
| 3544 | |
| 3545 | if ((length = cli_safe_read(mysql)) == packet_error) |
| 3546 | DBUG_RETURN(1); |
| 3547 | free_old_query(mysql); /* Free old result */ |
| 3548 | #ifdef MYSQL_CLIENT /* Avoid warn of unused labels*/ |
| 3549 | get_info: |
| 3550 | #endif |
| 3551 | pos= mysql->net.read_pos; |
| 3552 | if ((field_count= net_field_length(&pos)) == 0) |
| 3553 | DBUG_RETURN(parse_ok_packet(mysql, length)); |
| 3554 | |
| 3555 | #ifdef MYSQL_CLIENT |
| 3556 | if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */ |
| 3557 | { |
| 3558 | int error; |
| 3559 | |
| 3560 | if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES) || |
| 3561 | !can_local_infile) |
| 3562 | { |
| 3563 | set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); |
| 3564 | DBUG_RETURN(1); |
| 3565 | } |
| 3566 | |
| 3567 | error= handle_local_infile(mysql,(char*) pos); |
| 3568 | if ((length= cli_safe_read(mysql)) == packet_error || error) |
| 3569 | DBUG_RETURN(1); |
| 3570 | goto get_info; /* Get info packet */ |
| 3571 | } |
| 3572 | #endif |
| 3573 | if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) |
| 3574 | mysql->server_status|= SERVER_STATUS_IN_TRANS; |
| 3575 | |
| 3576 | if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5))) |
| 3577 | DBUG_RETURN(1); |
| 3578 | if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc, |
| 3579 | (uint) field_count,0, |
| 3580 | mysql->server_capabilities))) |
| 3581 | DBUG_RETURN(1); |
| 3582 | mysql->status= MYSQL_STATUS_GET_RESULT; |
| 3583 | mysql->field_count= (uint) field_count; |
| 3584 | DBUG_PRINT("exit",("ok")); |
| 3585 | DBUG_RETURN(0); |
| 3586 | } |
| 3587 | |
| 3588 |
nothing calls this directly
no test coverage detected