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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
17742635
Commit
17742635
authored
Nov 03, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.0
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
parents
840834c1
4b63b4ad
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
44 deletions
+45
-44
sql/mysql_priv.h
sql/mysql_priv.h
+0
-1
sql/sql_base.cc
sql/sql_base.cc
+2
-1
sql/sql_delete.cc
sql/sql_delete.cc
+2
-1
sql/sql_rename.cc
sql/sql_rename.cc
+4
-3
sql/sql_show.cc
sql/sql_show.cc
+2
-1
sql/sql_table.cc
sql/sql_table.cc
+10
-3
sql/sql_view.cc
sql/sql_view.cc
+24
-10
sql/sql_view.h
sql/sql_view.h
+1
-1
sql/table.cc
sql/table.cc
+0
-23
No files found.
sql/mysql_priv.h
View file @
17742635
...
@@ -1297,7 +1297,6 @@ int openfrm(THD *thd, const char *name,const char *alias,uint filestat,
...
@@ -1297,7 +1297,6 @@ int openfrm(THD *thd, const char *name,const char *alias,uint filestat,
int
readfrm
(
const
char
*
name
,
const
void
**
data
,
uint
*
length
);
int
readfrm
(
const
char
*
name
,
const
void
**
data
,
uint
*
length
);
int
writefrm
(
const
char
*
name
,
const
void
*
data
,
uint
len
);
int
writefrm
(
const
char
*
name
,
const
void
*
data
,
uint
len
);
int
closefrm
(
TABLE
*
table
);
int
closefrm
(
TABLE
*
table
);
db_type
get_table_type
(
THD
*
thd
,
const
char
*
name
);
int
read_string
(
File
file
,
gptr
*
to
,
uint
length
);
int
read_string
(
File
file
,
gptr
*
to
,
uint
length
);
void
free_blobs
(
TABLE
*
table
);
void
free_blobs
(
TABLE
*
table
);
int
set_zone
(
int
nr
,
int
min_zone
,
int
max_zone
);
int
set_zone
(
int
nr
,
int
min_zone
,
int
max_zone
);
...
...
sql/sql_base.cc
View file @
17742635
...
@@ -1193,10 +1193,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
...
@@ -1193,10 +1193,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*/
*/
{
{
char
path
[
FN_REFLEN
];
char
path
[
FN_REFLEN
];
db_type
not_used
;
strxnmov
(
path
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
table_list
->
db
,
"/"
,
strxnmov
(
path
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
table_list
->
db
,
"/"
,
table_list
->
table_name
,
reg_ext
,
NullS
);
table_list
->
table_name
,
reg_ext
,
NullS
);
(
void
)
unpack_filename
(
path
,
path
);
(
void
)
unpack_filename
(
path
,
path
);
if
(
mysql_frm_type
(
path
)
==
FRMTYPE_VIEW
)
if
(
mysql_frm_type
(
thd
,
path
,
&
not_used
)
==
FRMTYPE_VIEW
)
{
{
TABLE
tab
;
// will not be used (because it's VIEW) but have to be passed
TABLE
tab
;
// will not be used (because it's VIEW) but have to be passed
table
=
&
tab
;
table
=
&
tab
;
...
...
sql/sql_delete.cc
View file @
17742635
...
@@ -833,7 +833,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
...
@@ -833,7 +833,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
if
(
!
dont_send_ok
)
if
(
!
dont_send_ok
)
{
{
db_type
table_type
;
db_type
table_type
;
if
((
table_type
=
get_table_type
(
thd
,
path
))
==
DB_TYPE_UNKNOWN
)
mysql_frm_type
(
thd
,
path
,
&
table_type
);
if
(
table_type
==
DB_TYPE_UNKNOWN
)
{
{
my_error
(
ER_NO_SUCH_TABLE
,
MYF
(
0
),
my_error
(
ER_NO_SUCH_TABLE
,
MYF
(
0
),
table_list
->
db
,
table_list
->
table_name
);
table_list
->
db
,
table_list
->
table_name
);
...
...
sql/sql_rename.cc
View file @
17742635
...
@@ -134,6 +134,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
...
@@ -134,6 +134,8 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
{
{
TABLE_LIST
*
ren_table
,
*
new_table
;
TABLE_LIST
*
ren_table
,
*
new_table
;
frm_type_enum
frm_type
;
frm_type_enum
frm_type
;
db_type
table_type
;
DBUG_ENTER
(
"rename_tables"
);
DBUG_ENTER
(
"rename_tables"
);
for
(
ren_table
=
table_list
;
ren_table
;
ren_table
=
new_table
->
next_local
)
for
(
ren_table
=
table_list
;
ren_table
;
ren_table
=
new_table
->
next_local
)
...
@@ -166,13 +168,12 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
...
@@ -166,13 +168,12 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
reg_ext
);
reg_ext
);
unpack_filename
(
name
,
name
);
unpack_filename
(
name
,
name
);
frm_type
=
mysql_frm_type
(
nam
e
);
frm_type
=
mysql_frm_type
(
thd
,
name
,
&
table_typ
e
);
switch
(
frm_type
)
switch
(
frm_type
)
{
{
case
FRMTYPE_TABLE
:
case
FRMTYPE_TABLE
:
{
{
db_type
table_type
;
if
(
table_type
==
DB_TYPE_UNKNOWN
)
if
((
table_type
=
get_table_type
(
thd
,
name
))
==
DB_TYPE_UNKNOWN
)
my_error
(
ER_FILE_NOT_FOUND
,
MYF
(
0
),
name
,
my_errno
);
my_error
(
ER_FILE_NOT_FOUND
,
MYF
(
0
),
name
,
my_errno
);
else
else
rc
=
mysql_rename_table
(
table_type
,
ren_table
->
db
,
old_alias
,
rc
=
mysql_rename_table
(
table_type
,
ren_table
->
db
,
old_alias
,
...
...
sql/sql_show.cc
View file @
17742635
...
@@ -2006,6 +2006,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -2006,6 +2006,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
Security_context
*
sctx
=
thd
->
security_ctx
;
Security_context
*
sctx
=
thd
->
security_ctx
;
uint
derived_tables
=
lex
->
derived_tables
;
uint
derived_tables
=
lex
->
derived_tables
;
int
error
=
1
;
int
error
=
1
;
db_type
not_used
;
Open_tables_state
open_tables_state_backup
;
Open_tables_state
open_tables_state_backup
;
DBUG_ENTER
(
"get_all_tables"
);
DBUG_ENTER
(
"get_all_tables"
);
...
@@ -2117,7 +2118,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -2117,7 +2118,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
else
else
{
{
my_snprintf
(
end
,
len
,
"/%s%s"
,
file_name
,
reg_ext
);
my_snprintf
(
end
,
len
,
"/%s%s"
,
file_name
,
reg_ext
);
switch
(
mysql_frm_type
(
path
))
{
switch
(
mysql_frm_type
(
thd
,
path
,
&
not_used
))
{
case
FRMTYPE_ERROR
:
case
FRMTYPE_ERROR
:
table
->
field
[
3
]
->
store
(
"ERROR"
,
5
,
system_charset_info
);
table
->
field
[
3
]
->
store
(
"ERROR"
,
5
,
system_charset_info
);
break
;
break
;
...
...
sql/sql_table.cc
View file @
17742635
...
@@ -218,6 +218,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -218,6 +218,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
String
wrong_tables
;
String
wrong_tables
;
int
error
;
int
error
;
bool
some_tables_deleted
=
0
,
tmp_table_deleted
=
0
,
foreign_key_error
=
0
;
bool
some_tables_deleted
=
0
,
tmp_table_deleted
=
0
,
foreign_key_error
=
0
;
DBUG_ENTER
(
"mysql_rm_table_part2"
);
DBUG_ENTER
(
"mysql_rm_table_part2"
);
if
(
lock_table_names
(
thd
,
tables
))
if
(
lock_table_names
(
thd
,
tables
))
...
@@ -229,6 +230,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -229,6 +230,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
{
{
char
*
db
=
table
->
db
;
char
*
db
=
table
->
db
;
db_type
table_type
=
DB_TYPE_UNKNOWN
;
mysql_ha_flush
(
thd
,
table
,
MYSQL_HA_CLOSE_FINAL
);
mysql_ha_flush
(
thd
,
table
,
MYSQL_HA_CLOSE_FINAL
);
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
table_name
))
if
(
!
close_temporary_table
(
thd
,
db
,
table
->
table_name
))
{
{
...
@@ -256,7 +259,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -256,7 +259,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if
(
drop_temporary
||
if
(
drop_temporary
||
(
access
(
path
,
F_OK
)
&&
(
access
(
path
,
F_OK
)
&&
ha_create_table_from_engine
(
thd
,
db
,
alias
))
||
ha_create_table_from_engine
(
thd
,
db
,
alias
))
||
(
!
drop_view
&&
mysql_frm_type
(
path
)
!=
FRMTYPE_TABLE
))
(
!
drop_view
&&
mysql_frm_type
(
thd
,
path
,
&
table_type
)
!=
FRMTYPE_TABLE
))
{
{
// Table was not found on disk and table can't be created from engine
// Table was not found on disk and table can't be created from engine
if
(
if_exists
)
if
(
if_exists
)
...
@@ -269,7 +273,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
...
@@ -269,7 +273,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
else
else
{
{
char
*
end
;
char
*
end
;
db_type
table_type
=
get_table_type
(
thd
,
path
);
if
(
table_type
==
DB_TYPE_UNKNOWN
)
mysql_frm_type
(
thd
,
path
,
&
table_type
);
*
(
end
=
fn_ext
(
path
))
=
0
;
// Remove extension for delete
*
(
end
=
fn_ext
(
path
))
=
0
;
// Remove extension for delete
error
=
ha_delete_table
(
thd
,
table_type
,
path
,
table
->
table_name
,
error
=
ha_delete_table
(
thd
,
table_type
,
path
,
table
->
table_name
,
!
dont_log_query
);
!
dont_log_query
);
...
@@ -2617,6 +2622,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
...
@@ -2617,6 +2622,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
char
*
src_table
=
table_ident
->
table
.
str
;
char
*
src_table
=
table_ident
->
table
.
str
;
int
err
;
int
err
;
bool
res
=
TRUE
;
bool
res
=
TRUE
;
db_type
not_used
;
TABLE_LIST
src_tables_list
;
TABLE_LIST
src_tables_list
;
DBUG_ENTER
(
"mysql_create_like_table"
);
DBUG_ENTER
(
"mysql_create_like_table"
);
src_db
=
table_ident
->
db
.
str
?
table_ident
->
db
.
str
:
thd
->
db
;
src_db
=
table_ident
->
db
.
str
?
table_ident
->
db
.
str
:
thd
->
db
;
...
@@ -2664,7 +2671,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
...
@@ -2664,7 +2671,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
/*
/*
create like should be not allowed for Views, Triggers, ...
create like should be not allowed for Views, Triggers, ...
*/
*/
if
(
mysql_frm_type
(
src_path
)
!=
FRMTYPE_TABLE
)
if
(
mysql_frm_type
(
thd
,
src_path
,
&
not_used
)
!=
FRMTYPE_TABLE
)
{
{
my_error
(
ER_WRONG_OBJECT
,
MYF
(
0
),
src_db
,
src_table
,
"BASE TABLE"
);
my_error
(
ER_WRONG_OBJECT
,
MYF
(
0
),
src_db
,
src_table
,
"BASE TABLE"
);
goto
err
;
goto
err
;
...
...
sql/sql_view.cc
View file @
17742635
...
@@ -1171,6 +1171,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
...
@@ -1171,6 +1171,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
char
path
[
FN_REFLEN
];
char
path
[
FN_REFLEN
];
TABLE_LIST
*
view
;
TABLE_LIST
*
view
;
bool
type
=
0
;
bool
type
=
0
;
db_type
not_used
;
for
(
view
=
views
;
view
;
view
=
view
->
next_local
)
for
(
view
=
views
;
view
;
view
=
view
->
next_local
)
{
{
...
@@ -1178,7 +1179,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
...
@@ -1178,7 +1179,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
view
->
table_name
,
reg_ext
,
NullS
);
view
->
table_name
,
reg_ext
,
NullS
);
(
void
)
unpack_filename
(
path
,
path
);
(
void
)
unpack_filename
(
path
,
path
);
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
access
(
path
,
F_OK
)
||
(
type
=
(
mysql_frm_type
(
path
)
!=
FRMTYPE_VIEW
)))
if
(
access
(
path
,
F_OK
)
||
(
type
=
(
mysql_frm_type
(
thd
,
path
,
&
not_used
)
!=
FRMTYPE_VIEW
)))
{
{
char
name
[
FN_REFLEN
];
char
name
[
FN_REFLEN
];
my_snprintf
(
name
,
sizeof
(
name
),
"%s.%s"
,
view
->
db
,
view
->
table_name
);
my_snprintf
(
name
,
sizeof
(
name
),
"%s.%s"
,
view
->
db
,
view
->
table_name
);
...
@@ -1225,24 +1227,36 @@ err:
...
@@ -1225,24 +1227,36 @@ err:
FRMTYPE_VIEW view
FRMTYPE_VIEW view
*/
*/
frm_type_enum
mysql_frm_type
(
char
*
path
)
frm_type_enum
mysql_frm_type
(
THD
*
thd
,
char
*
path
,
db_type
*
dbt
)
{
{
File
file
;
File
file
;
char
header
[
10
];
//"TYPE=VIEW\n" it is 10 characters
u
char
header
[
10
];
//"TYPE=VIEW\n" it is 10 characters
int
length
;
int
error
;
DBUG_ENTER
(
"mysql_frm_type"
);
DBUG_ENTER
(
"mysql_frm_type"
);
*
dbt
=
DB_TYPE_UNKNOWN
;
if
((
file
=
my_open
(
path
,
O_RDONLY
|
O_SHARE
,
MYF
(
0
)))
<
0
)
if
((
file
=
my_open
(
path
,
O_RDONLY
|
O_SHARE
,
MYF
(
0
)))
<
0
)
{
DBUG_RETURN
(
FRMTYPE_ERROR
);
DBUG_RETURN
(
FRMTYPE_ERROR
);
}
error
=
my_read
(
file
,
(
byte
*
)
header
,
sizeof
(
header
),
MYF
(
MY_WME
|
MY_NABP
));
length
=
my_read
(
file
,
(
byte
*
)
header
,
sizeof
(
header
),
MYF
(
MY_WME
));
my_close
(
file
,
MYF
(
MY_WME
));
my_close
(
file
,
MYF
(
MY_WME
));
if
(
length
==
(
int
)
MY_FILE_ERROR
)
if
(
error
)
DBUG_RETURN
(
FRMTYPE_ERROR
);
DBUG_RETURN
(
FRMTYPE_ERROR
);
if
(
length
<
(
int
)
sizeof
(
header
)
||
if
(
!
strncmp
((
char
*
)
header
,
"TYPE=VIEW
\n
"
,
sizeof
(
header
)))
!
strncmp
(
header
,
"TYPE=VIEW
\n
"
,
sizeof
(
header
)))
DBUG_RETURN
(
FRMTYPE_VIEW
);
DBUG_RETURN
(
FRMTYPE_VIEW
);
/*
This is just a check for DB_TYPE. We'll return default unknown type
if the following test is true (arg #3). This should not have effect
on return value from this function (default FRMTYPE_TABLE)
*/
if
(
header
[
0
]
!=
(
uchar
)
254
||
header
[
1
]
!=
1
||
(
header
[
2
]
!=
FRM_VER
&&
header
[
2
]
!=
FRM_VER
+
1
&&
(
header
[
2
]
<
FRM_VER
+
3
||
header
[
2
]
>
FRM_VER
+
4
)))
DBUG_RETURN
(
FRMTYPE_TABLE
);
*
dbt
=
ha_checktype
(
thd
,
(
enum
db_type
)
(
uint
)
*
(
header
+
3
),
0
,
0
);
DBUG_RETURN
(
FRMTYPE_TABLE
);
// Is probably a .frm table
DBUG_RETURN
(
FRMTYPE_TABLE
);
// Is probably a .frm table
}
}
...
...
sql/sql_view.h
View file @
17742635
...
@@ -27,7 +27,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST * view);
...
@@ -27,7 +27,7 @@ bool check_key_in_view(THD *thd, TABLE_LIST * view);
bool
insert_view_fields
(
THD
*
thd
,
List
<
Item
>
*
list
,
TABLE_LIST
*
view
);
bool
insert_view_fields
(
THD
*
thd
,
List
<
Item
>
*
list
,
TABLE_LIST
*
view
);
frm_type_enum
mysql_frm_type
(
char
*
path
);
frm_type_enum
mysql_frm_type
(
THD
*
thd
,
char
*
path
,
db_type
*
dbt
);
int
view_checksum
(
THD
*
thd
,
TABLE_LIST
*
view
);
int
view_checksum
(
THD
*
thd
,
TABLE_LIST
*
view
);
...
...
sql/table.cc
View file @
17742635
...
@@ -1693,29 +1693,6 @@ bool check_column_name(const char *name)
...
@@ -1693,29 +1693,6 @@ bool check_column_name(const char *name)
return
last_char_is_space
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
return
last_char_is_space
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
}
}
/*
** Get type of table from .frm file
*/
db_type
get_table_type
(
THD
*
thd
,
const
char
*
name
)
{
File
file
;
uchar
head
[
4
];
int
error
;
DBUG_ENTER
(
"get_table_type"
);
DBUG_PRINT
(
"enter"
,(
"name: '%s'"
,
name
));
if
((
file
=
my_open
(
name
,
O_RDONLY
,
MYF
(
0
)))
<
0
)
DBUG_RETURN
(
DB_TYPE_UNKNOWN
);
error
=
my_read
(
file
,(
byte
*
)
head
,
4
,
MYF
(
MY_NABP
));
my_close
(
file
,
MYF
(
0
));
if
(
error
||
head
[
0
]
!=
(
uchar
)
254
||
head
[
1
]
!=
1
||
(
head
[
2
]
!=
FRM_VER
&&
head
[
2
]
!=
FRM_VER
+
1
&&
(
head
[
2
]
<
FRM_VER
+
3
||
head
[
2
]
>
FRM_VER
+
4
)))
DBUG_RETURN
(
DB_TYPE_UNKNOWN
);
DBUG_RETURN
(
ha_checktype
(
thd
,(
enum
db_type
)
(
uint
)
*
(
head
+
3
),
0
,
0
));
}
/*
/*
Create Item_field for each column in the table.
Create Item_field for each column in the table.
...
...
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