21
21
#ifndef DRIZZLED_SELECT_SEND_H
22
22
#define DRIZZLED_SELECT_SEND_H
24
#include <drizzled/plugin/client.h>
25
#include <drizzled/plugin/query_cache.h>
26
#include <drizzled/plugin/transactional_storage_engine.h>
31
24
class select_send :public select_result {
33
26
True if we have sent result set metadata to the client.
44
37
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
47
plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
40
ha_release_temporary_latches(session);
49
42
/* Unlock tables before sending packet to gain some speed */
52
session->unlockTables(session->lock);
45
mysql_unlock_tables(session, session->lock);
60
bool send_fields(List<Item> &list)
53
bool send_fields(List<Item> &list, uint32_t flags)
63
if (! (res= session->client->sendFields(&list)))
56
if (!(res= session->protocol->send_fields(&list, flags)))
64
57
is_result_set_started= 1;
97
90
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
100
plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
93
ha_release_temporary_latches(session);
102
95
List_iterator_fast<Item> li(items);
96
Protocol *protocol= session->protocol;
103
97
char buff[MAX_FIELD_WIDTH];
104
98
String buffer(buff, sizeof(buff), &my_charset_bin);
100
protocol->prepare_for_resend();
107
102
while ((item=li++))
109
if (item->send(session->client, &buffer))
104
if (item->send(protocol, &buffer))
106
protocol->free(); // Free used buffer
111
107
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
115
/* Insert this record to the Resultset into the cache */
116
if (session->query_cache_key != "" && session->getResultsetMessage() != NULL)
117
plugin::QueryCache::insertRecord(session, items);
119
111
session->sent_row_count++;
120
112
if (session->is_error())
114
protocol->remove_last_row();
122
return session->client->flush();
117
if (session->drizzleclient_vio_ok())
118
return(protocol->write());
126
} /* namespace drizzled */
128
123
#endif /* DRIZZLED_SELECT_SEND_H */