| 4814 | } |
| 4815 | |
| 4816 | bool |
| 4817 | Prepared_statement::execute_bulk_loop(String *expanded_query, |
| 4818 | bool open_cursor, |
| 4819 | uchar *packet_arg, |
| 4820 | uchar *packet_end_arg, |
| 4821 | bool send_unit_results) |
| 4822 | { |
| 4823 | Reprepare_observer reprepare_observer; |
| 4824 | unsigned char *readbuff= NULL; |
| 4825 | bool error= 0; |
| 4826 | packet= packet_arg; |
| 4827 | packet_end= packet_end_arg; |
| 4828 | iterations= TRUE; |
| 4829 | start_param= true; |
| 4830 | #ifdef DBUG_ASSERT_EXISTS |
| 4831 | Item *free_list_state= thd->free_list; |
| 4832 | #endif |
| 4833 | thd->set_bulk_execution((void *)this); |
| 4834 | /* Check if we got an error when sending long data */ |
| 4835 | if (state == Query_arena::STMT_ERROR) |
| 4836 | { |
| 4837 | my_message(last_errno, last_error, MYF(0)); |
| 4838 | goto err; |
| 4839 | } |
| 4840 | /* Check for non zero parameter count*/ |
| 4841 | if (param_count == 0) |
| 4842 | { |
| 4843 | DBUG_PRINT("error", ("Statement with no parameters for bulk execution.")); |
| 4844 | my_error(ER_UNSUPPORTED_PS, MYF(0)); |
| 4845 | goto err; |
| 4846 | } |
| 4847 | |
| 4848 | if (!(sql_command_flags() & CF_PS_ARRAY_BINDING_SAFE)) |
| 4849 | { |
| 4850 | DBUG_PRINT("error", ("Command is not supported in bulk execution.")); |
| 4851 | my_error(ER_UNSUPPORTED_PS, MYF(0)); |
| 4852 | goto err; |
| 4853 | } |
| 4854 | |
| 4855 | if (lex->needs_reprepare) |
| 4856 | { |
| 4857 | /* |
| 4858 | Something has happened on previous execution that requires us to |
| 4859 | re-prepare before we try to execute. |
| 4860 | */ |
| 4861 | lex->needs_reprepare= false; |
| 4862 | error= reprepare(); |
| 4863 | if (error) |
| 4864 | goto err; |
| 4865 | } |
| 4866 | |
| 4867 | if (send_unit_results && thd->init_collecting_unit_results()) |
| 4868 | { |
| 4869 | DBUG_PRINT("error", ("Error initializing array.")); |
| 4870 | return TRUE; |
| 4871 | } |
| 4872 | |
| 4873 | /* |
no test coverage detected