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
d5141749
Commit
d5141749
authored
1 year ago
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: extract ha_create_table_from_share()
parent
98e7a3ee
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
27 deletions
+33
-27
sql/handler.cc
sql/handler.cc
+33
-27
No files found.
sql/handler.cc
View file @
d5141749
...
...
@@ -6318,6 +6318,38 @@ int handler::calculate_checksum()
** Some general functions that isn't in the handler class
****************************************************************************/
static
int
ha_create_table_from_share
(
THD
*
thd
,
TABLE_SHARE
*
share
,
HA_CREATE_INFO
*
create_info
)
{
TABLE
table
;
bool
is_tmp
__attribute__
((
unused
))
=
create_info
->
options
&
(
HA_LEX_CREATE_TMP_TABLE
|
HA_CREATE_TMP_ALTER
);
share
->
m_psi
=
PSI_CALL_get_table_share
(
is_tmp
,
share
);
if
(
open_table_from_share
(
thd
,
share
,
&
empty_clex_str
,
0
,
READ_ALL
,
0
,
&
table
,
true
))
return
1
;
update_create_info_from_table
(
create_info
,
&
table
);
Table_path_buffer
name_buff
;
Lex_cstring
name
=
table
.
file
->
get_canonical_filename
(
share
->
path
,
&
name_buff
);
int
error
=
table
.
file
->
ha_create
(
name
.
str
,
&
table
,
create_info
);
if
(
error
)
{
if
(
!
thd
->
is_error
())
my_error
(
ER_CANT_CREATE_TABLE
,
MYF
(
0
),
share
->
db
.
str
,
share
->
table_name
.
str
,
error
);
table
.
file
->
print_error
(
error
,
MYF
(
ME_WARNING
));
PSI_CALL_drop_table_share
(
is_tmp
,
share
->
db
.
str
,
(
uint
)
share
->
db
.
length
,
share
->
table_name
.
str
,
(
uint
)
share
->
table_name
.
length
);
}
(
void
)
closefrm
(
&
table
);
return
error
;
}
/**
Initiates table-file and calls appropriate database-creator.
...
...
@@ -6339,13 +6371,8 @@ int ha_create_table(THD *thd, const char *path, const char *db,
LEX_CUSTRING
*
frm
,
bool
skip_frm_file
)
{
int
error
=
1
;
TABLE
table
;
Table_path_buffer
name_buff
;
const
char
*
name
;
TABLE_SHARE
share
;
Abort_on_warning_instant_set
old_abort_on_warning
(
thd
,
0
);
bool
temp_table
__attribute__
((
unused
))
=
create_info
->
options
&
(
HA_LEX_CREATE_TMP_TABLE
|
HA_CREATE_TMP_ALTER
);
DBUG_ENTER
(
"ha_create_table"
);
init_tmp_table_share
(
thd
,
&
share
,
db
,
0
,
table_name
,
path
);
...
...
@@ -6371,29 +6398,8 @@ int ha_create_table(THD *thd, const char *path, const char *db,
goto
err
;
}
share
.
m_psi
=
PSI_CALL_get_table_share
(
temp_table
,
&
share
);
if
(
open_table_from_share
(
thd
,
&
share
,
&
empty_clex_str
,
0
,
READ_ALL
,
0
,
&
table
,
true
))
goto
err
;
update_create_info_from_table
(
create_info
,
&
table
);
error
=
ha_create_table_from_share
(
thd
,
&
share
,
create_info
);
name
=
table
.
file
->
get_canonical_filename
(
share
.
path
,
&
name_buff
).
str
;
error
=
table
.
file
->
ha_create
(
name
,
&
table
,
create_info
);
if
(
unlikely
(
error
))
{
if
(
!
thd
->
is_error
())
my_error
(
ER_CANT_CREATE_TABLE
,
MYF
(
0
),
db
,
table_name
,
error
);
table
.
file
->
print_error
(
error
,
MYF
(
ME_WARNING
));
PSI_CALL_drop_table_share
(
temp_table
,
share
.
db
.
str
,
(
uint
)
share
.
db
.
length
,
share
.
table_name
.
str
,
(
uint
)
share
.
table_name
.
length
);
}
(
void
)
closefrm
(
&
table
);
err:
free_table_share
(
&
share
);
DBUG_RETURN
(
error
!=
0
);
...
...
This diff is collapsed.
Click to expand it.
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