584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
#include <drizzled/server_includes.h> |
|
21 |
#include <drizzled/ha_trx_info.h> |
|
960.2.23
by Monty Taylor
Moved handlerton to plugin/storage_engine.h. |
22 |
#include <drizzled/plugin/storage_engine.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
23 |
#include <drizzled/session.h> |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
24 |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
25 |
using namespace drizzled; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
26 |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
27 |
void Ha_trx_info::register_ha(Session_TRANS *trans, |
28 |
plugin::StorageEngine *engine_arg) |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
29 |
{
|
30 |
assert(m_flags == 0); |
|
960.2.37
by Monty Taylor
More naming fixes. |
31 |
assert(m_engine == NULL); |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
32 |
assert(m_next == NULL); |
33 |
||
960.2.37
by Monty Taylor
More naming fixes. |
34 |
m_engine= engine_arg; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
35 |
m_flags= (int) TRX_READ_ONLY; /* Assume read-only at start. */ |
36 |
||
37 |
m_next= trans->ha_list; |
|
38 |
trans->ha_list= this; |
|
39 |
}
|
|
40 |
||
41 |
||
42 |
/** Clear, prepare for reuse. */
|
|
43 |
void Ha_trx_info::reset() |
|
44 |
{
|
|
45 |
m_next= NULL; |
|
960.2.37
by Monty Taylor
More naming fixes. |
46 |
m_engine= NULL; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
47 |
m_flags= 0; |
48 |
}
|
|
49 |
||
50 |
void Ha_trx_info::set_trx_read_write() |
|
51 |
{
|
|
52 |
assert(is_started()); |
|
53 |
m_flags|= (int) TRX_READ_WRITE; |
|
54 |
}
|
|
55 |
||
56 |
||
57 |
bool Ha_trx_info::is_trx_read_write() const |
|
58 |
{
|
|
59 |
assert(is_started()); |
|
60 |
return m_flags & (int) TRX_READ_WRITE; |
|
61 |
}
|
|
62 |
||
63 |
||
64 |
bool Ha_trx_info::is_started() const |
|
65 |
{
|
|
960.2.37
by Monty Taylor
More naming fixes. |
66 |
return m_engine != NULL; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
67 |
}
|
68 |
||
69 |
||
70 |
/** Mark this transaction read-write if the argument is read-write. */
|
|
71 |
void Ha_trx_info::coalesce_trx_with(const Ha_trx_info *stmt_trx) |
|
72 |
{
|
|
73 |
/*
|
|
74 |
Must be called only after the transaction has been started.
|
|
75 |
Can be called many times, e.g. when we have many
|
|
76 |
read-write statements in a transaction.
|
|
77 |
*/
|
|
78 |
assert(is_started()); |
|
79 |
if (stmt_trx->is_trx_read_write()) |
|
80 |
set_trx_read_write(); |
|
81 |
}
|
|
82 |
||
83 |
||
84 |
Ha_trx_info *Ha_trx_info::next() const |
|
85 |
{
|
|
86 |
assert(is_started()); |
|
87 |
return m_next; |
|
88 |
}
|
|
89 |
||
90 |
||
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
91 |
plugin::StorageEngine *Ha_trx_info::engine() const |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
92 |
{
|
93 |
assert(is_started()); |
|
960.2.37
by Monty Taylor
More naming fixes. |
94 |
return m_engine; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
95 |
}
|