changed some NdbConnection to NdbTransaction

parent abb926c3
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* *
* Ndb * Ndb
* init() * init()
* getDictionary()
* startTransaction() * startTransaction()
* closeTransaction() * closeTransaction()
* sendPollNdb() * sendPollNdb()
...@@ -97,10 +96,10 @@ typedef struct { ...@@ -97,10 +96,10 @@ typedef struct {
} async_callback_t; } async_callback_t;
/** /**
* Structure used in "free list" to a NdbConnection * Structure used in "free list" to a NdbTransaction
*/ */
typedef struct { typedef struct {
NdbConnection* conn; NdbTransaction* conn;
int used; int used;
} transaction_t; } transaction_t;
...@@ -123,7 +122,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData); ...@@ -123,7 +122,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData);
/** /**
* Error handler. * Error handler.
*/ */
bool asynchErrorHandler(NdbConnection * trans, Ndb* ndb); bool asynchErrorHandler(NdbTransaction * trans, Ndb* ndb);
/** /**
* Exit function * Exit function
...@@ -162,7 +161,7 @@ closeTransaction(Ndb * ndb , async_callback_t * cb) ...@@ -162,7 +161,7 @@ closeTransaction(Ndb * ndb , async_callback_t * cb)
* Callback executed when transaction has return from NDB * Callback executed when transaction has return from NDB
*/ */
static void static void
callback(int result, NdbConnection* trans, void* aObject) callback(int result, NdbTransaction* trans, void* aObject)
{ {
async_callback_t * cbData = (async_callback_t *)aObject; async_callback_t * cbData = (async_callback_t *)aObject;
if (result<0) if (result<0)
...@@ -232,7 +231,7 @@ void asynchExitHandler(Ndb * m_ndb) ...@@ -232,7 +231,7 @@ void asynchExitHandler(Ndb * m_ndb)
/* returns true if is recoverable (temporary), /* returns true if is recoverable (temporary),
* false if it is an error that is permanent. * false if it is an error that is permanent.
*/ */
bool asynchErrorHandler(NdbConnection * trans, Ndb* ndb) bool asynchErrorHandler(NdbTransaction * trans, Ndb* ndb)
{ {
NdbError error = trans->getNdbError(); NdbError error = trans->getNdbError();
switch(error.status) switch(error.status)
......
...@@ -154,7 +154,7 @@ static int ndb_to_mysql_error(const NdbError *err) ...@@ -154,7 +154,7 @@ static int ndb_to_mysql_error(const NdbError *err)
inline inline
int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans) int execute_no_commit(ha_ndbcluster *h, NdbTransaction *trans)
{ {
int m_batch_execute= 0; int m_batch_execute= 0;
#ifdef NOT_USED #ifdef NOT_USED
...@@ -165,7 +165,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans) ...@@ -165,7 +165,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
} }
inline inline
int execute_commit(ha_ndbcluster *h, NdbConnection *trans) int execute_commit(ha_ndbcluster *h, NdbTransaction *trans)
{ {
int m_batch_execute= 0; int m_batch_execute= 0;
#ifdef NOT_USED #ifdef NOT_USED
...@@ -176,7 +176,7 @@ int execute_commit(ha_ndbcluster *h, NdbConnection *trans) ...@@ -176,7 +176,7 @@ int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
} }
inline inline
int execute_commit(THD *thd, NdbConnection *trans) int execute_commit(THD *thd, NdbTransaction *trans)
{ {
int m_batch_execute= 0; int m_batch_execute= 0;
#ifdef NOT_USED #ifdef NOT_USED
...@@ -187,7 +187,7 @@ int execute_commit(THD *thd, NdbConnection *trans) ...@@ -187,7 +187,7 @@ int execute_commit(THD *thd, NdbConnection *trans)
} }
inline inline
int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans) int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans)
{ {
int m_batch_execute= 0; int m_batch_execute= 0;
#ifdef NOT_USED #ifdef NOT_USED
...@@ -330,7 +330,7 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd) ...@@ -330,7 +330,7 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
*/ */
int ha_ndbcluster::ndb_err(NdbConnection *trans) int ha_ndbcluster::ndb_err(NdbTransaction *trans)
{ {
int res; int res;
const NdbError err= trans->getNdbError(); const NdbError err= trans->getNdbError();
...@@ -1091,7 +1091,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) ...@@ -1091,7 +1091,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
DBUG_PRINT("enter", ("key_len: %u", key_len)); DBUG_PRINT("enter", ("key_len: %u", key_len));
DBUG_DUMP("key", (char*)key, key_len); DBUG_DUMP("key", (char*)key, key_len);
uint no_fields= table->fields, i; uint no_fields= table->fields, i;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbOperation *op; NdbOperation *op;
THD *thd= current_thd; THD *thd= current_thd;
...@@ -1141,7 +1141,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf) ...@@ -1141,7 +1141,7 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data) int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
{ {
uint no_fields= table->fields, i; uint no_fields= table->fields, i;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbOperation *op; NdbOperation *op;
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ENTER("complemented_pk_read"); DBUG_ENTER("complemented_pk_read");
...@@ -1204,7 +1204,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data) ...@@ -1204,7 +1204,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
int ha_ndbcluster::peek_row() int ha_ndbcluster::peek_row()
{ {
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbOperation *op; NdbOperation *op;
THD *thd= current_thd; THD *thd= current_thd;
DBUG_ENTER("peek_row"); DBUG_ENTER("peek_row");
...@@ -1235,7 +1235,7 @@ int ha_ndbcluster::unique_index_read(const byte *key, ...@@ -1235,7 +1235,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
uint key_len, byte *buf) uint key_len, byte *buf)
{ {
int res; int res;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbIndexOperation *op; NdbIndexOperation *op;
DBUG_ENTER("ha_ndbcluster::unique_index_read"); DBUG_ENTER("ha_ndbcluster::unique_index_read");
DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index)); DBUG_PRINT("enter", ("key_len: %u, index: %u", key_len, active_index));
...@@ -1271,7 +1271,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor) ...@@ -1271,7 +1271,7 @@ inline int ha_ndbcluster::fetch_next(NdbScanOperation* cursor)
{ {
DBUG_ENTER("fetch_next"); DBUG_ENTER("fetch_next");
int check; int check;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
bool contact_ndb= m_lock.type < TL_WRITE_ALLOW_WRITE; bool contact_ndb= m_lock.type < TL_WRITE_ALLOW_WRITE;
do { do {
...@@ -1551,7 +1551,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op) ...@@ -1551,7 +1551,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
{ {
uint i; uint i;
THD *thd= current_thd; THD *thd= current_thd;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
DBUG_ENTER("define_read_attrs"); DBUG_ENTER("define_read_attrs");
...@@ -1598,7 +1598,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key, ...@@ -1598,7 +1598,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
{ {
int res; int res;
bool restart; bool restart;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbIndexScanOperation *op; NdbIndexScanOperation *op;
DBUG_ENTER("ha_ndbcluster::ordered_index_scan"); DBUG_ENTER("ha_ndbcluster::ordered_index_scan");
...@@ -1668,7 +1668,7 @@ int ha_ndbcluster::filtered_scan(const byte *key, uint key_len, ...@@ -1668,7 +1668,7 @@ int ha_ndbcluster::filtered_scan(const byte *key, uint key_len,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
int res; int res;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbScanOperation *op; NdbScanOperation *op;
DBUG_ENTER("filtered_scan"); DBUG_ENTER("filtered_scan");
...@@ -1748,7 +1748,7 @@ int ha_ndbcluster::full_table_scan(byte *buf) ...@@ -1748,7 +1748,7 @@ int ha_ndbcluster::full_table_scan(byte *buf)
uint i; uint i;
int res; int res;
NdbScanOperation *op; NdbScanOperation *op;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
DBUG_ENTER("full_table_scan"); DBUG_ENTER("full_table_scan");
DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname)); DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname));
...@@ -1776,7 +1776,7 @@ int ha_ndbcluster::write_row(byte *record) ...@@ -1776,7 +1776,7 @@ int ha_ndbcluster::write_row(byte *record)
{ {
bool has_auto_increment; bool has_auto_increment;
uint i; uint i;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbOperation *op; NdbOperation *op;
int res; int res;
THD *thd= current_thd; THD *thd= current_thd;
...@@ -1945,7 +1945,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row, ...@@ -1945,7 +1945,7 @@ int ha_ndbcluster::key_cmp(uint keynr, const byte * old_row,
int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
{ {
THD *thd= current_thd; THD *thd= current_thd;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbScanOperation* cursor= m_active_cursor; NdbScanOperation* cursor= m_active_cursor;
NdbOperation *op; NdbOperation *op;
uint i; uint i;
...@@ -2063,7 +2063,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) ...@@ -2063,7 +2063,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
int ha_ndbcluster::delete_row(const byte *record) int ha_ndbcluster::delete_row(const byte *record)
{ {
THD *thd= current_thd; THD *thd= current_thd;
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
NdbScanOperation* cursor= m_active_cursor; NdbScanOperation* cursor= m_active_cursor;
NdbOperation *op; NdbOperation *op;
DBUG_ENTER("delete_row"); DBUG_ENTER("delete_row");
...@@ -2635,7 +2635,7 @@ int ha_ndbcluster::rnd_init(bool scan) ...@@ -2635,7 +2635,7 @@ int ha_ndbcluster::rnd_init(bool scan)
int ha_ndbcluster::close_scan() int ha_ndbcluster::close_scan()
{ {
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
DBUG_ENTER("close_scan"); DBUG_ENTER("close_scan");
m_multi_cursor= 0; m_multi_cursor= 0;
...@@ -2983,7 +2983,7 @@ int ha_ndbcluster::end_bulk_insert() ...@@ -2983,7 +2983,7 @@ int ha_ndbcluster::end_bulk_insert()
// Check if last inserts need to be flushed // Check if last inserts need to be flushed
if (m_bulk_insert_not_flushed) if (m_bulk_insert_not_flushed)
{ {
NdbConnection *trans= m_active_trans; NdbTransaction *trans= m_active_trans;
// Send rows to NDB // Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\ DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d", "rows_inserted:%d, bulk_insert_rows: %d",
...@@ -3102,7 +3102,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd, ...@@ -3102,7 +3102,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
int ha_ndbcluster::external_lock(THD *thd, int lock_type) int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{ {
int error=0; int error=0;
NdbConnection* trans= NULL; NdbTransaction* trans= NULL;
DBUG_ENTER("external_lock"); DBUG_ENTER("external_lock");
/* /*
...@@ -3189,8 +3189,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) ...@@ -3189,8 +3189,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
// m_use_local_query_cache= thd->variables.ndb_use_local_query_cache; // m_use_local_query_cache= thd->variables.ndb_use_local_query_cache;
m_active_trans= thd->transaction.all.ndb_tid ? m_active_trans= thd->transaction.all.ndb_tid ?
(NdbConnection*)thd->transaction.all.ndb_tid: (NdbTransaction*)thd->transaction.all.ndb_tid:
(NdbConnection*)thd->transaction.stmt.ndb_tid; (NdbTransaction*)thd->transaction.stmt.ndb_tid;
DBUG_ASSERT(m_active_trans); DBUG_ASSERT(m_active_trans);
// Start of transaction // Start of transaction
m_retrieve_all_fields= FALSE; m_retrieve_all_fields= FALSE;
...@@ -3272,13 +3272,13 @@ int ha_ndbcluster::start_stmt(THD *thd) ...@@ -3272,13 +3272,13 @@ int ha_ndbcluster::start_stmt(THD *thd)
DBUG_ENTER("start_stmt"); DBUG_ENTER("start_stmt");
PRINT_OPTION_FLAGS(thd); PRINT_OPTION_FLAGS(thd);
NdbConnection *trans= (NdbConnection*)thd->transaction.stmt.ndb_tid; NdbTransaction *trans= (NdbTransaction*)thd->transaction.stmt.ndb_tid;
if (!trans){ if (!trans){
Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb; Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
DBUG_PRINT("trans",("Starting transaction stmt")); DBUG_PRINT("trans",("Starting transaction stmt"));
NdbConnection *tablock_trans= NdbTransaction *tablock_trans=
(NdbConnection*)thd->transaction.all.ndb_tid; (NdbTransaction*)thd->transaction.all.ndb_tid;
DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans)); DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans));
DBUG_ASSERT(tablock_trans); DBUG_ASSERT(tablock_trans);
// trans= ndb->hupp(tablock_trans); // trans= ndb->hupp(tablock_trans);
...@@ -3307,7 +3307,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction) ...@@ -3307,7 +3307,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
{ {
int res= 0; int res= 0;
Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb; Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
NdbConnection *trans= (NdbConnection*)ndb_transaction; NdbTransaction *trans= (NdbTransaction*)ndb_transaction;
DBUG_ENTER("ndbcluster_commit"); DBUG_ENTER("ndbcluster_commit");
DBUG_PRINT("transaction",("%s", DBUG_PRINT("transaction",("%s",
...@@ -3337,7 +3337,7 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction) ...@@ -3337,7 +3337,7 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction)
{ {
int res= 0; int res= 0;
Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb; Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
NdbConnection *trans= (NdbConnection*)ndb_transaction; NdbTransaction *trans= (NdbTransaction*)ndb_transaction;
DBUG_ENTER("ndbcluster_rollback"); DBUG_ENTER("ndbcluster_rollback");
DBUG_PRINT("transaction",("%s", DBUG_PRINT("transaction",("%s",
...@@ -4842,7 +4842,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table, ...@@ -4842,7 +4842,7 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
{ {
DBUG_ENTER("ndb_get_table_statistics"); DBUG_ENTER("ndb_get_table_statistics");
DBUG_PRINT("enter", ("table: %s", table)); DBUG_PRINT("enter", ("table: %s", table));
NdbConnection* pTrans= ndb->startTransaction(); NdbTransaction* pTrans= ndb->startTransaction();
do do
{ {
if (pTrans == NULL) if (pTrans == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment