~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/******************************************************
2
Transaction undo log record
3
4
(c) 1996 Innobase Oy
5
6
Created 3/26/1996 Heikki Tuuri
7
*******************************************************/
8
9
/**************************************************************************
10
Reads from an undo log record the record type. */
11
UNIV_INLINE
12
ulint
13
trx_undo_rec_get_type(
14
/*==================*/
15
					/* out: record type */
16
	trx_undo_rec_t*	undo_rec)	/* in: undo log record */
17
{
18
	return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1));
19
}
20
21
/**************************************************************************
22
Reads from an undo log record the record compiler info. */
23
UNIV_INLINE
24
ulint
25
trx_undo_rec_get_cmpl_info(
26
/*=======================*/
27
					/* out: compiler info */
28
	trx_undo_rec_t*	undo_rec)	/* in: undo log record */
29
{
30
	return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT);
31
}
32
33
/**************************************************************************
34
Returns TRUE if an undo log record contains an extern storage field. */
35
UNIV_INLINE
36
ibool
37
trx_undo_rec_get_extern_storage(
38
/*============================*/
39
					/* out: TRUE if extern */
40
	trx_undo_rec_t*	undo_rec)	/* in: undo log record */
41
{
42
	if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) {
43
44
		return(TRUE);
45
	}
46
47
	return(FALSE);
48
}
49
50
/**************************************************************************
51
Reads the undo log record number. */
52
UNIV_INLINE
53
dulint
54
trx_undo_rec_get_undo_no(
55
/*=====================*/
56
					/* out: undo no */
57
	trx_undo_rec_t*	undo_rec)	/* in: undo log record */
58
{
59
	byte*	ptr;
60
61
	ptr = undo_rec + 3;
62
63
	return(mach_dulint_read_much_compressed(ptr));
64
}
65
66
/***************************************************************************
67
Copies the undo record to the heap. */
68
UNIV_INLINE
69
trx_undo_rec_t*
70
trx_undo_rec_copy(
71
/*==============*/
72
					/* out, own: copy of undo log record */
73
	trx_undo_rec_t*	undo_rec,	/* in: undo log record */
74
	mem_heap_t*	heap)		/* in: heap where copied */
75
{
76
	ulint		len;
77
	trx_undo_rec_t*	rec_copy;
78
79
	len = mach_read_from_2(undo_rec) + buf_frame_align(undo_rec)
80
		- undo_rec;
81
	rec_copy = mem_heap_alloc(heap, len);
82
83
	ut_memcpy(rec_copy, undo_rec, len);
84
85
	return(rec_copy);
86
}