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
44b4e9fc
Commit
44b4e9fc
authored
Sep 29, 2005
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/mysql-5.0
parents
f85dd7ce
e445a3d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
sql/sql_view.cc
sql/sql_view.cc
+20
-8
No files found.
sql/sql_view.cc
View file @
44b4e9fc
...
@@ -1394,12 +1394,13 @@ int view_checksum(THD *thd, TABLE_LIST *view)
...
@@ -1394,12 +1394,13 @@ int view_checksum(THD *thd, TABLE_LIST *view)
*/
*/
bool
bool
mysql_rename_view
(
THD
*
thd
,
mysql_rename_view
(
THD
*
thd
,
const
char
*
new_name
,
const
char
*
new_name
,
TABLE_LIST
*
view
)
TABLE_LIST
*
view
)
{
{
LEX_STRING
pathstr
,
file
;
LEX_STRING
pathstr
,
file
;
File_parser
*
parser
;
File_parser
*
parser
;
char
view_path
[
FN_REFLEN
];
char
view_path
[
FN_REFLEN
];
bool
error
=
TRUE
;
DBUG_ENTER
(
"mysql_rename_view"
);
DBUG_ENTER
(
"mysql_rename_view"
);
...
@@ -1411,19 +1412,20 @@ mysql_rename_view(THD *thd,
...
@@ -1411,19 +1412,20 @@ mysql_rename_view(THD *thd,
pathstr
.
length
=
strlen
(
view_path
);
pathstr
.
length
=
strlen
(
view_path
);
if
((
parser
=
sql_parse_prepare
(
&
pathstr
,
thd
->
mem_root
,
1
))
&&
if
((
parser
=
sql_parse_prepare
(
&
pathstr
,
thd
->
mem_root
,
1
))
&&
is_equal
(
&
view_type
,
parser
->
type
()))
{
is_equal
(
&
view_type
,
parser
->
type
()))
{
char
dir_buff
[
FN_REFLEN
],
file_buff
[
FN_REFLEN
];
char
dir_buff
[
FN_REFLEN
],
file_buff
[
FN_REFLEN
];
/* get view definition and source */
/* get view definition and source */
if
(
mysql_make_view
(
parser
,
view
)
||
if
(
mysql_make_view
(
parser
,
view
)
||
parser
->
parse
((
gptr
)
view
,
thd
->
mem_root
,
parser
->
parse
((
gptr
)
view
,
thd
->
mem_root
,
view_parameters
+
source_number_position
,
1
))
view_parameters
+
source_number_position
,
1
))
DBUG_RETURN
(
1
)
;
goto
err
;
/* rename view and it's backups */
/* rename view and it's backups */
if
(
rename_in_schema_file
(
view
->
db
,
view
->
table_name
,
new_name
,
if
(
rename_in_schema_file
(
view
->
db
,
view
->
table_name
,
new_name
,
view
->
revision
-
1
,
num_view_backups
))
view
->
revision
-
1
,
num_view_backups
))
DBUG_RETURN
(
1
)
;
goto
err
;
strxnmov
(
dir_buff
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
view
->
db
,
"/"
,
NullS
);
strxnmov
(
dir_buff
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
view
->
db
,
"/"
,
NullS
);
(
void
)
unpack_filename
(
dir_buff
,
dir_buff
);
(
void
)
unpack_filename
(
dir_buff
,
dir_buff
);
...
@@ -1436,11 +1438,13 @@ mysql_rename_view(THD *thd,
...
@@ -1436,11 +1438,13 @@ mysql_rename_view(THD *thd,
-
file_buff
);
-
file_buff
);
if
(
sql_create_definition_file
(
&
pathstr
,
&
file
,
view_file_type
,
if
(
sql_create_definition_file
(
&
pathstr
,
&
file
,
view_file_type
,
(
gptr
)
view
,
view_parameters
,
num_view_backups
))
{
(
gptr
)
view
,
view_parameters
,
num_view_backups
))
{
/* restore renamed view in case of error */
/* restore renamed view in case of error */
rename_in_schema_file
(
view
->
db
,
new_name
,
view
->
table_name
,
rename_in_schema_file
(
view
->
db
,
new_name
,
view
->
table_name
,
view
->
revision
-
1
,
num_view_backups
);
view
->
revision
-
1
,
num_view_backups
);
DBUG_RETURN
(
1
)
;
goto
err
;
}
}
}
else
}
else
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -1448,5 +1452,13 @@ mysql_rename_view(THD *thd,
...
@@ -1448,5 +1452,13 @@ mysql_rename_view(THD *thd,
/* remove cache entries */
/* remove cache entries */
query_cache_invalidate3
(
thd
,
view
,
0
);
query_cache_invalidate3
(
thd
,
view
,
0
);
sp_cache_invalidate
();
sp_cache_invalidate
();
DBUG_RETURN
(
0
);
error
=
FALSE
;
err:
/*
We have to explicitly call destructor for view's LEX since it won't
be called otherwise.
*/
delete
view
->
view
;
DBUG_RETURN
(
error
);
}
}
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