~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_send.h

  • Committer: Brian Aker
  • Date: 2009-05-20 23:51:08 UTC
  • mfrom: (1022.2.18 mordred)
  • Revision ID: brian@gaz-20090520235108-nb5he1em112798pb
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_SELECT_SEND_H
22
22
#define DRIZZLED_SELECT_SEND_H
23
23
 
24
 
#include <drizzled/plugin/client.h>
25
 
#include <drizzled/plugin/query_cache.h>
26
 
#include <drizzled/plugin/transactional_storage_engine.h>
27
 
 
28
 
namespace drizzled
29
 
{
30
 
 
31
24
class select_send :public select_result {
32
25
  /**
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
45
38
      by session
46
39
    */
47
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
40
    ha_release_temporary_latches(session);
48
41
 
49
42
    /* Unlock tables before sending packet to gain some speed */
50
43
    if (session->lock)
51
44
    {
52
 
      session->unlockTables(session->lock);
 
45
      mysql_unlock_tables(session, session->lock);
53
46
      session->lock= 0;
54
47
    }
55
48
    session->my_eof();
57
50
    return false;
58
51
  }
59
52
 
60
 
  bool send_fields(List<Item> &list)
 
53
  bool send_fields(List<Item> &list, uint32_t flags)
61
54
  {
62
55
    bool res;
63
 
    if (! (res= session->client->sendFields(&list)))
 
56
    if (!(res= session->protocol->sendFields(&list, flags)))
64
57
      is_result_set_started= 1;
65
58
    return res;
66
59
  }
97
90
      InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
98
91
      by session
99
92
    */
100
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
93
    ha_release_temporary_latches(session);
101
94
 
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);
105
99
 
 
100
    protocol->prepareForResend();
106
101
    Item *item;
107
102
    while ((item=li++))
108
103
    {
109
 
      if (item->send(session->client, &buffer))
 
104
      if (item->send(protocol, &buffer))
110
105
      {
 
106
        protocol->free();                               // Free used buffer
111
107
        my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
112
108
        break;
113
109
      }
114
110
    }
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);
118
 
 
119
111
    session->sent_row_count++;
120
112
    if (session->is_error())
121
113
      return true;
122
 
    return session->client->flush();
 
114
    if (protocol->isConnected())
 
115
      return(protocol->write());
 
116
    return false;
123
117
  }
124
118
};
125
119
 
126
 
} /* namespace drizzled */
127
 
 
128
120
#endif /* DRIZZLED_SELECT_SEND_H */