~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_send.h

  • Committer: Olaf van der Spek
  • Date: 2011-04-20 09:27:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2285.
  • Revision ID: olafvdspek@gmail.com-20110420092749-hw1q9rfj1pumc2no
Session Cache

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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
 
#ifndef DRIZZLED_SELECT_SEND_H
22
 
#define DRIZZLED_SELECT_SEND_H
 
21
#pragma once
23
22
 
24
23
#include <drizzled/plugin/client.h>
25
24
#include <drizzled/plugin/query_cache.h>
26
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>
27
29
 
28
 
namespace drizzled
29
 
{
 
30
namespace drizzled {
30
31
 
31
32
class select_send :public select_result {
32
33
  /**
47
48
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
48
49
 
49
50
    /* Unlock tables before sending packet to gain some speed */
50
 
    if (session->lock)
 
51
    if (session->open_tables.lock)
51
52
    {
52
 
      session->unlockTables(session->lock);
53
 
      session->lock= 0;
 
53
      session->unlockTables(session->open_tables.lock);
 
54
      session->open_tables.lock= 0;
54
55
    }
55
56
    session->my_eof();
56
57
    is_result_set_started= 0;
60
61
  bool send_fields(List<Item> &list)
61
62
  {
62
63
    bool res;
63
 
    if (! (res= session->client->sendFields(&list)))
 
64
    if (! (res= session->getClient()->sendFields(&list)))
64
65
      is_result_set_started= 1;
65
66
    return res;
66
67
  }
99
100
    */
100
101
    plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
101
102
 
102
 
    List_iterator_fast<Item> li(items);
 
103
    List<Item>::iterator li(items.begin());
103
104
    char buff[MAX_FIELD_WIDTH];
104
105
    String buffer(buff, sizeof(buff), &my_charset_bin);
105
106
 
106
107
    Item *item;
107
108
    while ((item=li++))
108
109
    {
109
 
      if (item->send(session->client, &buffer))
 
110
      if (item->send(session->getClient(), &buffer))
110
111
      {
111
112
        my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
112
113
        break;
119
120
    session->sent_row_count++;
120
121
    if (session->is_error())
121
122
      return true;
122
 
    return session->client->flush();
 
123
    return session->getClient()->flush();
123
124
  }
124
125
};
125
126
 
126
127
} /* namespace drizzled */
127
128
 
128
 
#endif /* DRIZZLED_SELECT_SEND_H */