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
62902a3b
Commit
62902a3b
authored
Feb 02, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
after-review changes (577 SCRUM)
parent
291f8a22
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
151 additions
and
91 deletions
+151
-91
sql/item.cc
sql/item.cc
+1
-1
sql/item.h
sql/item.h
+1
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-0
sql/item_func.cc
sql/item_func.cc
+1
-1
sql/item_subselect.cc
sql/item_subselect.cc
+7
-1
sql/item_sum.cc
sql/item_sum.cc
+5
-1
sql/mysql_priv.h
sql/mysql_priv.h
+3
-3
sql/sql_base.cc
sql/sql_base.cc
+5
-4
sql/sql_delete.cc
sql/sql_delete.cc
+4
-4
sql/sql_insert.cc
sql/sql_insert.cc
+2
-2
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+0
-1
sql/sql_select.cc
sql/sql_select.cc
+101
-54
sql/sql_select.h
sql/sql_select.h
+2
-1
sql/sql_union.cc
sql/sql_union.cc
+9
-8
sql/sql_update.cc
sql/sql_update.cc
+7
-7
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
sql/item.cc
View file @
62902a3b
...
...
@@ -673,7 +673,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return
1
;
if
(
r
->
fix_fields
(
thd
,
tables
,
ref
)
||
r
->
check_cols
(
1
))
return
1
;
// store pointer on SELECT_LEX from wich item is dependent
// store pointer on SELECT_LEX from w
h
ich item is dependent
r
->
depended_from
=
last
;
cursel
->
mark_as_dependent
(
last
);
return
0
;
...
...
sql/item.h
View file @
62902a3b
...
...
@@ -535,7 +535,7 @@ protected:
/*
select_lex used for:
1) receiving expanded variant of item list (to check max possible
nu
n
ber of elements);
nu
m
ber of elements);
2) to have access to ref_pointer_array, via wich item will refered.
*/
st_select_lex
*
select_lex
;
...
...
sql/item_cmpfunc.cc
View file @
62902a3b
...
...
@@ -1071,6 +1071,7 @@ in_string::~in_string()
{
if
(
base
)
{
// base was allocated with help of sql_alloc => following is OK
for
(
uint
i
=
0
;
i
<
count
;
i
++
)
((
String
*
)
base
)[
i
].
free
();
}
...
...
sql/item_func.cc
View file @
62902a3b
...
...
@@ -2213,7 +2213,7 @@ void Item_func_get_user_var::fix_length_and_dec()
}
return
;
err:
thd
->
fatal_error
=
1
;
thd
->
fatal_error
()
;
return
;
}
...
...
sql/item_subselect.cc
View file @
62902a3b
...
...
@@ -150,7 +150,13 @@ void Item_singlerow_subselect::select_transformer(THD *thd,
if
(
!
select_lex
->
next_select
()
&&
!
select_lex
->
table_list
.
elements
&&
select_lex
->
item_list
.
elements
==
1
&&
// TODO: mark subselect items from item list separately
/*
We cant change name of Item_field or Item_ref, because it will
prevent it's correct resolving, but we should save name of
removed item => we do not make optimization if top item of
list is field or reference.
TODO: solve above problem
*/
!
(
select_lex
->
item_list
.
head
()
->
type
()
==
FIELD_ITEM
||
select_lex
->
item_list
.
head
()
->
type
()
==
REF_ITEM
)
)
...
...
sql/item_sum.cc
View file @
62902a3b
...
...
@@ -51,7 +51,7 @@ Item_sum::Item_sum(THD *thd, Item_sum &item):
else
if
(
!
(
args
=
(
Item
**
)
sql_alloc
(
sizeof
(
Item
*
)
*
arg_count
)))
return
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
args
[
i
]
=
item
.
args
[
i
];
}
...
...
@@ -999,6 +999,10 @@ int dump_leaf(byte* key, uint32 count __attribute__((unused)),
Item_sum_count_distinct
::~
Item_sum_count_distinct
()
{
/*
Free table and tree if they belong to this item (if item have not pointer
to original item from which was made copy => it own its objects )
*/
if
(
!
original
)
{
if
(
table
)
...
...
sql/mysql_priv.h
View file @
62902a3b
...
...
@@ -404,8 +404,8 @@ int mysql_select(THD *thd, Item ***rref_pointer_array,
Item
*
having
,
ORDER
*
proc_param
,
ulong
select_type
,
select_result
*
result
,
SELECT_LEX_UNIT
*
unit
,
SELECT_LEX
*
select_lex
,
bool
fake_select_lex
,
bool
tables_
OK
);
void
free_u
lderlaye
d_joins
(
THD
*
thd
,
SELECT_LEX
*
select
);
bool
tables_
and_fields_initied
);
void
free_u
nderlai
d_joins
(
THD
*
thd
,
SELECT_LEX
*
select
);
void
fix_tables_pointers
(
SELECT_LEX
*
select_lex
);
void
fix_tables_pointers
(
SELECT_LEX_UNIT
*
select_lex
);
int
mysql_explain_union
(
THD
*
thd
,
SELECT_LEX_UNIT
*
unit
,
...
...
@@ -413,7 +413,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
int
mysql_explain_select
(
THD
*
thd
,
SELECT_LEX
*
sl
,
char
const
*
type
,
select_result
*
result
);
int
mysql_union
(
THD
*
thd
,
LEX
*
lex
,
select_result
*
result
,
SELECT_LEX_UNIT
*
unit
,
bool
tables_
OK
);
SELECT_LEX_UNIT
*
unit
,
bool
tables_
and_fields_initied
);
int
mysql_derived
(
THD
*
thd
,
LEX
*
lex
,
SELECT_LEX_UNIT
*
s
,
TABLE_LIST
*
t
);
Field
*
create_tmp_field
(
THD
*
thd
,
TABLE
*
table
,
Item
*
item
,
Item
::
Type
type
,
Item_result_field
***
copy_func
,
Field
**
from_field
,
...
...
sql/sql_base.cc
View file @
62902a3b
...
...
@@ -1949,14 +1949,15 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
thd
->
allow_sum_func
=
allow_sum_func
;
thd
->
where
=
"field list"
;
for
(
uint
i
=
0
;
(
item
=
it
++
);
i
++
)
Item
**
ref
=
ref_pointer_array
;
while
((
item
=
it
++
))
{
if
(
item
->
fix_fields
(
thd
,
tables
,
it
.
ref
())
||
item
->
check_cols
(
1
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
item
=
*
(
it
.
ref
());
//Item can be ch
e
nged in fix fields
if
(
ref
_pointer_array
)
ref_pointer_array
[
i
]
=
item
;
item
=
*
(
it
.
ref
());
//Item can be ch
a
nged in fix fields
if
(
ref
)
*
(
ref
++
)
=
item
;
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
&&
sum_func_list
)
item
->
split_sum_func
(
ref_pointer_array
,
*
sum_func_list
);
...
...
sql/sql_delete.cc
View file @
62902a3b
...
...
@@ -92,7 +92,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if
((
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
send_ok
(
thd
,
0L
);
DBUG_RETURN
(
0
);
// Nothing to delete
}
...
...
@@ -104,7 +104,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if
(
safe_update
&&
!
using_limit
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
DBUG_RETURN
(
1
);
}
...
...
@@ -134,7 +134,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
==
HA_POS_ERROR
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
// This will force out message
}
}
...
...
@@ -210,7 +210,7 @@ cleanup:
thd
->
lock
=
0
;
}
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
if
(
error
>=
0
||
thd
->
net
.
report_error
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
else
...
...
sql/sql_insert.cc
View file @
62902a3b
...
...
@@ -376,13 +376,13 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
thd
->
cuted_fields
);
::
send_ok
(
thd
,
info
.
copied
+
info
.
deleted
,(
ulonglong
)
id
,
buff
);
}
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
0
);
abort:
if
(
lock_type
==
TL_WRITE_DELAYED
)
end_delayed_insert
(
thd
);
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
}
...
...
sql/sql_lex.h
View file @
62902a3b
...
...
@@ -312,7 +312,7 @@ public:
void
exclude_level
();
/* UNION methods */
int
prepare
(
THD
*
thd
,
select_result
*
result
,
bool
tables_
OK
);
int
prepare
(
THD
*
thd
,
select_result
*
result
,
bool
tables_
and_fields_initied
);
int
exec
();
int
cleanup
();
...
...
sql/sql_prepare.cc
View file @
62902a3b
...
...
@@ -438,7 +438,6 @@ static bool setup_params_data(PREP_STMT *stmt)
}
/*
Validate the following information for INSERT statement:
- field existance
- fields count
...
...
sql/sql_select.cc
View file @
62902a3b
This diff is collapsed.
Click to expand it.
sql/sql_select.h
View file @
62902a3b
...
...
@@ -256,7 +256,8 @@ class JOIN :public Sql_alloc
int
prepare
(
Item
***
rref_pointer_array
,
TABLE_LIST
*
tables
,
uint
wind_num
,
COND
*
conds
,
uint
og_num
,
ORDER
*
order
,
ORDER
*
group
,
Item
*
having
,
ORDER
*
proc_param
,
SELECT_LEX
*
select
,
SELECT_LEX_UNIT
*
unit
,
bool
fake_select_lex
,
bool
tables_OK
);
SELECT_LEX_UNIT
*
unit
,
bool
fake_select_lex
,
bool
tables_and_fields_initied
);
int
optimize
();
int
reinit
();
void
exec
();
...
...
sql/sql_union.cc
View file @
62902a3b
...
...
@@ -25,11 +25,11 @@
#include "sql_select.h"
int
mysql_union
(
THD
*
thd
,
LEX
*
lex
,
select_result
*
result
,
SELECT_LEX_UNIT
*
unit
,
bool
tables_
OK
)
SELECT_LEX_UNIT
*
unit
,
bool
tables_
and_fields_initied
)
{
DBUG_ENTER
(
"mysql_union"
);
int
res
=
0
;
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
tables_
OK
)))
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
tables_
and_fields_initied
)))
res
=
unit
->
exec
();
res
|=
unit
->
cleanup
();
DBUG_RETURN
(
res
);
...
...
@@ -109,7 +109,7 @@ bool select_union::flush()
}
int
st_select_lex_unit
::
prepare
(
THD
*
thd
,
select_result
*
result
,
bool
tables_
OK
)
bool
tables_
and_fields_initied
)
{
DBUG_ENTER
(
"st_select_lex_unit::prepare"
);
...
...
@@ -132,8 +132,9 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
if
(
found_rows_for_union
)
first_select
()
->
options
^=
OPTION_FOUND_ROWS
;
}
if
(
tables_
OK
)
if
(
tables_
and_fields_initied
)
{
// Item list and tables will be initialized by mysql_derived
item_list
=
sl
->
item_list
;
}
else
...
...
@@ -153,7 +154,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
setup_fields
(
thd
,
sl
->
ref_pointer_array
,
first_table
,
item_list
,
0
,
0
,
1
))
goto
err
;
tables_
OK
=
1
;
tables_
and_fields_initied
=
1
;
}
bzero
((
char
*
)
&
tmp_table_param
,
sizeof
(
tmp_table_param
));
...
...
@@ -201,8 +202,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
(
ORDER
*
)
sl
->
group_list
.
first
,
sl
->
having
,
(
ORDER
*
)
NULL
,
sl
,
this
,
0
,
tables_
OK
);
tables_
OK
=
0
;
sl
,
this
,
0
,
tables_
and_fields_initied
);
tables_
and_fields_initied
=
0
;
if
(
res
|
thd
->
is_fatal_error
)
goto
err
;
}
...
...
@@ -231,7 +232,7 @@ int st_select_lex_unit::exec()
DBUG_ENTER
(
"st_select_lex_unit::exec"
);
SELECT_LEX_NODE
*
lex_select_save
=
thd
->
lex
.
current_select
;
if
(
executed
&&
!
(
dependent
||
uncacheable
))
if
(
executed
&&
!
(
dependent
||
uncacheable
))
DBUG_RETURN
(
0
);
executed
=
1
;
...
...
sql/sql_update.cc
View file @
62902a3b
...
...
@@ -124,7 +124,7 @@ int mysql_update(THD *thd,
table
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
table
->
grant
.
privilege
);
if
(
setup_fields
(
thd
,
0
,
update_table_list
,
values
,
0
,
0
,
0
))
{
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
}
...
...
@@ -135,7 +135,7 @@ int mysql_update(THD *thd,
(
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
if
(
error
)
{
DBUG_RETURN
(
-
1
);
// Error in where
...
...
@@ -150,7 +150,7 @@ int mysql_update(THD *thd,
if
(
safe_update
&&
!
using_limit
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
DBUG_RETURN
(
1
);
}
...
...
@@ -178,7 +178,7 @@ int mysql_update(THD *thd,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
{
delete
select
;
/* purecov: inspected */
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
}
if
(
old_used_keys
&
((
key_map
)
1
<<
used_index
))
...
...
@@ -212,7 +212,7 @@ int mysql_update(THD *thd,
==
HA_POS_ERROR
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
}
}
...
...
@@ -267,7 +267,7 @@ int mysql_update(THD *thd,
if
(
error
>=
0
)
{
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
DBUG_RETURN
(
-
1
);
}
}
...
...
@@ -353,7 +353,7 @@ int mysql_update(THD *thd,
}
delete
select
;
free_u
lderlaye
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
free_u
nderlai
d_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
if
(
error
>=
0
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
/* purecov: inspected */
else
...
...
sql/sql_yacc.yy
View file @
62902a3b
...
...
@@ -1797,7 +1797,7 @@ select_option:
YYABORT;
Select->options|= OPTION_FOUND_ROWS;
}
| SQL_NO_CACHE_SYM { Lex->uncacheable();
;
}
| SQL_NO_CACHE_SYM { Lex->uncacheable(); }
| SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; }
| ALL {}
;
...
...
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