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
85f39778
Commit
85f39778
authored
Aug 16, 2003
by
bell@laptop.sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
55094f90
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
30 additions
and
82 deletions
+30
-82
sql/item.cc
sql/item.cc
+0
-14
sql/item.h
sql/item.h
+0
-27
sql/item_subselect.cc
sql/item_subselect.cc
+7
-5
sql/mysql_priv.h
sql/mysql_priv.h
+0
-1
sql/sql_delete.cc
sql/sql_delete.cc
+1
-2
sql/sql_derived.cc
sql/sql_derived.cc
+3
-5
sql/sql_lex.cc
sql/sql_lex.cc
+12
-2
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-17
sql/sql_table.cc
sql/sql_table.cc
+1
-2
sql/sql_union.cc
sql/sql_union.cc
+3
-5
sql/sql_update.cc
sql/sql_update.cc
+1
-2
No files found.
sql/item.cc
View file @
85f39778
...
@@ -722,20 +722,6 @@ bool Item::fix_fields(THD *thd,
...
@@ -722,20 +722,6 @@ bool Item::fix_fields(THD *thd,
return
0
;
return
0
;
}
}
bool
Item_ref_on_list_position
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
reference
)
{
if
(
select_lex
->
item_list
.
elements
<=
pos
)
{
ref
=
0
;
my_error
(
ER_CARDINALITY_COL
,
MYF
(
0
),
pos
);
return
1
;
}
ref
=
select_lex
->
ref_pointer_array
+
pos
;
return
Item_ref_null_helper
::
fix_fields
(
thd
,
tables
,
reference
);
}
double
Item_ref_null_helper
::
val
()
double
Item_ref_null_helper
::
val
()
{
{
double
tmp
=
(
*
ref
)
->
val_result
();
double
tmp
=
(
*
ref
)
->
val_result
();
...
...
sql/item.h
View file @
85f39778
...
@@ -637,33 +637,6 @@ public:
...
@@ -637,33 +637,6 @@ public:
{}
{}
};
};
/*
Used to find item in list of select items after '*' items processing.
Because item '*' can be used in item list. when we create
Item_ref_on_list_position we do not know how item list will be changed, but
we know number of item position (I mean queries like "select * from t").
*/
class
Item_ref_on_list_position
:
public
Item_ref_null_helper
{
protected:
/*
select_lex used for:
1) receiving expanded variant of item list (to check max possible
number of elements);
2) to have access to ref_pointer_array, via wich item will refered.
*/
st_select_lex
*
select_lex
;
uint
pos
;
public:
Item_ref_on_list_position
(
Item_in_subselect
*
master
,
st_select_lex
*
sl
,
uint
num
,
char
*
table_name
,
char
*
field_name
)
:
Item_ref_null_helper
(
master
,
0
,
table_name
,
field_name
),
select_lex
(
sl
),
pos
(
num
)
{}
bool
fix_fields
(
THD
*
,
struct
st_table_list
*
,
Item
**
ref
);
};
/*
/*
The following class is used to optimize comparing of date columns
The following class is used to optimize comparing of date columns
We need to save the original item, to be able to set the field to the
We need to save the original item, to be able to set the field to the
...
...
sql/item_subselect.cc
View file @
85f39778
...
@@ -650,15 +650,17 @@ Item_in_subselect::row_value_transformer(JOIN *join,
...
@@ -650,15 +650,17 @@ Item_in_subselect::row_value_transformer(JOIN *join,
uint
n
=
left_expr
->
cols
();
uint
n
=
left_expr
->
cols
();
select_lex
->
dependent
=
1
;
select_lex
->
dependent
=
1
;
select_lex
->
setup_ref_array
(
thd
,
select_lex
->
order_list
.
elements
+
select_lex
->
group_list
.
elements
);
Item
*
item
=
0
;
Item
*
item
=
0
;
List_iterator_fast
<
Item
>
li
(
select_lex
->
item_list
);
List_iterator_fast
<
Item
>
li
(
select_lex
->
item_list
);
for
(
uint
i
=
0
;
i
<
n
;
i
++
)
for
(
uint
i
=
0
;
i
<
n
;
i
++
)
{
{
Item
*
func
=
Item
*
func
=
new
Item_ref_null_helper
(
this
,
new
Item_ref_on_list_position
(
this
,
select_lex
,
i
,
select_lex
->
ref_pointer_array
+
i
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<no matter>"
,
(
char
*
)
"<list ref>"
);
(
char
*
)
"<list ref>"
);
func
=
func
=
Item_bool_func2
::
eq_creator
(
new
Item_ref
((
*
optimizer
->
get_cache
())
->
Item_bool_func2
::
eq_creator
(
new
Item_ref
((
*
optimizer
->
get_cache
())
->
addr
(
i
),
addr
(
i
),
...
...
sql/mysql_priv.h
View file @
85f39778
...
@@ -411,7 +411,6 @@ int mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
...
@@ -411,7 +411,6 @@ int mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
bool
check_simple_select
();
bool
check_simple_select
();
SORT_FIELD
*
make_unireg_sortorder
(
ORDER
*
order
,
uint
*
length
);
SORT_FIELD
*
make_unireg_sortorder
(
ORDER
*
order
,
uint
*
length
);
int
setup_ref_array
(
THD
*
thd
,
Item
***
rref_pointer_array
,
uint
elements
);
int
setup_order
(
THD
*
thd
,
Item
**
ref_pointer_array
,
TABLE_LIST
*
tables
,
int
setup_order
(
THD
*
thd
,
Item
**
ref_pointer_array
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
fields
,
List
<
Item
>
&
all_fields
,
ORDER
*
order
);
List
<
Item
>
&
fields
,
List
<
Item
>
&
all_fields
,
ORDER
*
order
);
int
setup_group
(
THD
*
thd
,
Item
**
ref_pointer_array
,
TABLE_LIST
*
tables
,
int
setup_group
(
THD
*
thd
,
Item
**
ref_pointer_array
,
TABLE_LIST
*
tables
,
...
...
sql/sql_delete.cc
View file @
85f39778
...
@@ -126,8 +126,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
...
@@ -126,8 +126,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
table
->
sort
.
io_cache
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
table
->
sort
.
io_cache
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
MYF
(
MY_FAE
|
MY_ZEROFILL
));
MYF
(
MY_FAE
|
MY_ZEROFILL
));
if
(
setup_ref_array
(
thd
,
&
thd
->
lex
.
select_lex
.
ref_pointer_array
,
if
(
thd
->
lex
.
select_lex
.
setup_ref_array
(
thd
,
0
)
||
all_fields
.
elements
)
||
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
&
tables
,
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
&
tables
,
fields
,
all_fields
,
order
)
||
fields
,
all_fields
,
order
)
||
!
(
sortorder
=
make_unireg_sortorder
(
order
,
&
length
))
||
!
(
sortorder
=
make_unireg_sortorder
(
order
,
&
length
))
||
...
...
sql/sql_derived.cc
View file @
85f39778
...
@@ -135,11 +135,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
...
@@ -135,11 +135,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
item_list
=
select_cursor
->
item_list
;
item_list
=
select_cursor
->
item_list
;
select_cursor
->
with_wild
=
0
;
select_cursor
->
with_wild
=
0
;
if
(
setup_ref_array
(
thd
,
&
select_cursor
->
ref_pointer_array
,
if
(
select_cursor
->
setup_ref_array
(
thd
,
(
item_list
.
elements
+
select_cursor
->
order_list
.
elements
+
select_cursor
->
select_n_having_items
+
select_cursor
->
group_list
.
elements
)
||
select_cursor
->
order_list
.
elements
+
select_cursor
->
group_list
.
elements
))
||
setup_fields
(
thd
,
select_cursor
->
ref_pointer_array
,
first_table
,
setup_fields
(
thd
,
select_cursor
->
ref_pointer_array
,
first_table
,
item_list
,
0
,
0
,
1
))
item_list
,
0
,
0
,
1
))
{
{
...
...
sql/sql_lex.cc
View file @
85f39778
...
@@ -981,6 +981,7 @@ void st_select_lex::init_query()
...
@@ -981,6 +981,7 @@ void st_select_lex::init_query()
resolve_mode
=
NOMATTER_MODE
;
resolve_mode
=
NOMATTER_MODE
;
cond_count
=
with_wild
=
0
;
cond_count
=
with_wild
=
0
;
ref_pointer_array
=
0
;
ref_pointer_array
=
0
;
select_n_having_items
=
0
;
}
}
void
st_select_lex
::
init_select
()
void
st_select_lex
::
init_select
()
...
@@ -989,7 +990,6 @@ void st_select_lex::init_select()
...
@@ -989,7 +990,6 @@ void st_select_lex::init_select()
group_list
.
empty
();
group_list
.
empty
();
type
=
db
=
db1
=
table1
=
db2
=
table2
=
0
;
type
=
db
=
db1
=
table1
=
db2
=
table2
=
0
;
having
=
0
;
having
=
0
;
group_list
.
empty
();
use_index_ptr
=
ignore_index_ptr
=
0
;
use_index_ptr
=
ignore_index_ptr
=
0
;
table_join_options
=
0
;
table_join_options
=
0
;
in_sum_expr
=
with_wild
=
0
;
in_sum_expr
=
with_wild
=
0
;
...
@@ -1007,7 +1007,6 @@ void st_select_lex::init_select()
...
@@ -1007,7 +1007,6 @@ void st_select_lex::init_select()
order_list
.
next
=
(
byte
**
)
&
order_list
.
first
;
order_list
.
next
=
(
byte
**
)
&
order_list
.
first
;
select_limit
=
HA_POS_ERROR
;
select_limit
=
HA_POS_ERROR
;
offset_limit
=
0
;
offset_limit
=
0
;
select_n_having_items
=
0
;
with_sum_func
=
0
;
with_sum_func
=
0
;
parsing_place
=
SELECT_LEX_NODE
::
NO_MATTER
;
parsing_place
=
SELECT_LEX_NODE
::
NO_MATTER
;
}
}
...
@@ -1410,6 +1409,17 @@ ulong st_select_lex::get_table_join_options()
...
@@ -1410,6 +1409,17 @@ ulong st_select_lex::get_table_join_options()
return
table_join_options
;
return
table_join_options
;
}
}
bool
st_select_lex
::
setup_ref_array
(
THD
*
thd
,
uint
order_group_num
)
{
if
(
ref_pointer_array
)
return
0
;
return
(
ref_pointer_array
=
(
Item
**
)
thd
->
alloc
(
sizeof
(
Item
*
)
*
(
item_list
.
elements
+
select_n_having_items
+
order_group_num
)
*
5
))
==
0
;
}
/*
/*
There are st_select_lex::add_table_to_list &
There are st_select_lex::add_table_to_list &
st_select_lex::set_lock_for_tables in sql_parse.cc
st_select_lex::set_lock_for_tables in sql_parse.cc
...
...
sql/sql_lex.h
View file @
85f39778
...
@@ -449,6 +449,7 @@ public:
...
@@ -449,6 +449,7 @@ public:
init_query
();
init_query
();
init_select
();
init_select
();
}
}
bool
setup_ref_array
(
THD
*
thd
,
uint
order_group_num
);
};
};
typedef
class
st_select_lex
SELECT_LEX
;
typedef
class
st_select_lex
SELECT_LEX
;
...
...
sql/sql_select.cc
View file @
85f39778
...
@@ -294,10 +294,7 @@ JOIN::prepare(Item ***rref_pointer_array,
...
@@ -294,10 +294,7 @@ JOIN::prepare(Item ***rref_pointer_array,
setup_wild
(
thd
,
tables_list
,
setup_wild
(
thd
,
tables_list
,
fields_list
,
fields_list
,
&
all_fields
,
wild_num
)))
||
&
all_fields
,
wild_num
)))
||
setup_ref_array
(
thd
,
rref_pointer_array
,
(
fields_list
.
elements
+
select_lex
->
setup_ref_array
(
thd
,
og_num
)
||
select_lex
->
select_n_having_items
+
og_num
))
||
setup_fields
(
thd
,
(
*
rref_pointer_array
),
tables_list
,
fields_list
,
1
,
setup_fields
(
thd
,
(
*
rref_pointer_array
),
tables_list
,
fields_list
,
1
,
&
all_fields
,
1
)
||
&
all_fields
,
1
)
||
setup_without_group
(
thd
,
(
*
rref_pointer_array
),
tables_list
,
fields_list
,
setup_without_group
(
thd
,
(
*
rref_pointer_array
),
tables_list
,
fields_list
,
...
@@ -7483,19 +7480,6 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
...
@@ -7483,19 +7480,6 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
return
0
;
return
0
;
}
}
/*
Allocate array of references to address all_fileds list elements
*/
int
setup_ref_array
(
THD
*
thd
,
Item
***
rref_pointer_array
,
uint
elements
)
{
if
(
*
rref_pointer_array
)
return
0
;
return
(
*
rref_pointer_array
=
(
Item
**
)
thd
->
alloc
(
sizeof
(
Item
*
)
*
elements
*
5
))
==
0
;
}
/*
/*
Change order to point at item in select list. If item isn't a number
Change order to point at item in select list. If item isn't a number
and doesn't exits in the select list, add it the the field list.
and doesn't exits in the select list, add it the the field list.
...
...
sql/sql_table.cc
View file @
85f39778
...
@@ -2501,8 +2501,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -2501,8 +2501,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
tables
.
db
=
from
->
table_cache_key
;
tables
.
db
=
from
->
table_cache_key
;
error
=
1
;
error
=
1
;
if
(
setup_ref_array
(
thd
,
&
thd
->
lex
.
select_lex
.
ref_pointer_array
,
if
(
thd
->
lex
.
select_lex
.
setup_ref_array
(
thd
,
order_num
)
||
order_num
)
||
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
&
tables
,
fields
,
all_fields
,
order
)
||
&
tables
,
fields
,
all_fields
,
order
)
||
!
(
sortorder
=
make_unireg_sortorder
(
order
,
&
length
))
||
!
(
sortorder
=
make_unireg_sortorder
(
order
,
&
length
))
||
...
...
sql/sql_union.cc
View file @
85f39778
...
@@ -156,11 +156,9 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
...
@@ -156,11 +156,9 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
Item
*
item
;
Item
*
item
;
item_list
=
select_cursor
->
item_list
;
item_list
=
select_cursor
->
item_list
;
select_cursor
->
with_wild
=
0
;
select_cursor
->
with_wild
=
0
;
if
(
setup_ref_array
(
thd
,
&
select_cursor
->
ref_pointer_array
,
if
(
select_cursor
->
setup_ref_array
(
thd
,
(
item_list
.
elements
+
select_cursor
->
order_list
.
elements
+
select_cursor
->
select_n_having_items
+
select_cursor
->
group_list
.
elements
)
||
select_cursor
->
order_list
.
elements
+
select_cursor
->
group_list
.
elements
))
||
setup_fields
(
thd
,
select_cursor
->
ref_pointer_array
,
first_table
,
setup_fields
(
thd
,
select_cursor
->
ref_pointer_array
,
first_table
,
item_list
,
0
,
0
,
1
))
item_list
,
0
,
0
,
1
))
goto
err
;
goto
err
;
...
...
sql/sql_update.cc
View file @
85f39778
...
@@ -94,8 +94,7 @@ int mysql_update(THD *thd,
...
@@ -94,8 +94,7 @@ int mysql_update(THD *thd,
if
(
setup_tables
(
update_table_list
)
||
if
(
setup_tables
(
update_table_list
)
||
setup_conds
(
thd
,
update_table_list
,
&
conds
)
||
setup_conds
(
thd
,
update_table_list
,
&
conds
)
||
setup_ref_array
(
thd
,
&
thd
->
lex
.
select_lex
.
ref_pointer_array
,
thd
->
lex
.
select_lex
.
setup_ref_array
(
thd
,
order_num
)
||
order_num
)
||
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
setup_order
(
thd
,
thd
->
lex
.
select_lex
.
ref_pointer_array
,
&
tables
,
all_fields
,
all_fields
,
order
)
||
&
tables
,
all_fields
,
all_fields
,
order
)
||
setup_ftfuncs
(
&
thd
->
lex
.
select_lex
))
setup_ftfuncs
(
&
thd
->
lex
.
select_lex
))
...
...
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