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
e57cd00a
Commit
e57cd00a
authored
Oct 03, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
after merging bugfix
parent
896bc7d0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
34 deletions
+47
-34
sql/item.cc
sql/item.cc
+15
-6
sql/mysql_priv.h
sql/mysql_priv.h
+3
-2
sql/sql_base.cc
sql/sql_base.cc
+13
-10
sql/sql_lex.cc
sql/sql_lex.cc
+5
-5
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-7
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-3
No files found.
sql/item.cc
View file @
e57cd00a
...
@@ -432,7 +432,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -432,7 +432,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if
(
!
field
)
// If field is not checked
if
(
!
field
)
// If field is not checked
{
{
Field
*
tmp
;
Field
*
tmp
;
if
(
!
(
tmp
=
find_field_in_tables
(
thd
,
this
,
tables
)))
if
(
!
(
tmp
=
find_field_in_tables
(
thd
,
this
,
tables
,
0
)))
{
{
/*
/*
We can't find table field in table list of current select,
We can't find table field in table list of current select,
...
@@ -448,9 +448,14 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -448,9 +448,14 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
sl
&&
!
tmp
;
sl
&&
!
tmp
;
sl
=
sl
->
outer_select
())
sl
=
sl
->
outer_select
())
tmp
=
find_field_in_tables
(
thd
,
this
,
tmp
=
find_field_in_tables
(
thd
,
this
,
(
TABLE_LIST
*
)(
last
=
sl
)
->
table_list
.
first
);
(
TABLE_LIST
*
)(
last
=
sl
)
->
table_list
.
first
,
0
);
if
(
!
tmp
)
if
(
!
tmp
)
return
1
;
{
// Call to produce appropriate error message
find_field_in_tables
(
thd
,
this
,
tables
,
1
);
return
-
1
;
}
else
else
{
{
depended_from
=
last
;
depended_from
=
last
;
...
@@ -463,7 +468,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -463,7 +468,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
s
=
s
->
outer_select
())
s
=
s
->
outer_select
())
if
(
!
s
->
depended
)
if
(
!
s
->
depended
)
{
{
s
->
depended
=
1
;
//Select is depended of outer select
s
->
depended
=
1
;
//Tables will be reopened many times
//Tables will be reopened many times
for
(
TABLE_LIST
*
tbl
=
for
(
TABLE_LIST
*
tbl
=
(
TABLE_LIST
*
)
s
->
table_list
.
first
;
(
TABLE_LIST
*
)
s
->
table_list
.
first
;
...
@@ -780,7 +785,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -780,7 +785,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
{
{
if
(
!
ref
)
if
(
!
ref
)
{
{
if
(
!
(
ref
=
find_item_in_list
(
this
,
thd
->
lex
.
select
->
item_list
)))
if
(
!
(
ref
=
find_item_in_list
(
this
,
thd
->
lex
.
select
->
item_list
,
0
)))
{
{
/*
/*
We can't find table field in table list of current select,
We can't find table field in table list of current select,
...
@@ -795,9 +800,13 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
...
@@ -795,9 +800,13 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
for
(
SELECT_LEX
*
sl
=
thd
->
lex
.
select
->
outer_select
();
for
(
SELECT_LEX
*
sl
=
thd
->
lex
.
select
->
outer_select
();
sl
&&
!
ref
;
sl
&&
!
ref
;
sl
=
sl
->
outer_select
())
sl
=
sl
->
outer_select
())
ref
=
find_item_in_list
(
this
,
(
last
=
sl
)
->
item_list
);
ref
=
find_item_in_list
(
this
,
(
last
=
sl
)
->
item_list
,
0
);
if
(
!
ref
)
if
(
!
ref
)
{
// Call to report error
find_item_in_list
(
this
,
thd
->
lex
.
select
->
item_list
,
1
);
return
1
;
return
1
;
}
else
else
{
{
depended_from
=
last
;
depended_from
=
last
;
...
...
sql/mysql_priv.h
View file @
e57cd00a
...
@@ -450,7 +450,8 @@ bool wait_for_tables(THD *thd);
...
@@ -450,7 +450,8 @@ bool wait_for_tables(THD *thd);
bool
table_is_used
(
TABLE
*
table
,
bool
wait_for_name_lock
);
bool
table_is_used
(
TABLE
*
table
,
bool
wait_for_name_lock
);
bool
drop_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
bool
drop_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
abort_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
abort_locked_tables
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
Field
*
find_field_in_tables
(
THD
*
thd
,
Item_field
*
item
,
TABLE_LIST
*
tables
);
Field
*
find_field_in_tables
(
THD
*
thd
,
Item_field
*
item
,
TABLE_LIST
*
tables
,
bool
report_error
);
Field
*
find_field_in_table
(
THD
*
thd
,
TABLE
*
table
,
const
char
*
name
,
uint
length
,
Field
*
find_field_in_table
(
THD
*
thd
,
TABLE
*
table
,
const
char
*
name
,
uint
length
,
bool
check_grant
,
bool
allow_rowid
);
bool
check_grant
,
bool
allow_rowid
);
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
...
@@ -538,7 +539,7 @@ TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
...
@@ -538,7 +539,7 @@ TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
SQL_SELECT
*
make_select
(
TABLE
*
head
,
table_map
const_tables
,
SQL_SELECT
*
make_select
(
TABLE
*
head
,
table_map
const_tables
,
table_map
read_tables
,
COND
*
conds
,
int
*
error
);
table_map
read_tables
,
COND
*
conds
,
int
*
error
);
Item
**
find_item_in_list
(
Item
*
item
,
List
<
Item
>
&
items
);
Item
**
find_item_in_list
(
Item
*
item
,
List
<
Item
>
&
items
,
bool
report_error
);
bool
insert_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
insert_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
const
char
*
db_name
,
const
char
*
table_name
,
const
char
*
db_name
,
const
char
*
table_name
,
List_iterator
<
Item
>
*
it
);
List_iterator
<
Item
>
*
it
);
...
...
sql/sql_base.cc
View file @
e57cd00a
...
@@ -1783,7 +1783,8 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
...
@@ -1783,7 +1783,8 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
Field
*
Field
*
find_field_in_tables
(
THD
*
thd
,
Item_field
*
item
,
TABLE_LIST
*
tables
)
find_field_in_tables
(
THD
*
thd
,
Item_field
*
item
,
TABLE_LIST
*
tables
,
bool
report_error
)
{
{
Field
*
found
=
0
;
Field
*
found
=
0
;
const
char
*
db
=
item
->
db_name
;
const
char
*
db
=
item
->
db_name
;
...
@@ -1820,7 +1821,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1820,7 +1821,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
}
}
if
(
found
)
if
(
found
)
return
found
;
return
found
;
if
(
!
found_table
)
if
(
!
found_table
&&
report_error
)
{
{
char
buff
[
NAME_LEN
*
2
+
1
];
char
buff
[
NAME_LEN
*
2
+
1
];
if
(
db
)
if
(
db
)
...
@@ -1832,8 +1833,9 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1832,8 +1833,9 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
thd
->
where
);
thd
->
where
);
}
}
else
else
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
MYF
(
0
),
if
(
report_error
)
item
->
full_name
(),
thd
->
where
);
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
MYF
(
0
),
item
->
full_name
(),
thd
->
where
);
return
(
Field
*
)
0
;
return
(
Field
*
)
0
;
}
}
bool
allow_rowid
=
tables
&&
!
tables
->
next
;
// Only one table
bool
allow_rowid
=
tables
&&
!
tables
->
next
;
// Only one table
...
@@ -1848,7 +1850,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1848,7 +1850,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
return
(
Field
*
)
0
;
return
(
Field
*
)
0
;
if
(
found
)
if
(
found
)
{
{
if
(
!
thd
->
where
)
// Returns first found
if
(
!
report_error
)
// Returns first found
break
;
break
;
my_printf_error
(
ER_NON_UNIQ_ERROR
,
ER
(
ER_NON_UNIQ_ERROR
),
MYF
(
0
),
my_printf_error
(
ER_NON_UNIQ_ERROR
,
ER
(
ER_NON_UNIQ_ERROR
),
MYF
(
0
),
name
,
thd
->
where
);
name
,
thd
->
where
);
...
@@ -1859,13 +1861,14 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
...
@@ -1859,13 +1861,14 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
}
}
if
(
found
)
if
(
found
)
return
found
;
return
found
;
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
if
(
report_error
)
MYF
(
0
),
item
->
full_name
(),
thd
->
where
);
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
MYF
(
0
),
item
->
full_name
(),
thd
->
where
);
return
(
Field
*
)
0
;
return
(
Field
*
)
0
;
}
}
Item
**
Item
**
find_item_in_list
(
Item
*
find
,
List
<
Item
>
&
items
)
find_item_in_list
(
Item
*
find
,
List
<
Item
>
&
items
,
bool
report_error
)
{
{
List_iterator
<
Item
>
li
(
items
);
List_iterator
<
Item
>
li
(
items
);
Item
**
found
=
0
,
*
item
;
Item
**
found
=
0
,
*
item
;
...
@@ -1890,7 +1893,7 @@ find_item_in_list(Item *find,List<Item> &items)
...
@@ -1890,7 +1893,7 @@ find_item_in_list(Item *find,List<Item> &items)
{
{
if
((
*
found
)
->
eq
(
item
,
0
))
if
((
*
found
)
->
eq
(
item
,
0
))
continue
;
// Same field twice (Access?)
continue
;
// Same field twice (Access?)
if
(
current_thd
->
where
)
if
(
report_error
)
my_printf_error
(
ER_NON_UNIQ_ERROR
,
ER
(
ER_NON_UNIQ_ERROR
),
MYF
(
0
),
my_printf_error
(
ER_NON_UNIQ_ERROR
,
ER
(
ER_NON_UNIQ_ERROR
),
MYF
(
0
),
find
->
full_name
(),
current_thd
->
where
);
find
->
full_name
(),
current_thd
->
where
);
return
(
Item
**
)
0
;
return
(
Item
**
)
0
;
...
@@ -1913,7 +1916,7 @@ find_item_in_list(Item *find,List<Item> &items)
...
@@ -1913,7 +1916,7 @@ find_item_in_list(Item *find,List<Item> &items)
break
;
break
;
}
}
}
}
if
(
!
found
&&
current_thd
->
where
)
if
(
!
found
&&
report_error
)
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
MYF
(
0
),
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
MYF
(
0
),
find
->
full_name
(),
current_thd
->
where
);
find
->
full_name
(),
current_thd
->
where
);
return
found
;
return
found
;
...
...
sql/sql_lex.cc
View file @
e57cd00a
...
@@ -142,11 +142,11 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
...
@@ -142,11 +142,11 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex
->
next_state
=
STATE_START
;
lex
->
next_state
=
STATE_START
;
lex
->
end_of_query
=
(
lex
->
ptr
=
buf
)
+
length
;
lex
->
end_of_query
=
(
lex
->
ptr
=
buf
)
+
length
;
lex
->
yylineno
=
1
;
lex
->
yylineno
=
1
;
lex
->
select
->
create_refs
=
lex
->
in_comment
=
0
;
lex
->
select
_lex
.
create_refs
=
lex
->
in_comment
=
0
;
lex
->
length
=
0
;
lex
->
length
=
0
;
lex
->
select
->
in_sum_expr
=
0
;
lex
->
select
_lex
.
in_sum_expr
=
0
;
lex
->
select
->
expr_list
.
empty
();
lex
->
select
_lex
.
expr_list
.
empty
();
lex
->
select
->
ftfunc_list
.
empty
();
lex
->
select
_lex
.
ftfunc_list
.
empty
();
lex
->
convert_set
=
(
lex
->
thd
=
thd
)
->
variables
.
convert_set
;
lex
->
convert_set
=
(
lex
->
thd
=
thd
)
->
variables
.
convert_set
;
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
ignore_space
=
test
(
thd
->
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
ignore_space
=
test
(
thd
->
sql_mode
&
MODE_IGNORE_SPACE
);
...
@@ -158,7 +158,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
...
@@ -158,7 +158,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
void
lex_end
(
LEX
*
lex
)
void
lex_end
(
LEX
*
lex
)
{
{
lex
->
select
->
expr_list
.
delete_elements
();
// If error when parsing sql-varargs
lex
->
select
_lex
.
expr_list
.
delete_elements
();
// If error when parsing sql-varargs
x_free
(
lex
->
yacc_yyss
);
x_free
(
lex
->
yacc_yyss
);
x_free
(
lex
->
yacc_yyvs
);
x_free
(
lex
->
yacc_yyvs
);
}
}
...
...
sql/sql_parse.cc
View file @
e57cd00a
...
@@ -1265,7 +1265,7 @@ mysql_execute_command(THD *thd)
...
@@ -1265,7 +1265,7 @@ mysql_execute_command(THD *thd)
int
res
=
0
;
int
res
=
0
;
LEX
*
lex
=
&
thd
->
lex
;
LEX
*
lex
=
&
thd
->
lex
;
TABLE_LIST
*
tables
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
TABLE_LIST
*
tables
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
SELECT_LEX
*
select_lex
=
lex
->
select
;
SELECT_LEX
*
select_lex
=
&
lex
->
select_lex
;
SELECT_LEX_UNIT
*
unit
=
&
lex
->
unit
;
SELECT_LEX_UNIT
*
unit
=
&
lex
->
unit
;
DBUG_ENTER
(
"mysql_execute_command"
);
DBUG_ENTER
(
"mysql_execute_command"
);
...
...
sql/sql_select.cc
View file @
e57cd00a
...
@@ -6498,9 +6498,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
...
@@ -6498,9 +6498,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
return
0
;
return
0
;
}
}
const
char
*
save_where
=
thd
->
where
;
const
char
*
save_where
=
thd
->
where
;
thd
->
where
=
0
;
// No error if not found
Item
**
item
=
find_item_in_list
(
*
order
->
item
,
fields
,
0
);
Item
**
item
=
find_item_in_list
(
*
order
->
item
,
fields
);
thd
->
where
=
save_where
;
if
(
item
)
if
(
item
)
{
{
order
->
item
=
item
;
// use it
order
->
item
=
item
;
// use it
...
@@ -6598,17 +6596,15 @@ setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields,
...
@@ -6598,17 +6596,15 @@ setup_new_fields(THD *thd,TABLE_LIST *tables,List<Item> &fields,
DBUG_ENTER
(
"setup_new_fields"
);
DBUG_ENTER
(
"setup_new_fields"
);
thd
->
set_query_id
=
1
;
// Not really needed, but...
thd
->
set_query_id
=
1
;
// Not really needed, but...
thd
->
where
=
0
;
// Don't give error
for
(;
new_field
;
new_field
=
new_field
->
next
)
for
(;
new_field
;
new_field
=
new_field
->
next
)
{
{
if
((
item
=
find_item_in_list
(
*
new_field
->
item
,
fields
)))
if
((
item
=
find_item_in_list
(
*
new_field
->
item
,
fields
,
0
)))
new_field
->
item
=
item
;
/* Change to shared Item */
new_field
->
item
=
item
;
/* Change to shared Item */
else
else
{
{
thd
->
where
=
"procedure list"
;
thd
->
where
=
"procedure list"
;
if
((
*
new_field
->
item
)
->
fix_fields
(
thd
,
tables
,
new_field
->
item
))
if
((
*
new_field
->
item
)
->
fix_fields
(
thd
,
tables
,
new_field
->
item
))
DBUG_RETURN
(
1
);
/* purecov: inspected */
DBUG_RETURN
(
1
);
/* purecov: inspected */
thd
->
where
=
0
;
all_fields
.
push_front
(
*
new_field
->
item
);
all_fields
.
push_front
(
*
new_field
->
item
);
new_field
->
item
=
all_fields
.
head_ref
();
new_field
->
item
=
all_fields
.
head_ref
();
}
}
...
@@ -7400,7 +7396,8 @@ static void describe_info(JOIN *join, const char *info)
...
@@ -7400,7 +7396,8 @@ static void describe_info(JOIN *join, const char *info)
{
{
THD
*
thd
=
join
->
thd
;
THD
*
thd
=
join
->
thd
;
if
(
thd
->
lex
.
select
->
next_select
())
/* If in UNION */
/* If lex.select belong to UNION */
if
(
thd
->
lex
.
select
->
master_unit
()
->
first_select
()
->
next_select
())
{
{
select_describe
(
join
,
FALSE
,
FALSE
,
FALSE
,
info
);
select_describe
(
join
,
FALSE
,
FALSE
,
FALSE
,
info
);
return
;
return
;
...
...
sql/sql_yacc.yy
View file @
e57cd00a
...
@@ -2436,7 +2436,8 @@ order_clause:
...
@@ -2436,7 +2436,8 @@ order_clause:
net_printf(lex->thd, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
net_printf(lex->thd, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
YYABORT;
YYABORT;
}
}
if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
if (lex->select->linkage != GLOBAL_OPTIONS_TYPE &&
lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
{
net_printf(lex->thd, ER_WRONG_USAGE,
net_printf(lex->thd, ER_WRONG_USAGE,
"CUBE/ROLLUP",
"CUBE/ROLLUP",
...
@@ -2462,7 +2463,8 @@ limit_clause:
...
@@ -2462,7 +2463,8 @@ limit_clause:
| LIMIT ULONG_NUM
| LIMIT ULONG_NUM
{
{
LEX *lex=Lex;
LEX *lex=Lex;
if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
if (lex->select->linkage != GLOBAL_OPTIONS_TYPE &&
lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
{
net_printf(lex->thd, ER_WRONG_USAGE, "CUBE/ROLLUP",
net_printf(lex->thd, ER_WRONG_USAGE, "CUBE/ROLLUP",
"LIMIT");
"LIMIT");
...
@@ -2475,7 +2477,8 @@ limit_clause:
...
@@ -2475,7 +2477,8 @@ limit_clause:
| LIMIT ULONG_NUM ',' ULONG_NUM
| LIMIT ULONG_NUM ',' ULONG_NUM
{
{
LEX *lex=Lex;
LEX *lex=Lex;
if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
if (lex->select->linkage != GLOBAL_OPTIONS_TYPE &&
lex->select->olap != UNSPECIFIED_OLAP_TYPE)
{
{
net_printf(lex->thd, ER_WRONG_USAGE, "CUBE/ROLLUP",
net_printf(lex->thd, ER_WRONG_USAGE, "CUBE/ROLLUP",
"LIMIT");
"LIMIT");
...
...
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