1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
4
* Copyright (C) 2008 Sun Microsystems
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
17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#include "drizzled/resource_context.h"
20
#include <drizzled/server_includes.h>
21
#include <drizzled/ha_trx_info.h>
22
#include <drizzled/plugin/storage_engine.h>
23
#include <drizzled/session.h>
26
void Ha_trx_info::register_ha(Session_TRANS *trans, StorageEngine *engine_arg)
29
assert(m_engine == NULL);
30
assert(m_next == NULL);
33
m_flags= (int) TRX_READ_ONLY; /* Assume read-only at start. */
35
m_next= trans->ha_list;
30
40
/** Clear, prepare for reuse. */
31
void ResourceContext::reset()
34
xa_resource_manager= NULL;
35
trx_storage_engine= NULL;
39
void ResourceContext::markModifiedData()
45
bool ResourceContext::hasModifiedData() const
51
bool ResourceContext::isStarted() const
53
return monitored != NULL;
56
void ResourceContext::coalesceWith(const ResourceContext *stmt_ctx)
41
void Ha_trx_info::reset()
48
void Ha_trx_info::set_trx_read_write()
51
m_flags|= (int) TRX_READ_WRITE;
55
bool Ha_trx_info::is_trx_read_write() const
58
return m_flags & (int) TRX_READ_WRITE;
62
bool Ha_trx_info::is_started() const
64
return m_engine != NULL;
68
/** Mark this transaction read-write if the argument is read-write. */
69
void Ha_trx_info::coalesce_trx_with(const Ha_trx_info *stmt_trx)
59
72
Must be called only after the transaction has been started.
60
73
Can be called many times, e.g. when we have many
61
74
read-write statements in a transaction.
64
if (stmt_ctx->hasModifiedData())
68
} /* namespace drizzled */
77
if (stmt_trx->is_trx_read_write())
82
Ha_trx_info *Ha_trx_info::next() const
89
StorageEngine *Ha_trx_info::engine() const