1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_SELECT_SEND_H
22
#define DRIZZLED_SELECT_SEND_H
24
#include <drizzled/plugin/client.h>
26
class select_send :public select_result {
28
True if we have sent result set metadata to the client.
29
In this case the client always expects us to end the result
30
set with an eof or error packet
32
bool is_result_set_started;
34
select_send() :is_result_set_started(false) {}
38
We may be passing the control from mysqld to the client: release the
39
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
42
ha_release_temporary_latches(session);
44
/* Unlock tables before sending packet to gain some speed */
47
mysql_unlock_tables(session, session->lock);
51
is_result_set_started= 0;
55
bool send_fields(List<Item> &list)
58
if (! (res= session->client->sendFields(&list)))
59
is_result_set_started= 1;
70
Cleanup an instance of this class for re-use
71
at next execution of a prepared statement/
72
stored procedure statement.
75
virtual void cleanup()
77
is_result_set_started= false;
80
/* Send data to client. Returns 0 if ok */
82
bool send_data(List<Item> &items)
84
if (unit->offset_limit_cnt)
85
{ // using limit offset,count
86
unit->offset_limit_cnt--;
91
We may be passing the control from mysqld to the client: release the
92
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
95
ha_release_temporary_latches(session);
97
List_iterator_fast<Item> li(items);
98
char buff[MAX_FIELD_WIDTH];
99
String buffer(buff, sizeof(buff), &my_charset_bin);
104
if (item->send(session->client, &buffer))
106
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
110
session->sent_row_count++;
111
if (session->is_error())
113
return session->client->flush();
117
#endif /* DRIZZLED_SELECT_SEND_H */