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
class select_send :public select_result {
26
True if we have sent result set metadata to the client.
27
In this case the client always expects us to end the result
28
set with an eof or error packet
30
bool is_result_set_started;
32
select_send() :is_result_set_started(false) {}
36
We may be passing the control from mysqld to the client: release the
37
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
40
ha_release_temporary_latches(session);
42
/* Unlock tables before sending packet to gain some speed */
45
mysql_unlock_tables(session, session->lock);
49
is_result_set_started= 0;
53
bool send_fields(List<Item> &list, uint32_t flags)
56
if (!(res= session->protocol->sendFields(&list, flags)))
57
is_result_set_started= 1;
68
Cleanup an instance of this class for re-use
69
at next execution of a prepared statement/
70
stored procedure statement.
73
virtual void cleanup()
75
is_result_set_started= false;
78
/* Send data to client. Returns 0 if ok */
80
bool send_data(List<Item> &items)
82
if (unit->offset_limit_cnt)
83
{ // using limit offset,count
84
unit->offset_limit_cnt--;
89
We may be passing the control from mysqld to the client: release the
90
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
93
ha_release_temporary_latches(session);
95
List_iterator_fast<Item> li(items);
96
Protocol *protocol= session->protocol;
97
char buff[MAX_FIELD_WIDTH];
98
String buffer(buff, sizeof(buff), &my_charset_bin);
100
protocol->prepareForResend();
104
if (item->send(protocol, &buffer))
106
protocol->free(); // Free used buffer
107
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
111
session->sent_row_count++;
112
if (session->is_error())
114
if (protocol->isConnected())
115
return(protocol->write());
120
#endif /* DRIZZLED_SELECT_SEND_H */