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
7e06b63e
Commit
7e06b63e
authored
Nov 27, 2019
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce code bloating in read_extra2()
parent
2f932e0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
sql/table.cc
sql/table.cc
+19
-24
No files found.
sql/table.cc
View file @
7e06b63e
...
@@ -1518,6 +1518,15 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
...
@@ -1518,6 +1518,15 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
size_t
length
=
extra2_read_len
(
&
extra2
,
e2end
);
size_t
length
=
extra2_read_len
(
&
extra2
,
e2end
);
if
(
!
length
)
if
(
!
length
)
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
auto
fill_extra2
=
[
extra2
,
length
](
LEX_CUSTRING
*
section
){
if
(
section
->
str
)
return
true
;
*
section
=
{
extra2
,
length
};
return
false
;
};
bool
fail
=
false
;
switch
(
type
)
{
switch
(
type
)
{
case
EXTRA2_TABLEDEF_VERSION
:
case
EXTRA2_TABLEDEF_VERSION
:
if
(
fields
->
version
.
str
)
// see init_from_sql_statement_string()
if
(
fields
->
version
.
str
)
// see init_from_sql_statement_string()
...
@@ -1532,49 +1541,35 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
...
@@ -1532,49 +1541,35 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
}
}
break
;
break
;
case
EXTRA2_ENGINE_TABLEOPTS
:
case
EXTRA2_ENGINE_TABLEOPTS
:
if
(
fields
->
options
.
str
)
fail
=
fill_extra2
(
&
fields
->
options
);
DBUG_RETURN
(
true
);
fields
->
options
.
str
=
extra2
;
fields
->
options
.
length
=
length
;
break
;
break
;
case
EXTRA2_DEFAULT_PART_ENGINE
:
case
EXTRA2_DEFAULT_PART_ENGINE
:
fields
->
engine
.
set
((
const
char
*
)
extra2
,
length
);
fields
->
engine
.
set
((
const
char
*
)
extra2
,
length
);
break
;
break
;
case
EXTRA2_GIS
:
case
EXTRA2_GIS
:
if
(
fields
->
gis
.
str
)
fail
=
fill_extra2
(
&
fields
->
gis
);
DBUG_RETURN
(
true
);
fields
->
gis
.
str
=
extra2
;
fields
->
gis
.
length
=
length
;
break
;
break
;
case
EXTRA2_PERIOD_FOR_SYSTEM_TIME
:
case
EXTRA2_PERIOD_FOR_SYSTEM_TIME
:
if
(
fields
->
system_period
.
str
||
length
!=
2
*
frm_fieldno_size
)
fail
=
fill_extra2
(
&
fields
->
system_period
)
DBUG_RETURN
(
true
);
||
length
!=
2
*
frm_fieldno_size
;
fields
->
system_period
.
str
=
extra2
;
fields
->
system_period
.
length
=
length
;
break
;
break
;
case
EXTRA2_FIELD_FLAGS
:
case
EXTRA2_FIELD_FLAGS
:
if
(
fields
->
field_flags
.
str
)
fail
=
fill_extra2
(
&
fields
->
field_flags
);
DBUG_RETURN
(
true
);
fields
->
field_flags
.
str
=
extra2
;
fields
->
field_flags
.
length
=
length
;
break
;
break
;
case
EXTRA2_APPLICATION_TIME_PERIOD
:
case
EXTRA2_APPLICATION_TIME_PERIOD
:
if
(
fields
->
application_period
.
str
)
fail
=
fill_extra2
(
&
fields
->
application_period
);
DBUG_RETURN
(
true
);
fields
->
application_period
.
str
=
extra2
;
fields
->
application_period
.
length
=
length
;
break
;
break
;
case
EXTRA2_FIELD_DATA_TYPE_INFO
:
case
EXTRA2_FIELD_DATA_TYPE_INFO
:
if
(
fields
->
field_data_type_info
.
str
)
fail
=
fill_extra2
(
&
fields
->
field_data_type_info
);
DBUG_RETURN
(
true
);
fields
->
field_data_type_info
.
str
=
extra2
;
fields
->
field_data_type_info
.
length
=
length
;
break
;
break
;
default:
default:
/* abort frm parsing if it's an unknown but important extra2 value */
/* abort frm parsing if it's an unknown but important extra2 value */
if
(
type
>=
EXTRA2_ENGINE_IMPORTANT
)
if
(
type
>=
EXTRA2_ENGINE_IMPORTANT
)
DBUG_RETURN
(
true
);
DBUG_RETURN
(
true
);
}
}
if
(
fail
)
DBUG_RETURN
(
true
);
extra2
+=
length
;
extra2
+=
length
;
}
}
if
(
extra2
!=
e2end
)
if
(
extra2
!=
e2end
)
...
...
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