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
3fa511ff
Commit
3fa511ff
authored
Nov 24, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-error-5.0
parents
9e467cc0
6d5d5ff9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
4 deletions
+75
-4
mysql-test/r/lowercase_view.result
mysql-test/r/lowercase_view.result
+16
-0
mysql-test/t/lowercase_view.test
mysql-test/t/lowercase_view.test
+15
-0
sql/item.cc
sql/item.cc
+10
-3
sql/item.h
sql/item.h
+1
-0
sql/sql_base.cc
sql/sql_base.cc
+4
-1
sql/sql_lex.cc
sql/sql_lex.cc
+27
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/table.h
sql/table.h
+1
-0
No files found.
mysql-test/r/lowercase_view.result
View file @
3fa511ff
...
...
@@ -22,3 +22,19 @@ insert into v2aA values ((select max(col1) from v1aA));
ERROR HY000: You can't specify target table 'v2aa' for update in FROM clause
drop view v2Aa,v1Aa;
drop table t1Aa,t2Aa;
create table t1Aa (col1 int);
create view v1Aa as select col1 from t1Aa as AaA;
show create view v1AA;
View Create View
v1aa CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1aa` AS select `aaa`.`col1` AS `col1` from `test`.`t1aa` `AaA`
drop view v1AA;
select Aaa.col1 from t1Aa as AaA;
col1
create view v1Aa as select Aaa.col1 from t1Aa as AaA;
drop view v1AA;
create view v1Aa as select AaA.col1 from t1Aa as AaA;
show create view v1AA;
View Create View
v1aa CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1aa` AS select `aaa`.`col1` AS `col1` from `test`.`t1aa` `AaA`
drop view v1AA;
drop table t1Aa;
mysql-test/t/lowercase_view.test
View file @
3fa511ff
...
...
@@ -32,3 +32,18 @@ delete from v2aA where col1 = (select max(col1) from v1aA);
insert
into
v2aA
values
((
select
max
(
col1
)
from
v1aA
));
drop
view
v2Aa
,
v1Aa
;
drop
table
t1Aa
,
t2Aa
;
#
# aliases in VIEWs
#
create
table
t1Aa
(
col1
int
);
create
view
v1Aa
as
select
col1
from
t1Aa
as
AaA
;
show
create
view
v1AA
;
drop
view
v1AA
;
select
Aaa
.
col1
from
t1Aa
as
AaA
;
create
view
v1Aa
as
select
Aaa
.
col1
from
t1Aa
as
AaA
;
drop
view
v1AA
;
create
view
v1Aa
as
select
AaA
.
col1
from
t1Aa
as
AaA
;
show
create
view
v1AA
;
drop
view
v1AA
;
drop
table
t1Aa
;
sql/item.cc
View file @
3fa511ff
...
...
@@ -138,7 +138,7 @@ bool Item::cleanup_processor(byte *arg)
Item_ident
::
Item_ident
(
const
char
*
db_name_par
,
const
char
*
table_name_par
,
const
char
*
field_name_par
)
:
orig_db_name
(
db_name_par
),
orig_table_name
(
table_name_par
),
orig_field_name
(
field_name_par
),
orig_field_name
(
field_name_par
),
alias_name_used
(
FALSE
),
db_name
(
db_name_par
),
table_name
(
table_name_par
),
field_name
(
field_name_par
),
cached_field_index
(
NO_CACHED_FIELD_INDEX
),
cached_table
(
0
),
depended_from
(
0
)
...
...
@@ -152,6 +152,7 @@ Item_ident::Item_ident(THD *thd, Item_ident *item)
orig_db_name
(
item
->
orig_db_name
),
orig_table_name
(
item
->
orig_table_name
),
orig_field_name
(
item
->
orig_field_name
),
alias_name_used
(
item
->
alias_name_used
),
db_name
(
item
->
db_name
),
table_name
(
item
->
table_name
),
field_name
(
item
->
field_name
),
...
...
@@ -609,6 +610,7 @@ void Item_field::set_field(Field *field_par)
table_name
=
field_par
->
table_name
;
field_name
=
field_par
->
field_name
;
db_name
=
field_par
->
table
->
table_cache_key
;
alias_name_used
=
field_par
->
table
->
alias_name_used
;
unsigned_flag
=
test
(
field_par
->
flags
&
UNSIGNED_FLAG
);
collation
.
set
(
field_par
->
charset
(),
DERIVATION_IMPLICIT
);
fixed
=
1
;
...
...
@@ -658,7 +660,8 @@ void Item_ident::print(String *str)
THD
*
thd
=
current_thd
;
char
d_name_buff
[
MAX_ALIAS_NAME
],
t_name_buff
[
MAX_ALIAS_NAME
];
const
char
*
d_name
=
db_name
,
*
t_name
=
table_name
;
if
(
lower_case_table_names
)
if
(
lower_case_table_names
==
1
||
(
lower_case_table_names
==
2
&&
!
alias_name_used
))
{
if
(
table_name
&&
table_name
[
0
])
{
...
...
@@ -680,7 +683,7 @@ void Item_ident::print(String *str)
append_identifier
(
thd
,
str
,
nm
,
strlen
(
nm
));
return
;
}
if
(
db_name
&&
db_name
[
0
])
if
(
db_name
&&
db_name
[
0
]
&&
!
alias_name_used
)
{
append_identifier
(
thd
,
str
,
d_name
,
strlen
(
d_name
));
str
->
append
(
'.'
);
...
...
@@ -2937,6 +2940,10 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
decimals
=
(
*
ref
)
->
decimals
;
collation
.
set
((
*
ref
)
->
collation
);
with_sum_func
=
(
*
ref
)
->
with_sum_func
;
if
((
*
ref
)
->
type
()
==
FIELD_ITEM
)
alias_name_used
=
((
Item_ident
*
)
(
*
ref
))
->
alias_name_used
;
else
alias_name_used
=
TRUE
;
// it is not field, so it is was resolved by alias
fixed
=
1
;
if
(
ref
&&
(
*
ref
)
->
check_cols
(
1
))
...
...
sql/item.h
View file @
3fa511ff
...
...
@@ -467,6 +467,7 @@ class Item_ident :public Item
const
char
*
db_name
;
const
char
*
table_name
;
const
char
*
field_name
;
bool
alias_name_used
;
/* true if item was resolved against alias */
/*
Cached value of index for this field in table->field array, used by prep.
stmts for speeding up their re-execution. Holds NO_CACHED_FIELD_INDEX
...
...
sql/sql_base.cc
View file @
3fa511ff
...
...
@@ -1050,8 +1050,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table
->
reginfo
.
lock_type
=
TL_READ
;
/* Assume read */
reset:
if
(
thd
->
lex
->
need_correct_ident
())
table
->
alias_name_used
=
my_strcasecmp
(
table_alias_charset
,
table
->
real_name
,
alias
);
/* Fix alias if table name changes */
if
(
strcmp
(
table
->
table_name
,
alias
))
if
(
strcmp
(
table
->
table_name
,
alias
))
{
uint
length
=
(
uint
)
strlen
(
alias
)
+
1
;
table
->
table_name
=
(
char
*
)
my_realloc
(
table
->
table_name
,
length
,
...
...
sql/sql_lex.cc
View file @
3fa511ff
...
...
@@ -1723,6 +1723,7 @@ bool st_lex::can_not_use_merged()
TRUE yes, we need only structure
FALSE no, we need data
*/
bool
st_lex
::
only_view_structure
()
{
switch
(
sql_command
)
...
...
@@ -1741,6 +1742,32 @@ bool st_lex::only_view_structure()
}
/*
Should Items_ident be printed correctly
SYNOPSIS
need_correct_ident()
RETURN
TRUE yes, we need only structure
FALSE no, we need data
*/
bool
st_lex
::
need_correct_ident
()
{
switch
(
sql_command
)
{
case
SQLCOM_SHOW_CREATE
:
case
SQLCOM_SHOW_TABLES
:
case
SQLCOM_CREATE_VIEW
:
return
TRUE
;
default:
return
FALSE
;
}
}
/*
initialize limit counters
...
...
sql/sql_lex.h
View file @
3fa511ff
...
...
@@ -802,6 +802,7 @@ typedef struct st_lex
bool
can_use_merged
();
bool
can_not_use_merged
();
bool
only_view_structure
();
bool
need_correct_ident
();
}
LEX
;
extern
TABLE_LIST
fake_time_zone_tables_list
;
...
...
sql/table.h
View file @
3fa511ff
...
...
@@ -160,6 +160,7 @@ struct st_table {
my_bool
no_keyread
,
no_cache
;
my_bool
clear_query_id
;
/* To reset query_id for tables and cols */
my_bool
auto_increment_field_not_null
;
my_bool
alias_name_used
;
/* true if table_name is alias */
Field
*
next_number_field
,
/* Set if next_number is activated */
*
found_next_number_field
,
/* Set on open */
*
rowid_field
;
...
...
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