Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
844359b8
Commit
844359b8
authored
Jan 13, 2010
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: dict_sys_tables_get_flags(), dict_create_sys_*_tuple():
Add some const qualifiers and comments.
parent
0af43fe4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
47 deletions
+57
-47
dict/dict0crea.c
dict/dict0crea.c
+56
-46
dict/dict0load.c
dict/dict0load.c
+1
-1
No files found.
dict/dict0crea.c
View file @
844359b8
...
...
@@ -51,16 +51,18 @@ static
dtuple_t
*
dict_create_sys_tables_tuple
(
/*=========================*/
dict_table_t
*
table
,
/*!< in: table */
mem_heap_t
*
heap
)
/*!< in: memory heap from which the memory for
the built tuple is allocated */
const
dict_table_t
*
table
,
/*!< in: table */
mem_heap_t
*
heap
)
/*!< in: memory heap from
which the memory for the built
tuple is allocated */
{
dict_table_t
*
sys_tables
;
dtuple_t
*
entry
;
dfield_t
*
dfield
;
byte
*
ptr
;
ut_ad
(
table
&&
heap
);
ut_ad
(
table
);
ut_ad
(
heap
);
sys_tables
=
dict_sys
->
sys_tables
;
...
...
@@ -69,18 +71,18 @@ dict_create_sys_tables_tuple(
dict_table_copy_types
(
entry
,
sys_tables
);
/* 0: NAME -----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
0
);
dfield
=
dtuple_get_nth_field
(
entry
,
0
/*NAME*/
);
dfield_set_data
(
dfield
,
table
->
name
,
ut_strlen
(
table
->
name
));
/* 3: ID -------------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
1
);
dfield
=
dtuple_get_nth_field
(
entry
,
1
/*ID*/
);
ptr
=
mem_heap_alloc
(
heap
,
8
);
mach_write_to_8
(
ptr
,
table
->
id
);
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 4: N_COLS ---------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
2
);
dfield
=
dtuple_get_nth_field
(
entry
,
2
/*N_COLS*/
);
#if DICT_TF_COMPACT != 1
#error
...
...
@@ -91,7 +93,7 @@ dict_create_sys_tables_tuple(
|
((
table
->
flags
&
DICT_TF_COMPACT
)
<<
31
));
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 5: TYPE -----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
3
);
dfield
=
dtuple_get_nth_field
(
entry
,
3
/*TYPE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
if
(
table
->
flags
&
(
~
DICT_TF_COMPACT
&
~
(
~
0
<<
DICT_TF_BITS
)))
{
...
...
@@ -107,25 +109,25 @@ dict_create_sys_tables_tuple(
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 6: MIX_ID (obsolete) ---------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
4
);
dfield
=
dtuple_get_nth_field
(
entry
,
4
/*MIX_ID*/
);
ptr
=
mem_heap_zalloc
(
heap
,
8
);
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 7: MIX_LEN (additional flags) --------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
5
);
dfield
=
dtuple_get_nth_field
(
entry
,
5
/*MIX_LEN*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
table
->
flags
>>
DICT_TF2_SHIFT
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 8: CLUSTER_NAME ---------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
6
);
dfield
=
dtuple_get_nth_field
(
entry
,
6
/*CLUSTER_NAME*/
);
dfield_set_null
(
dfield
);
/* not supported */
/* 9: SPACE ----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
7
);
dfield
=
dtuple_get_nth_field
(
entry
,
7
/*SPACE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
table
->
space
);
...
...
@@ -144,10 +146,11 @@ static
dtuple_t
*
dict_create_sys_columns_tuple
(
/*==========================*/
dict_table_t
*
table
,
/*!< in: table */
const
dict_table_t
*
table
,
/*!< in: table */
ulint
i
,
/*!< in: column number */
mem_heap_t
*
heap
)
/*!< in: memory heap from which the memory for
the built tuple is allocated */
mem_heap_t
*
heap
)
/*!< in: memory heap from
which the memory for the built
tuple is allocated */
{
dict_table_t
*
sys_columns
;
dtuple_t
*
entry
;
...
...
@@ -156,7 +159,8 @@ dict_create_sys_columns_tuple(
byte
*
ptr
;
const
char
*
col_name
;
ut_ad
(
table
&&
heap
);
ut_ad
(
table
);
ut_ad
(
heap
);
column
=
dict_table_get_nth_col
(
table
,
i
);
...
...
@@ -167,47 +171,47 @@ dict_create_sys_columns_tuple(
dict_table_copy_types
(
entry
,
sys_columns
);
/* 0: TABLE_ID -----------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
0
);
dfield
=
dtuple_get_nth_field
(
entry
,
0
/*TABLE_ID*/
);
ptr
=
mem_heap_alloc
(
heap
,
8
);
mach_write_to_8
(
ptr
,
table
->
id
);
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 1: POS ----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
1
);
dfield
=
dtuple_get_nth_field
(
entry
,
1
/*POS*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
i
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 4: NAME ---------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
2
);
dfield
=
dtuple_get_nth_field
(
entry
,
2
/*NAME*/
);
col_name
=
dict_table_get_col_name
(
table
,
i
);
dfield_set_data
(
dfield
,
col_name
,
ut_strlen
(
col_name
));
/* 5: MTYPE --------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
3
);
dfield
=
dtuple_get_nth_field
(
entry
,
3
/*MTYPE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
column
->
mtype
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 6: PRTYPE -------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
4
);
dfield
=
dtuple_get_nth_field
(
entry
,
4
/*PRTYPE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
column
->
prtype
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 7: LEN ----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
5
);
dfield
=
dtuple_get_nth_field
(
entry
,
5
/*LEN*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
column
->
len
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 8: PREC ---------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
6
);
dfield
=
dtuple_get_nth_field
(
entry
,
6
/*PREC*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
0
/* unused */
);
...
...
@@ -325,9 +329,10 @@ static
dtuple_t
*
dict_create_sys_indexes_tuple
(
/*==========================*/
dict_index_t
*
index
,
/*!< in: index */
mem_heap_t
*
heap
)
/*!< in: memory heap from which the memory for
the built tuple is allocated */
const
dict_index_t
*
index
,
/*!< in: index */
mem_heap_t
*
heap
)
/*!< in: memory heap from
which the memory for the built
tuple is allocated */
{
dict_table_t
*
sys_indexes
;
dict_table_t
*
table
;
...
...
@@ -336,7 +341,8 @@ dict_create_sys_indexes_tuple(
byte
*
ptr
;
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
ut_ad
(
index
&&
heap
);
ut_ad
(
index
);
ut_ad
(
heap
);
sys_indexes
=
dict_sys
->
sys_indexes
;
...
...
@@ -347,32 +353,32 @@ dict_create_sys_indexes_tuple(
dict_table_copy_types
(
entry
,
sys_indexes
);
/* 0: TABLE_ID -----------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
0
);
dfield
=
dtuple_get_nth_field
(
entry
,
0
/*TABLE_ID*/
);
ptr
=
mem_heap_alloc
(
heap
,
8
);
mach_write_to_8
(
ptr
,
table
->
id
);
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 1: ID ----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
1
);
dfield
=
dtuple_get_nth_field
(
entry
,
1
/*ID*/
);
ptr
=
mem_heap_alloc
(
heap
,
8
);
mach_write_to_8
(
ptr
,
index
->
id
);
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 4: NAME --------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
2
);
dfield
=
dtuple_get_nth_field
(
entry
,
2
/*NAME*/
);
dfield_set_data
(
dfield
,
index
->
name
,
ut_strlen
(
index
->
name
));
/* 5: N_FIELDS ----------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
3
);
dfield
=
dtuple_get_nth_field
(
entry
,
3
/*N_FIELDS*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
index
->
n_fields
);
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 6: TYPE --------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
4
);
dfield
=
dtuple_get_nth_field
(
entry
,
4
/*TYPE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
index
->
type
);
...
...
@@ -384,7 +390,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_SPACE_NO_FIELD != 7"
#endif
dfield
=
dtuple_get_nth_field
(
entry
,
5
);
dfield
=
dtuple_get_nth_field
(
entry
,
5
/*SPACE*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
index
->
space
);
...
...
@@ -396,7 +402,7 @@ dict_create_sys_indexes_tuple(
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 8"
#endif
dfield
=
dtuple_get_nth_field
(
entry
,
6
);
dfield
=
dtuple_get_nth_field
(
entry
,
6
/*PAGE_NO*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
mach_write_to_4
(
ptr
,
FIL_NULL
);
...
...
@@ -415,10 +421,11 @@ static
dtuple_t
*
dict_create_sys_fields_tuple
(
/*=========================*/
dict_index_t
*
index
,
/*!< in: index */
const
dict_index_t
*
index
,
/*!< in: index */
ulint
i
,
/*!< in: field number */
mem_heap_t
*
heap
)
/*!< in: memory heap from which the memory for
the built tuple is allocated */
mem_heap_t
*
heap
)
/*!< in: memory heap from
which the memory for the built
tuple is allocated */
{
dict_table_t
*
sys_fields
;
dtuple_t
*
entry
;
...
...
@@ -428,7 +435,8 @@ dict_create_sys_fields_tuple(
ibool
index_contains_column_prefix_field
=
FALSE
;
ulint
j
;
ut_ad
(
index
&&
heap
);
ut_ad
(
index
);
ut_ad
(
heap
);
for
(
j
=
0
;
j
<
index
->
n_fields
;
j
++
)
{
if
(
dict_index_get_nth_field
(
index
,
j
)
->
prefix_len
>
0
)
{
...
...
@@ -446,7 +454,7 @@ dict_create_sys_fields_tuple(
dict_table_copy_types
(
entry
,
sys_fields
);
/* 0: INDEX_ID -----------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
0
);
dfield
=
dtuple_get_nth_field
(
entry
,
0
/*INDEX_ID*/
);
ptr
=
mem_heap_alloc
(
heap
,
8
);
mach_write_to_8
(
ptr
,
index
->
id
);
...
...
@@ -454,7 +462,7 @@ dict_create_sys_fields_tuple(
dfield_set_data
(
dfield
,
ptr
,
8
);
/* 1: POS + PREFIX LENGTH ----------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
1
);
dfield
=
dtuple_get_nth_field
(
entry
,
1
/*POS*/
);
ptr
=
mem_heap_alloc
(
heap
,
4
);
...
...
@@ -474,7 +482,7 @@ dict_create_sys_fields_tuple(
dfield_set_data
(
dfield
,
ptr
,
4
);
/* 4: COL_NAME -------------------------*/
dfield
=
dtuple_get_nth_field
(
entry
,
2
);
dfield
=
dtuple_get_nth_field
(
entry
,
2
/*COL_NAME*/
);
dfield_set_data
(
dfield
,
field
->
name
,
ut_strlen
(
field
->
name
));
...
...
@@ -605,6 +613,7 @@ dict_create_index_tree_step(
dict_table_t
*
sys_indexes
;
dict_table_t
*
table
;
dtuple_t
*
search_tuple
;
ulint
zip_size
;
btr_pcur_t
pcur
;
mtr_t
mtr
;
...
...
@@ -629,8 +638,9 @@ dict_create_index_tree_step(
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
node
->
page_no
=
btr_create
(
index
->
type
,
index
->
space
,
dict_table_zip_size
(
index
->
table
),
zip_size
=
dict_table_zip_size
(
index
->
table
);
node
->
page_no
=
btr_create
(
index
->
type
,
index
->
space
,
zip_size
,
index
->
id
,
index
,
&
mtr
);
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
...
...
dict/dict0load.c
View file @
844359b8
...
...
@@ -260,7 +260,7 @@ dict_sys_tables_get_flags(
return
(
0
);
}
field
=
rec_get_nth_field_old
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field_old
(
rec
,
4
/*N_COLS*/
,
&
len
);
n_cols
=
mach_read_from_4
(
field
);
if
(
UNIV_UNLIKELY
(
!
(
n_cols
&
0x80000000UL
)))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment