Commit 9584b469 authored by vasil's avatar vasil

branches/zip: Add trx_get_id() and trx_get_que_state_str() functions to

retrieve trx_t's properties that will be exported in INFORMATION_SCHEMA tables.

Approved by:	Marko
parent 617cbacd
......@@ -383,6 +383,29 @@ trx_weight_cmp(
const trx_t* a, /* in: the first transaction to be compared */
const trx_t* b); /* in: the second transaction to be compared */
/***********************************************************************
Retrieves transacion's id, represented as unsigned long long. */
UNIV_INLINE
ullint
trx_get_id(
/*=======*/
/* out: transaction's id */
const trx_t* trx); /* in: transaction */
/* Maximum length of a string that can be returned by
trx_get_que_state_str(). */
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
/***********************************************************************
Retrieves transaction's que state in a human readable string. The string
should not be free()'d or modified. */
UNIV_INLINE
const char*
trx_get_que_state_str(
/*==================*/
/* out: string in the data segment */
const trx_t* trx); /* in: transaction */
/* Signal to a transaction */
struct trx_sig_struct{
ulint type; /* signal type */
......
......@@ -108,3 +108,40 @@ trx_get_error_info(
{
return(trx->error_info);
}
/***********************************************************************
Retrieves transacion's id, represented as unsigned long long. */
UNIV_INLINE
ullint
trx_get_id(
/*=======*/
/* out: transaction's id */
const trx_t* trx) /* in: transaction */
{
return((ullint)ut_conv_dulint_to_longlong(trx->id));
}
/***********************************************************************
Retrieves transaction's que state in a human readable string. The string
should not be free()'d or modified. */
UNIV_INLINE
const char*
trx_get_que_state_str(
/*==================*/
/* out: string in the data segment */
const trx_t* trx) /* in: transaction */
{
/* be sure to adjust TRX_QUE_STATE_STR_MAX_LEN if you change this */
switch (trx->que_state) {
case TRX_QUE_RUNNING:
return("RUNNING");
case TRX_QUE_LOCK_WAIT:
return("LOCK WAIT");
case TRX_QUE_ROLLING_BACK:
return("ROLLING BACK");
case TRX_QUE_COMMITTING:
return("COMMITTING");
default:
return("UNKNOWN");
}
}
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