~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_send.h

Renamed namespace slot to namespace service.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
22
22
#define DRIZZLED_SELECT_SEND_H
23
23
 
24
24
#include <drizzled/plugin/client.h>
25
 
#include <drizzled/plugin/query_cache.h>
26
 
#include <drizzled/plugin/transactional_storage_engine.h>
27
 
#include <drizzled/select_result.h>
28
 
 
29
 
namespace drizzled
30
 
{
31
25
 
32
26
class select_send :public select_result {
33
27
  /**
45
39
      InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
46
40
      by session
47
41
    */
48
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
42
    ha_release_temporary_latches(session);
49
43
 
50
44
    /* Unlock tables before sending packet to gain some speed */
51
45
    if (session->lock)
52
46
    {
53
 
      session->unlockTables(session->lock);
 
47
      mysql_unlock_tables(session, session->lock);
54
48
      session->lock= 0;
55
49
    }
56
50
    session->my_eof();
61
55
  bool send_fields(List<Item> &list)
62
56
  {
63
57
    bool res;
64
 
    if (! (res= session->getClient()->sendFields(&list)))
 
58
    if (! (res= session->client->sendFields(&list)))
65
59
      is_result_set_started= 1;
66
60
    return res;
67
61
  }
98
92
      InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
99
93
      by session
100
94
    */
101
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
95
    ha_release_temporary_latches(session);
102
96
 
103
 
    List<Item>::iterator li(items.begin());
 
97
    List_iterator_fast<Item> li(items);
104
98
    char buff[MAX_FIELD_WIDTH];
105
99
    String buffer(buff, sizeof(buff), &my_charset_bin);
106
100
 
107
101
    Item *item;
108
102
    while ((item=li++))
109
103
    {
110
 
      if (item->send(session->getClient(), &buffer))
 
104
      if (item->send(session->client, &buffer))
111
105
      {
112
106
        my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
113
107
        break;
114
108
      }
115
109
    }
116
 
    /* Insert this record to the Resultset into the cache */
117
 
    if (session->query_cache_key != "" && session->getResultsetMessage() != NULL)
118
 
      plugin::QueryCache::insertRecord(session, items);
119
 
 
120
110
    session->sent_row_count++;
121
111
    if (session->is_error())
122
112
      return true;
123
 
    return session->getClient()->flush();
 
113
    return session->client->flush();
124
114
  }
125
115
};
126
116
 
127
 
} /* namespace drizzled */
128
 
 
129
117
#endif /* DRIZZLED_SELECT_SEND_H */