コード例 #1
0
/**********************************************************************//**
Reads from an undo log record a stored column value.
@return	remaining part of undo log record after reading these values */
static
byte*
trx_undo_rec_get_col_val(
/*=====================*/
	byte*	ptr,	/*!< in: pointer to remaining part of undo log record */
	byte**	field,	/*!< out: pointer to stored field */
	ulint*	len,	/*!< out: length of the field, or UNIV_SQL_NULL */
	ulint*	orig_len)/*!< out: original length of the locally
			stored part of an externally stored column, or 0 */
{
	*len = mach_read_compressed(ptr);
	ptr += mach_get_compressed_size(*len);

	*orig_len = 0;

	switch (*len) {
	case UNIV_SQL_NULL:
		*field = NULL;
		break;
	case UNIV_EXTERN_STORAGE_FIELD:
		*orig_len = mach_read_compressed(ptr);
		ptr += mach_get_compressed_size(*orig_len);
		*len = mach_read_compressed(ptr);
		ptr += mach_get_compressed_size(*len);
		*field = ptr;
		ptr += *len;

		ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE);
		ut_ad(*len > *orig_len);
		/* @see dtuple_convert_big_rec() */
		ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE * 2);
		/* we do not have access to index->table here
		ut_ad(dict_table_get_format(index->table) >= DICT_TF_FORMAT_ZIP
		      || *len >= REC_MAX_INDEX_COL_LEN
		      + BTR_EXTERN_FIELD_REF_SIZE);
		*/

		*len += UNIV_EXTERN_STORAGE_FIELD;
		break;
	default:
		*field = ptr;
		if (*len >= UNIV_EXTERN_STORAGE_FIELD) {
			ptr += *len - UNIV_EXTERN_STORAGE_FIELD;
		} else {
			ptr += *len;
		}
	}

	return(ptr);
}
コード例 #2
0
ファイル: trx0rec.c プロジェクト: zylishiyu/mysql-timeout-ms
/**************************************************************************
Reads from an undo log record a stored column value. */
static
byte*
trx_undo_rec_get_col_val(
/*=====================*/
			/* out: remaining part of undo log record after
			reading these values */
	byte*	ptr,	/* in: pointer to remaining part of undo log record */
	byte**	field,	/* out: pointer to stored field */
	ulint*	len)	/* out: length of the field, or UNIV_SQL_NULL */
{
	*len = mach_read_compressed(ptr);
	ptr += mach_get_compressed_size(*len);

	*field = ptr;

	if (*len != UNIV_SQL_NULL) {
		if (*len >= UNIV_EXTERN_STORAGE_FIELD) {
			ptr += (*len - UNIV_EXTERN_STORAGE_FIELD);
		} else {
			ptr += *len;
		}
	}

	return(ptr);
}
コード例 #3
0
ファイル: trx0rec.c プロジェクト: pombredanne/mysql-1
/**********************************************************************//**
Reads from an undo log record a stored column value.
@return	remaining part of undo log record after reading these values */
static
byte*
trx_undo_rec_get_col_val(
/*=====================*/
	byte*	ptr,	/*!< in: pointer to remaining part of undo log record */
	byte**	field,	/*!< out: pointer to stored field */
	ulint*	len,	/*!< out: length of the field, or UNIV_SQL_NULL */
	ulint*	orig_len)/*!< out: original length of the locally
			stored part of an externally stored column, or 0 */
{
	*len = mach_read_compressed(ptr);
	ptr += mach_get_compressed_size(*len);

	*orig_len = 0;

	switch (*len) {
	case UNIV_SQL_NULL:
		*field = NULL;
		break;
	case UNIV_EXTERN_STORAGE_FIELD:
		*orig_len = mach_read_compressed(ptr);
		ptr += mach_get_compressed_size(*orig_len);
		*len = mach_read_compressed(ptr);
		ptr += mach_get_compressed_size(*len);
		*field = ptr;
		ptr += *len;

		ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE);
		ut_ad(*len > *orig_len);
		ut_ad(*len >= REC_MAX_INDEX_COL_LEN
		      + BTR_EXTERN_FIELD_REF_SIZE);

		*len += UNIV_EXTERN_STORAGE_FIELD;
		break;
	default:
		*field = ptr;
		if (*len >= UNIV_EXTERN_STORAGE_FIELD) {
			ptr += *len - UNIV_EXTERN_STORAGE_FIELD;
		} else {
			ptr += *len;
		}
	}

	return(ptr);
}
コード例 #4
0
/**********************************************************************//**
Reads from an update undo log record a stored field number.
@return	remaining part of undo log record after reading this value */
UNIV_INLINE
byte*
trx_undo_update_rec_get_field_no(
/*=============================*/
	byte*	ptr,	/*!< in: pointer to remaining part of undo log record */
	ulint*	field_no)/*!< out: field number */
{
	*field_no = mach_read_compressed(ptr);
	ptr += mach_get_compressed_size(*field_no);

	return(ptr);
}
コード例 #5
0
/**********************************************************************//**
Reads from an update undo log record the number of updated fields.
@return	remaining part of undo log record after reading this value */
UNIV_INLINE
byte*
trx_undo_update_rec_get_n_upd_fields(
/*=================================*/
	byte*	ptr,	/*!< in: pointer to remaining part of undo log record */
	ulint*	n)	/*!< out: number of fields */
{
	*n = mach_read_compressed(ptr);
	ptr += mach_get_compressed_size(*n);

	return(ptr);
}
コード例 #6
0
ファイル: mach0data.c プロジェクト: isleon/Jaxer
byte*
mach_dulint_parse_compressed(
/*=========================*/
			/* out: pointer to end of the stored field, NULL if
			not complete */
	byte*   ptr,   	/* in: pointer to buffer from where to read */
	byte*	end_ptr,/* in: pointer to end of the buffer */
	dulint*	val)	/* out: read value */ 
{
	ulint	high;
	ulint	low;
	ulint	size;

	ut_ad(ptr && end_ptr && val);

	if (end_ptr < ptr + 5) {

		return(NULL);
	}

	high = mach_read_compressed(ptr);

	size = mach_get_compressed_size(high);

	ptr += size;

	if (end_ptr < ptr + 4) {

		return(NULL);
	}

	low = mach_read_from_4(ptr);

	*val = ut_dulint_create(high, low);

	return(ptr + 4); 
}