-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdata0type.cc
72 lines (61 loc) · 1.57 KB
/
data0type.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "data0type.h"
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/*在调试版本中校验dtype的合法性*/
ibool dtype_validate(dtype_t* type)
{
ut_a(type);
ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL));
if(type->mtype == DATA_SYS)
ut_a(type->prtype <= DATA_MIX_ID);
return TRUE;
}
void dtype_print(dtype_t* type)
{
ulint mtype;
ulint prtype;
ulint len;
ut_a(type);
mtype = type->mtype;
prtype = type->prtype;
if (mtype == DATA_VARCHAR) {
printf("DATA_VARCHAR");
} else if (mtype == DATA_CHAR) {
printf("DATA_CHAR");
} else if (mtype == DATA_BINARY) {
printf("DATA_BINARY");
} else if (mtype == DATA_INT) {
printf("DATA_INT");
} else if (mtype == DATA_MYSQL) {
printf("DATA_MYSQL");
} else if (mtype == DATA_SYS) {
printf("DATA_SYS");
} else {
printf("type %lu", mtype);
}
len = type->len;
if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
printf(" ");
if (prtype == DATA_ROW_ID) {
printf("DATA_ROW_ID");
len = DATA_ROW_ID_LEN;
} else if (prtype == DATA_ROLL_PTR) {
printf("DATA_ROLL_PTR");
len = DATA_ROLL_PTR_LEN;
} else if (prtype == DATA_TRX_ID) {
printf("DATA_TRX_ID");
len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
printf("DATA_MIX_ID");
} else if (prtype == DATA_ENGLISH) {
printf("DATA_ENGLISH");
} else if (prtype == DATA_FINNISH) {
printf("DATA_FINNISH");
} else {
printf("prtype %lu", mtype);
}
}
printf(" len %lu prec %lu", len, type->prec);
}