17
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/trx0trx.ic
19
/******************************************************
23
22
Created 3/26/1996 Heikki Tuuri
24
23
*******************************************************/
26
/*************************************************************//**
25
/*****************************************************************
27
26
Starts the transaction if it is not yet started. */
30
29
trx_start_if_not_started(
31
30
/*=====================*/
32
trx_t* trx) /*!< in: transaction */
31
trx_t* trx) /* in: transaction */
34
33
ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
59
/****************************************************************//**
60
Retrieves the error_info field from a trx.
61
@return the error info */
58
/*****************************************************************
59
Resets the new record lock info in a transaction struct. */
62
trx_reset_new_rec_lock_info(
63
/*========================*/
64
trx_t* trx) /* in: transaction struct */
66
trx->new_rec_locks[0] = NULL;
67
trx->new_rec_locks[1] = NULL;
70
/*****************************************************************
71
Registers that we have set a new record lock on an index. We only have space
72
to store 2 indexes! If this is called to store more than 2 indexes after
73
trx_reset_new_rec_lock_info(), then this function does nothing. */
76
trx_register_new_rec_lock(
77
/*======================*/
78
trx_t* trx, /* in: transaction struct */
79
dict_index_t* index) /* in: trx sets a new record lock on this
82
if (trx->new_rec_locks[0] == NULL) {
83
trx->new_rec_locks[0] = index;
88
if (trx->new_rec_locks[0] == index) {
93
if (trx->new_rec_locks[1] != NULL) {
98
trx->new_rec_locks[1] = index;
101
/*****************************************************************
102
Checks if trx has set a new record lock on an index. */
105
trx_new_rec_locks_contain(
106
/*======================*/
107
/* out: TRUE if trx has set a new record lock
109
trx_t* trx, /* in: transaction struct */
110
dict_index_t* index) /* in: index */
112
return(trx->new_rec_locks[0] == index
113
|| trx->new_rec_locks[1] == index);
116
/********************************************************************
117
Retrieves the error_info field from a trx. */
63
119
const dict_index_t*
64
120
trx_get_error_info(
65
121
/*===============*/
66
const trx_t* trx) /*!< in: trx object */
122
/* out: the error info */
123
const trx_t* trx) /* in: trx object */
68
125
return(trx->error_info);
71
/*******************************************************************//**
72
Retrieves transacion's id, represented as unsigned long long.
73
@return transaction's id */
128
/***********************************************************************
129
Retrieves transacion's id, represented as unsigned long long. */
78
const trx_t* trx) /*!< in: transaction */
134
/* out: transaction's id */
135
const trx_t* trx) /* in: transaction */
80
137
return((ullint)ut_conv_dulint_to_longlong(trx->id));
83
/*******************************************************************//**
140
/***********************************************************************
84
141
Retrieves transaction's que state in a human readable string. The string
85
should not be free()'d or modified.
86
@return string in the data segment */
142
should not be free()'d or modified. */
89
145
trx_get_que_state_str(
90
146
/*==================*/
91
const trx_t* trx) /*!< in: transaction */
147
/* out: string in the data segment */
148
const trx_t* trx) /* in: transaction */
93
150
/* be sure to adjust TRX_QUE_STATE_STR_MAX_LEN if you change this */
94
151
switch (trx->que_state) {
108
/**********************************************************************//**
109
Determine if a transaction is a dictionary operation.
110
@return dictionary operation mode */
165
/**************************************************************************
166
Determine if a transaction is a dictionary operation. */
113
169
trx_get_dict_operation(
114
170
/*===================*/
115
const trx_t* trx) /*!< in: transaction */
171
/* out: dictionary operation mode */
172
const trx_t* trx) /* in: transaction */
117
174
enum trx_dict_op op = (enum trx_dict_op) trx->dict_operation;
127
184
#endif /* UNIV_DEBUG */
128
185
return((enum trx_dict_op) UNIV_EXPECT(op, TRX_DICT_OP_NONE));
130
/**********************************************************************//**
187
/**************************************************************************
131
188
Flag a transaction a dictionary operation. */
134
191
trx_set_dict_operation(
135
192
/*===================*/
136
trx_t* trx, /*!< in/out: transaction */
137
enum trx_dict_op op) /*!< in: operation, not
193
trx_t* trx, /* in/out: transaction */
194
enum trx_dict_op op) /* in: operation, not
138
195
TRX_DICT_OP_NONE */
140
197
#ifdef UNIV_DEBUG