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
9594107f
Commit
9594107f
authored
Apr 09, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanups
parent
5f69c8a5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
35 deletions
+30
-35
sql/datadict.cc
sql/datadict.cc
+17
-8
sql/datadict.h
sql/datadict.h
+2
-1
sql/sql_truncate.cc
sql/sql_truncate.cc
+2
-11
sql/unireg.cc
sql/unireg.cc
+8
-14
sql/unireg.h
sql/unireg.h
+1
-1
No files found.
sql/datadict.cc
View file @
9594107f
...
...
@@ -158,26 +158,35 @@ bool dd_check_storage_engine_flag(THD *thd,
@param thd Thread context.
@param db Name of the database to which the table belongs to.
@param name Table name.
@param path For temporary tables only - path to table files.
Otherwise NULL (the path is calculated from db and table names).
@retval FALSE Success.
@retval TRUE Error.
*/
bool
dd_recreate_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
)
bool
dd_recreate_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
const
char
*
path
)
{
bool
error
=
TRUE
;
HA_CREATE_INFO
create_info
;
char
path
[
FN_REFLEN
+
1
];
char
path
_buf
[
FN_REFLEN
+
1
];
DBUG_ENTER
(
"dd_recreate_table"
);
/* There should be a exclusive metadata lock on the table. */
DBUG_ASSERT
(
thd
->
mdl_context
.
is_lock_owner
(
MDL_key
::
TABLE
,
db
,
table_name
,
MDL_EXCLUSIVE
));
memset
(
&
create_info
,
0
,
sizeof
(
create_info
));
/* Create a path to the table, but without a extension. */
build_table_filename
(
path
,
sizeof
(
path
)
-
1
,
db
,
table_name
,
""
,
0
);
if
(
path
)
create_info
.
options
|=
HA_LEX_CREATE_TMP_TABLE
;
else
{
build_table_filename
(
path_buf
,
sizeof
(
path_buf
)
-
1
,
db
,
table_name
,
""
,
0
);
path
=
path_buf
;
/* There should be a exclusive metadata lock on the table. */
DBUG_ASSERT
(
thd
->
mdl_context
.
is_lock_owner
(
MDL_key
::
TABLE
,
db
,
table_name
,
MDL_EXCLUSIVE
));
}
/* Attempt to reconstruct the table. */
error
=
ha_create_table
(
thd
,
path
,
db
,
table_name
,
&
create_info
);
...
...
sql/datadict.h
View file @
9594107f
...
...
@@ -36,6 +36,7 @@ bool dd_check_storage_engine_flag(THD *thd,
const
char
*
db
,
const
char
*
table_name
,
uint32
flag
,
bool
*
yes_no
);
bool
dd_recreate_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
bool
dd_recreate_table
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
,
const
char
*
path
=
NULL
);
#endif // DATADICT_INCLUDED
sql/sql_truncate.cc
View file @
9594107f
...
...
@@ -258,25 +258,16 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
{
bool
error
=
TRUE
;
TABLE_SHARE
*
share
=
table
->
s
;
HA_CREATE_INFO
create_info
;
handlerton
*
table_type
=
table
->
s
->
db_type
();
DBUG_ENTER
(
"recreate_temporary_table"
);
memset
(
&
create_info
,
0
,
sizeof
(
create_info
));
create_info
.
options
|=
HA_LEX_CREATE_TMP_TABLE
;
table
->
file
->
info
(
HA_STATUS_AUTO
|
HA_STATUS_NO_LOCK
);
/* Don't free share. */
close_temporary_table
(
thd
,
table
,
FALSE
,
FALSE
);
/*
We must use share->normalized_path.str since for temporary tables it
differs from what dd_recreate_table() would generate based
on table and schema names.
*/
ha_create_table
(
thd
,
share
->
normalized_path
.
str
,
share
->
db
.
str
,
share
->
table_name
.
str
,
&
create_info
);
dd_recreate_table
(
thd
,
share
->
db
.
str
,
share
->
table_name
.
str
,
share
->
normalized_path
.
str
);
if
(
open_table_uncached
(
thd
,
share
->
path
.
str
,
share
->
db
.
str
,
share
->
table_name
.
str
,
TRUE
))
...
...
sql/unireg.cc
View file @
9594107f
...
...
@@ -49,11 +49,9 @@ static bool pack_header(uchar *forminfo,enum legacy_db_type table_type,
static
uint
get_interval_id
(
uint
*
,
List
<
Create_field
>
&
,
Create_field
*
);
static
bool
pack_fields
(
File
file
,
List
<
Create_field
>
&
create_fields
,
ulong
data_offset
);
static
bool
make_empty_rec
(
THD
*
thd
,
int
file
,
enum
legacy_db_type
table_type
,
uint
table_options
,
static
bool
make_empty_rec
(
THD
*
thd
,
int
file
,
uint
table_options
,
List
<
Create_field
>
&
create_fields
,
uint
reclength
,
ulong
data_offset
,
handler
*
handler
);
uint
reclength
,
ulong
data_offset
);
/**
An interceptor to hijack ER_TOO_MANY_FIELDS error from
...
...
@@ -102,8 +100,8 @@ handle_condition(THD *,
create_fields Fields to create
keys number of keys to create
key_info Keys to create
db_file Handler to use.
May be zero, in which case we use
create_info->db_type
db_file Handler to use.
RETURN
false ok
true error
...
...
@@ -317,9 +315,8 @@ bool mysql_create_frm(THD *thd, const char *file_name,
mysql_file_seek
(
file
,
(
ulong
)
uint2korr
(
fileinfo
+
6
)
+
(
ulong
)
key_buff_length
,
MY_SEEK_SET
,
MYF
(
0
));
if
(
make_empty_rec
(
thd
,
file
,
ha_legacy_type
(
create_info
->
db_type
),
create_info
->
table_options
,
create_fields
,
reclength
,
data_offset
,
db_file
))
if
(
make_empty_rec
(
thd
,
file
,
create_info
->
table_options
,
create_fields
,
reclength
,
data_offset
))
goto
err
;
int2store
(
buff
,
create_info
->
connect_string
.
length
);
...
...
@@ -1064,12 +1061,9 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
/* save an empty record on start of formfile */
static
bool
make_empty_rec
(
THD
*
thd
,
File
file
,
enum
legacy_db_type
table_type
,
uint
table_options
,
static
bool
make_empty_rec
(
THD
*
thd
,
File
file
,
uint
table_options
,
List
<
Create_field
>
&
create_fields
,
uint
reclength
,
ulong
data_offset
,
handler
*
handler
)
uint
reclength
,
ulong
data_offset
)
{
int
error
=
0
;
Field
::
utype
type
;
...
...
sql/unireg.h
View file @
9594107f
...
...
@@ -86,7 +86,7 @@
#define READ_ALL 1
/* openfrm: Read all parameters */
#define CHANGE_FRM 2
/* openfrm: open .frm as O_RDWR */
#define READ_KEYINFO 4
/* L{s nyckeldata fr}n filen */
#define EXTRA_RECORD 8
/* Reserve
ra plats f|r
extra record */
#define EXTRA_RECORD 8
/* Reserve
space for an
extra record */
#define DONT_OPEN_TABLES 8
/* Don't open database-files (frd) */
#define DONT_OPEN_MASTER_REG 16
/* Don't open first reg-file (prt) */
#define EXTRA_LONG_RECORD 16
/* Plats f|r dubbel s|k-record */
...
...
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