~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_send.h

Does not work (compile issue in plugin).

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
18
18
 */
19
19
 
20
20
 
21
 
#pragma once
 
21
#ifndef DRIZZLED_SELECT_SEND_H
 
22
#define DRIZZLED_SELECT_SEND_H
22
23
 
23
24
#include <drizzled/plugin/client.h>
24
 
#include <drizzled/plugin/query_cache.h>
25
 
#include <drizzled/plugin/transactional_storage_engine.h>
26
 
#include <drizzled/select_result.h>
27
 
#include <drizzled/sql_lex.h>
28
 
#include <drizzled/open_tables_state.h>
29
25
 
30
 
namespace drizzled {
 
26
namespace drizzled
 
27
{
31
28
 
32
29
class select_send :public select_result {
33
30
  /**
45
42
      InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
46
43
      by session
47
44
    */
48
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
45
    plugin::StorageEngine::releaseTemporaryLatches(session);
49
46
 
50
47
    /* Unlock tables before sending packet to gain some speed */
51
 
    if (session->open_tables.lock)
 
48
    if (session->lock)
52
49
    {
53
 
      session->unlockTables(session->open_tables.lock);
54
 
      session->open_tables.lock= 0;
 
50
      mysql_unlock_tables(session, session->lock);
 
51
      session->lock= 0;
55
52
    }
56
53
    session->my_eof();
57
54
    is_result_set_started= 0;
61
58
  bool send_fields(List<Item> &list)
62
59
  {
63
60
    bool res;
64
 
    if (! (res= session->getClient()->sendFields(&list)))
 
61
    if (! (res= session->client->sendFields(&list)))
65
62
      is_result_set_started= 1;
66
63
    return res;
67
64
  }
98
95
      InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
99
96
      by session
100
97
    */
101
 
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
 
98
    plugin::StorageEngine::releaseTemporaryLatches(session);
102
99
 
103
 
    List<Item>::iterator li(items.begin());
 
100
    List_iterator_fast<Item> li(items);
104
101
    char buff[MAX_FIELD_WIDTH];
105
102
    String buffer(buff, sizeof(buff), &my_charset_bin);
106
103
 
107
104
    Item *item;
108
105
    while ((item=li++))
109
106
    {
110
 
      if (item->send(session->getClient(), &buffer))
 
107
      if (item->send(session->client, &buffer))
111
108
      {
112
109
        my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
113
110
        break;
114
111
      }
115
112
    }
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
113
    session->sent_row_count++;
121
114
    if (session->is_error())
122
115
      return true;
123
 
    return session->getClient()->flush();
 
116
    return session->client->flush();
124
117
  }
125
118
};
126
119
 
127
120
} /* namespace drizzled */
128
121
 
 
122
#endif /* DRIZZLED_SELECT_SEND_H */