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
01b3c709
Commit
01b3c709
authored
Jun 15, 2005
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed:
Item_buff -> Cached_item Item_arena -> Query_arena TEST_ASSERT -> YYERROR_UNLESS
parent
b41f9b36
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
124 additions
and
124 deletions
+124
-124
sql/item.h
sql/item.h
+17
-17
sql/item_buff.cc
sql/item_buff.cc
+18
-18
sql/item_func.cc
sql/item_func.cc
+1
-1
sql/item_subselect.cc
sql/item_subselect.cc
+2
-2
sql/sp_head.cc
sql/sp_head.cc
+4
-4
sql/sp_head.h
sql/sp_head.h
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+3
-3
sql/sql_class.cc
sql/sql_class.cc
+14
-14
sql/sql_class.h
sql/sql_class.h
+18
-18
sql/sql_lex.cc
sql/sql_lex.cc
+2
-2
sql/sql_prepare.cc
sql/sql_prepare.cc
+10
-10
sql/sql_select.cc
sql/sql_select.cc
+6
-6
sql/sql_select.h
sql/sql_select.h
+4
-4
sql/sql_union.cc
sql/sql_union.cc
+2
-2
sql/sql_view.cc
sql/sql_view.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+19
-19
sql/table.cc
sql/table.cc
+2
-2
No files found.
sql/item.h
View file @
01b3c709
...
...
@@ -1478,7 +1478,7 @@ class Item_copy_string :public Item
str_value
.
length
(),
&
end_not_used
,
&
err_not_used
));
}
longlong
val_int
()
{
{
int
err
;
return
null_value
?
LL
(
0
)
:
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
10
,
(
char
**
)
0
,
&
err
);
}
...
...
@@ -1493,62 +1493,62 @@ class Item_copy_string :public Item
};
class
Item_buff
:
public
Sql_alloc
class
Cached_item
:
public
Sql_alloc
{
public:
my_bool
null_value
;
Item_buff
()
:
null_value
(
0
)
{}
Cached_item
()
:
null_value
(
0
)
{}
virtual
bool
cmp
(
void
)
=
0
;
virtual
~
Item_buff
();
/*line -e1509 */
virtual
~
Cached_item
();
/*line -e1509 */
};
class
Item_str_buff
:
public
Item_buff
class
Cached_item_str
:
public
Cached_item
{
Item
*
item
;
String
value
,
tmp_value
;
public:
Item_str_buff
(
THD
*
thd
,
Item
*
arg
);
Cached_item_str
(
THD
*
thd
,
Item
*
arg
);
bool
cmp
(
void
);
~
Item_str_buff
();
// Deallocate String:s
~
Cached_item_str
();
// Deallocate String:s
};
class
Item_real_buff
:
public
Item_buff
class
Cached_item_real
:
public
Cached_item
{
Item
*
item
;
double
value
;
public:
Item_real_buff
(
Item
*
item_par
)
:
item
(
item_par
),
value
(
0.0
)
{}
Cached_item_real
(
Item
*
item_par
)
:
item
(
item_par
),
value
(
0.0
)
{}
bool
cmp
(
void
);
};
class
Item_int_buff
:
public
Item_buff
class
Cached_item_int
:
public
Cached_item
{
Item
*
item
;
longlong
value
;
public:
Item_int_buff
(
Item
*
item_par
)
:
item
(
item_par
),
value
(
0
)
{}
Cached_item_int
(
Item
*
item_par
)
:
item
(
item_par
),
value
(
0
)
{}
bool
cmp
(
void
);
};
class
Item_decimal_buff
:
public
Item_buff
class
Cached_item_decimal
:
public
Cached_item
{
Item
*
item
;
my_decimal
value
;
public:
Item_decimal_buff
(
Item
*
item_par
);
Cached_item_decimal
(
Item
*
item_par
);
bool
cmp
(
void
);
};
class
Item_field_buff
:
public
Item_buff
class
Cached_item_field
:
public
Cached_item
{
char
*
buff
;
Field
*
field
;
uint
length
;
public:
Item_field_buff
(
Item_field
*
item
)
Cached_item_field
(
Item_field
*
item
)
{
field
=
item
->
field
;
buff
=
(
char
*
)
sql_calloc
(
length
=
field
->
pack_length
());
...
...
@@ -1570,7 +1570,7 @@ class Item_default_value : public Item_field
void
print
(
String
*
str
);
int
save_in_field
(
Field
*
field_arg
,
bool
no_conversions
);
table_map
used_tables
()
const
{
return
(
table_map
)
0L
;
}
bool
walk
(
Item_processor
processor
,
byte
*
args
)
{
return
arg
->
walk
(
processor
,
args
)
||
...
...
@@ -1876,7 +1876,7 @@ void mark_select_range_as_dependent(THD *thd,
Field
*
found_field
,
Item
*
found_item
,
Item_ident
*
resolved_item
);
extern
Item_buff
*
new_Item_buff
(
THD
*
thd
,
Item
*
item
);
extern
Cached_item
*
new_Cached_item
(
THD
*
thd
,
Item
*
item
);
extern
Item_result
item_cmp_type
(
Item_result
a
,
Item_result
b
);
extern
void
resolve_const_item
(
THD
*
thd
,
Item
**
ref
,
Item
*
cmp_item
);
extern
bool
field_is_equal_to_item
(
Field
*
field
,
Item
*
item
);
sql/item_buff.cc
View file @
01b3c709
...
...
@@ -20,23 +20,23 @@
#include "mysql_priv.h"
/*
** Create right type of
item_buffer
for an item
** Create right type of
Cached_item
for an item
*/
Item_buff
*
new_Item_buff
(
THD
*
thd
,
Item
*
item
)
Cached_item
*
new_Cached_item
(
THD
*
thd
,
Item
*
item
)
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
!
(((
Item_field
*
)
item
)
->
field
->
flags
&
BLOB_FLAG
))
return
new
Item_field_buff
((
Item_field
*
)
item
);
return
new
Cached_item_field
((
Item_field
*
)
item
);
switch
(
item
->
result_type
())
{
case
STRING_RESULT
:
return
new
Item_str_buff
(
thd
,
(
Item_field
*
)
item
);
return
new
Cached_item_str
(
thd
,
(
Item_field
*
)
item
);
case
INT_RESULT
:
return
new
Item_int_buff
((
Item_field
*
)
item
);
return
new
Cached_item_int
((
Item_field
*
)
item
);
case
REAL_RESULT
:
return
new
Item_real_buff
(
item
);
return
new
Cached_item_real
(
item
);
case
DECIMAL_RESULT
:
return
new
Item_decimal_buff
(
item
);
return
new
Cached_item_decimal
(
item
);
case
ROW_RESULT
:
default:
DBUG_ASSERT
(
0
);
...
...
@@ -44,18 +44,18 @@ Item_buff *new_Item_buff(THD *thd, Item *item)
}
}
Item_buff
::~
Item_buff
()
{}
Cached_item
::~
Cached_item
()
{}
/*
** Compare with old value and replace value with new value
** Return true if values have changed
*/
Item_str_buff
::
Item_str_buff
(
THD
*
thd
,
Item
*
arg
)
Cached_item_str
::
Cached_item_str
(
THD
*
thd
,
Item
*
arg
)
:
item
(
arg
),
value
(
min
(
arg
->
max_length
,
thd
->
variables
.
max_sort_length
))
{}
bool
Item_str_buff
::
cmp
(
void
)
bool
Cached_item_str
::
cmp
(
void
)
{
String
*
res
;
bool
tmp
;
...
...
@@ -77,12 +77,12 @@ bool Item_str_buff::cmp(void)
return
tmp
;
}
Item_str_buff
::~
Item_str_buff
()
Cached_item_str
::~
Cached_item_str
()
{
item
=
0
;
// Safety
}
bool
Item_real_buff
::
cmp
(
void
)
bool
Cached_item_real
::
cmp
(
void
)
{
double
nr
=
item
->
val_real
();
if
(
null_value
!=
item
->
null_value
||
nr
!=
value
)
...
...
@@ -94,7 +94,7 @@ bool Item_real_buff::cmp(void)
return
FALSE
;
}
bool
Item_int_buff
::
cmp
(
void
)
bool
Cached_item_int
::
cmp
(
void
)
{
longlong
nr
=
item
->
val_int
();
if
(
null_value
!=
item
->
null_value
||
nr
!=
value
)
...
...
@@ -107,7 +107,7 @@ bool Item_int_buff::cmp(void)
}
bool
Item_field_buff
::
cmp
(
void
)
bool
Cached_item_field
::
cmp
(
void
)
{
bool
tmp
=
field
->
cmp
(
buff
)
!=
0
;
// This is not a blob!
if
(
tmp
)
...
...
@@ -121,14 +121,14 @@ bool Item_field_buff::cmp(void)
}
Item_decimal_buff
::
Item_decimal_buff
(
Item
*
it
)
Cached_item_decimal
::
Cached_item_decimal
(
Item
*
it
)
:
item
(
it
)
{
my_decimal_set_zero
(
&
value
);
}
bool
Item_decimal_buff
::
cmp
()
bool
Cached_item_decimal
::
cmp
()
{
my_decimal
tmp
;
my_decimal
*
ptmp
=
item
->
val_decimal
(
&
tmp
);
...
...
@@ -147,6 +147,6 @@ bool Item_decimal_buff::cmp()
*****************************************************************************/
#ifdef __GNUC__
template
class
List
<
Item_buff
>;
template
class
List_iterator
<
Item_buff
>;
template
class
List
<
Cached_item
>;
template
class
List_iterator
<
Cached_item
>;
#endif
sql/item_func.cc
View file @
01b3c709
...
...
@@ -161,7 +161,7 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
}
THD
*
thd
=
current_thd
;
Item
_arena
*
arena
,
backup
;
Query
_arena
*
arena
,
backup
;
bool
res
=
FALSE
;
/*
In case we're in statement prepare, create conversion item
...
...
sql/item_subselect.cc
View file @
01b3c709
...
...
@@ -340,7 +340,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
return
RES_OK
;
SELECT_LEX
*
select_lex
=
join
->
select_lex
;
Item
_arena
*
arena
=
thd
->
current_arena
;
Query
_arena
*
arena
=
thd
->
current_arena
;
if
(
!
select_lex
->
master_unit
()
->
first_select
()
->
next_select
()
&&
!
select_lex
->
table_list
.
elements
&&
...
...
@@ -1164,7 +1164,7 @@ Item_in_subselect::select_transformer(JOIN *join)
Item_subselect
::
trans_res
Item_in_subselect
::
select_in_like_transformer
(
JOIN
*
join
,
Comp_creator
*
func
)
{
Item
_arena
*
arena
,
backup
;
Query
_arena
*
arena
,
backup
;
SELECT_LEX
*
current
=
thd
->
lex
->
current_select
,
*
up
;
const
char
*
save_where
=
thd
->
where
;
Item_subselect
::
trans_res
res
=
RES_ERROR
;
...
...
sql/sp_head.cc
View file @
01b3c709
...
...
@@ -310,12 +310,12 @@ sp_head::operator delete(void *ptr, size_t size)
sp_head
::
sp_head
()
:
Item
_arena
((
bool
)
FALSE
),
m_returns_cs
(
NULL
),
m_has_return
(
FALSE
),
:
Query
_arena
((
bool
)
FALSE
),
m_returns_cs
(
NULL
),
m_has_return
(
FALSE
),
m_simple_case
(
FALSE
),
m_multi_results
(
FALSE
),
m_in_handler
(
FALSE
)
{
extern
byte
*
sp_table_key
(
const
byte
*
ptr
,
uint
*
plen
,
my_bool
first
);
extern
byte
extern
byte
*
sp_lex_sp_key
(
const
byte
*
ptr
,
uint
*
plen
,
my_bool
first
);
DBUG_ENTER
(
"sp_head::sp_head"
);
...
...
@@ -574,7 +574,7 @@ sp_head::execute(THD *thd)
sp_rcontext
*
ctx
;
int
ret
=
0
;
uint
ip
=
0
;
Item
_arena
*
old_arena
;
Query
_arena
*
old_arena
;
query_id_t
old_query_id
;
TABLE
*
old_derived_tables
;
LEX
*
old_lex
;
...
...
@@ -2312,7 +2312,7 @@ sp_head::add_used_tables_to_table_list(THD *thd,
TABLE_LIST
***
query_tables_last_ptr
)
{
uint
i
;
Item
_arena
*
arena
,
backup
;
Query
_arena
*
arena
,
backup
;
bool
result
=
FALSE
;
DBUG_ENTER
(
"sp_head::add_used_tables_to_table_list"
);
...
...
sql/sp_head.h
View file @
01b3c709
...
...
@@ -74,7 +74,7 @@ sp_name *
sp_name_current_db_new
(
THD
*
thd
,
LEX_STRING
name
);
class
sp_head
:
private
Item
_arena
class
sp_head
:
private
Query
_arena
{
sp_head
(
const
sp_head
&
);
/* Prevent use of these */
void
operator
=
(
sp_head
&
);
...
...
sql/sql_base.cc
View file @
01b3c709
...
...
@@ -3020,7 +3020,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
Item
*
item
;
List_iterator
<
Item
>
it
(
fields
);
Item
_arena
*
arena
,
backup
;
Query
_arena
*
arena
,
backup
;
DBUG_ENTER
(
"setup_wild"
);
/*
...
...
@@ -3304,7 +3304,7 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
any_privileges 0 If we should ensure that we have SELECT privileges
for all columns
1 If any privilege is ok
allocate_view_names if true view names will be copied to current
Item
_arena
allocate_view_names if true view names will be copied to current
Query
_arena
memory (made for SP/PS)
RETURN
0 ok
...
...
@@ -3561,7 +3561,7 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
int
setup_conds
(
THD
*
thd
,
TABLE_LIST
*
tables
,
TABLE_LIST
*
leaves
,
COND
**
conds
)
{
SELECT_LEX
*
select_lex
=
thd
->
lex
->
current_select
;
Item
_arena
*
arena
=
thd
->
current_arena
,
backup
;
Query
_arena
*
arena
=
thd
->
current_arena
,
backup
;
bool
save_wrapper
=
thd
->
lex
->
current_select
->
no_wrap_view_item
;
TABLE_LIST
*
table
=
NULL
;
// For HP compilers
DBUG_ENTER
(
"setup_conds"
);
...
...
sql/sql_class.cc
View file @
01b3c709
...
...
@@ -1478,14 +1478,14 @@ void select_dumpvar::cleanup()
Create arena for already constructed THD.
SYNOPSYS
Item
_arena()
Query
_arena()
thd - thread for which arena is created
DESCRIPTION
Create arena for already existing THD using its variables as parameters
for memory root initialization.
*/
Item_arena
::
Item
_arena
(
THD
*
thd
)
Query_arena
::
Query
_arena
(
THD
*
thd
)
:
free_list
(
0
),
mem_root
(
&
main_mem_root
),
state
(
INITIALIZED
)
{
...
...
@@ -1499,7 +1499,7 @@ Item_arena::Item_arena(THD* thd)
Create arena and optionally initialize memory root.
SYNOPSYS
Item
_arena()
Query
_arena()
init_mem_root - whenever we need to initialize memory root
DESCRIPTION
...
...
@@ -1511,7 +1511,7 @@ Item_arena::Item_arena(THD* thd)
its memory root in THD::init_for_queries() before execution of real
statements.
*/
Item_arena
::
Item
_arena
(
bool
init_mem_root
)
Query_arena
::
Query
_arena
(
bool
init_mem_root
)
:
free_list
(
0
),
mem_root
(
&
main_mem_root
),
state
(
CONVENTIONAL_EXECUTION
)
{
...
...
@@ -1520,7 +1520,7 @@ Item_arena::Item_arena(bool init_mem_root)
}
Item_arena
::
Type
Item
_arena
::
type
()
const
Query_arena
::
Type
Query
_arena
::
type
()
const
{
DBUG_ASSERT
(
0
);
/* Should never be called */
return
STATEMENT
;
...
...
@@ -1532,7 +1532,7 @@ Item_arena::Type Item_arena::type() const
*/
Statement
::
Statement
(
THD
*
thd
)
:
Item
_arena
(
thd
),
:
Query
_arena
(
thd
),
id
(
++
thd
->
statement_id_counter
),
set_query_id
(
1
),
allow_sum_func
(
0
),
...
...
@@ -1551,7 +1551,7 @@ Statement::Statement(THD *thd)
*/
Statement
::
Statement
()
:
Item
_arena
((
bool
)
TRUE
),
:
Query
_arena
((
bool
)
TRUE
),
id
(
0
),
set_query_id
(
1
),
allow_sum_func
(
0
),
/* initialized later */
...
...
@@ -1563,7 +1563,7 @@ Statement::Statement()
}
Item
_arena
::
Type
Statement
::
type
()
const
Query
_arena
::
Type
Statement
::
type
()
const
{
return
STATEMENT
;
}
...
...
@@ -1611,9 +1611,9 @@ void THD::end_statement()
}
void
Item_arena
::
set_n_backup_item_arena
(
Item_arena
*
set
,
Item
_arena
*
backup
)
void
Query_arena
::
set_n_backup_item_arena
(
Query_arena
*
set
,
Query
_arena
*
backup
)
{
DBUG_ENTER
(
"
Item
_arena::set_n_backup_item_arena"
);
DBUG_ENTER
(
"
Query
_arena::set_n_backup_item_arena"
);
DBUG_ASSERT
(
backup_arena
==
0
);
backup
->
set_item_arena
(
this
);
set_item_arena
(
set
);
...
...
@@ -1624,9 +1624,9 @@ void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup)
}
void
Item_arena
::
restore_backup_item_arena
(
Item_arena
*
set
,
Item
_arena
*
backup
)
void
Query_arena
::
restore_backup_item_arena
(
Query_arena
*
set
,
Query
_arena
*
backup
)
{
DBUG_ENTER
(
"
Item
_arena::restore_backup_item_arena"
);
DBUG_ENTER
(
"
Query
_arena::restore_backup_item_arena"
);
set
->
set_item_arena
(
this
);
set_item_arena
(
backup
);
#ifndef DBUG_OFF
...
...
@@ -1635,7 +1635,7 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
#ifdef NOT_NEEDED_NOW
/*
Reset backup mem_root to avoid its freeing.
Since
Item
_arena's mem_root is freed only when it is part of Statement
Since
Query
_arena's mem_root is freed only when it is part of Statement
we need this only if we use some Statement's arena as backup storage.
But we do this only with THD::stmt_backup and this Statement is specially
handled in this respect. So this code is not really needed now.
...
...
@@ -1645,7 +1645,7 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
DBUG_VOID_RETURN
;
}
void
Item_arena
::
set_item_arena
(
Item
_arena
*
set
)
void
Query_arena
::
set_item_arena
(
Query
_arena
*
set
)
{
mem_root
=
set
->
mem_root
;
free_list
=
set
->
free_list
;
...
...
sql/sql_class.h
View file @
01b3c709
...
...
@@ -646,7 +646,7 @@ typedef struct system_status_var
void
free_tmp_table
(
THD
*
thd
,
TABLE
*
entry
);
class
Item
_arena
class
Query
_arena
{
public:
/*
...
...
@@ -659,12 +659,12 @@ class Item_arena
#ifndef DBUG_OFF
bool
backup_arena
;
#endif
enum
enum_state
enum
enum_state
{
INITIALIZED
=
0
,
INITIALIZED_FOR_SP
=
1
,
PREPARED
=
2
,
CONVENTIONAL_EXECUTION
=
3
,
EXECUTED
=
4
,
ERROR
=
-
1
};
enum_state
state
;
/* We build without RTTI, so dynamic_cast can't be used. */
...
...
@@ -674,22 +674,22 @@ class Item_arena
};
/*
This constructor is used only when
Item
_arena is created as
backup storage for another instance of
Item
_arena.
This constructor is used only when
Query
_arena is created as
backup storage for another instance of
Query
_arena.
*/
Item
_arena
()
{};
Query
_arena
()
{};
/*
Create arena for already constructed THD using its variables as
parameters for memory root initialization.
*/
Item
_arena
(
THD
*
thd
);
Query
_arena
(
THD
*
thd
);
/*
Create arena and optionally init memory root with minimal values.
Particularly used if
Item
_arena is part of Statement.
Particularly used if
Query
_arena is part of Statement.
*/
Item
_arena
(
bool
init_mem_root
);
Query
_arena
(
bool
init_mem_root
);
virtual
Type
type
()
const
;
virtual
~
Item
_arena
()
{};
virtual
~
Query
_arena
()
{};
inline
bool
is_stmt_prepare
()
const
{
return
state
==
INITIALIZED
;
}
inline
bool
is_stmt_prepare_or_first_sp_execute
()
const
...
...
@@ -721,9 +721,9 @@ class Item_arena
return
ptr
;
}
void
set_n_backup_item_arena
(
Item_arena
*
set
,
Item
_arena
*
backup
);
void
restore_backup_item_arena
(
Item_arena
*
set
,
Item
_arena
*
backup
);
void
set_item_arena
(
Item
_arena
*
set
);
void
set_n_backup_item_arena
(
Query_arena
*
set
,
Query
_arena
*
backup
);
void
restore_backup_item_arena
(
Query_arena
*
set
,
Query
_arena
*
backup
);
void
set_item_arena
(
Query
_arena
*
set
);
};
...
...
@@ -743,7 +743,7 @@ class Cursor;
be used explicitly.
*/
class
Statement
:
public
Item
_arena
class
Statement
:
public
Query
_arena
{
Statement
(
const
Statement
&
rhs
);
/* not implemented: */
Statement
&
operator
=
(
const
Statement
&
rhs
);
/* non-copyable */
...
...
@@ -1107,9 +1107,9 @@ class THD :public ilink,
Item_change_list
change_list
;
/*
Current prepared
Item
_arena if there one, or 0
Current prepared
Query
_arena if there one, or 0
*/
Item
_arena
*
current_arena
;
Query
_arena
*
current_arena
;
/*
next_insert_id is set on SET INSERT_ID= #. This is used as the next
generated auto_increment value in handler.cc
...
...
@@ -1370,13 +1370,13 @@ class THD :public ilink,
inline
void
fatal_error
()
{
is_fatal_error
=
1
;
net
.
report_error
=
1
;
net
.
report_error
=
1
;
DBUG_PRINT
(
"error"
,(
"Fatal error set"
));
}
inline
CHARSET_INFO
*
charset
()
{
return
variables
.
character_set_client
;
}
void
update_charset
();
inline
Item_arena
*
change_arena_if_needed
(
Item
_arena
*
backup
)
inline
Query_arena
*
change_arena_if_needed
(
Query
_arena
*
backup
)
{
/*
use new arena if we are in a prepared statements and we have not
...
...
sql/sql_lex.cc
View file @
01b3c709
...
...
@@ -1484,8 +1484,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
We have to create array in prepared statement memory if it is
prepared statement
*/
Item
_arena
*
arena
=
thd
->
current_arena
;
return
(
ref_pointer_array
=
Query
_arena
*
arena
=
thd
->
current_arena
;
return
(
ref_pointer_array
=
(
Item
**
)
arena
->
alloc
(
sizeof
(
Item
*
)
*
(
item_list
.
elements
+
select_n_having_items
+
...
...
sql/sql_prepare.cc
View file @
01b3c709
...
...
@@ -104,7 +104,7 @@ class Prepared_statement: public Statement
Prepared_statement
(
THD
*
thd_arg
);
virtual
~
Prepared_statement
();
void
setup_set_params
();
virtual
Item
_arena
::
Type
type
()
const
;
virtual
Query
_arena
::
Type
type
()
const
;
};
static
void
execute_stmt
(
THD
*
thd
,
Prepared_statement
*
stmt
,
...
...
@@ -132,7 +132,7 @@ find_prepared_statement(THD *thd, ulong id, const char *where)
{
Statement
*
stmt
=
thd
->
stmt_map
.
find
(
id
);
if
(
stmt
==
0
||
stmt
->
type
()
!=
Item
_arena
::
PREPARED_STATEMENT
)
if
(
stmt
==
0
||
stmt
->
type
()
!=
Query
_arena
::
PREPARED_STATEMENT
)
{
char
llbuf
[
22
];
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
llstr
(
id
,
llbuf
),
...
...
@@ -1786,7 +1786,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
{
stmt
->
setup_set_params
();
init_stmt_after_parse
(
thd
,
stmt
->
lex
);
stmt
->
state
=
Item
_arena
::
PREPARED
;
stmt
->
state
=
Query
_arena
::
PREPARED
;
}
DBUG_RETURN
(
!
stmt
);
}
...
...
@@ -1956,7 +1956,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
DBUG_PRINT
(
"exec_query:"
,
(
"%s"
,
stmt
->
query
));
/* Check if we got an error when sending long data */
if
(
stmt
->
state
==
Item
_arena
::
ERROR
)
if
(
stmt
->
state
==
Query
_arena
::
ERROR
)
{
my_message
(
stmt
->
last_errno
,
stmt
->
last_error
,
MYF
(
0
));
DBUG_VOID_RETURN
;
...
...
@@ -2156,8 +2156,8 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
thd
->
set_statement
(
&
thd
->
stmt_backup
);
thd
->
current_arena
=
thd
;
if
(
stmt
->
state
==
Item
_arena
::
PREPARED
)
stmt
->
state
=
Item
_arena
::
EXECUTED
;
if
(
stmt
->
state
==
Query
_arena
::
PREPARED
)
stmt
->
state
=
Query
_arena
::
EXECUTED
;
DBUG_VOID_RETURN
;
}
...
...
@@ -2246,7 +2246,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
if
(
stmt
->
cursor
&&
stmt
->
cursor
->
is_open
())
stmt
->
cursor
->
close
();
stmt
->
state
=
Item
_arena
::
PREPARED
;
stmt
->
state
=
Query
_arena
::
PREPARED
;
/*
Clear parameters from data which could be set by
...
...
@@ -2334,7 +2334,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
if
(
param_number
>=
stmt
->
param_count
)
{
/* Error will be sent in execute call */
stmt
->
state
=
Item
_arena
::
ERROR
;
stmt
->
state
=
Query
_arena
::
ERROR
;
stmt
->
last_errno
=
ER_WRONG_ARGUMENTS
;
sprintf
(
stmt
->
last_error
,
ER
(
ER_WRONG_ARGUMENTS
),
"mysql_stmt_send_long_data"
);
...
...
@@ -2350,7 +2350,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
if
(
param
->
set_longdata
(
thd
->
extra_data
,
thd
->
extra_length
))
#endif
{
stmt
->
state
=
Item
_arena
::
ERROR
;
stmt
->
state
=
Query
_arena
::
ERROR
;
stmt
->
last_errno
=
ER_OUTOFMEMORY
;
sprintf
(
stmt
->
last_error
,
ER
(
ER_OUTOFMEMORY
),
0
);
}
...
...
@@ -2401,7 +2401,7 @@ Prepared_statement::~Prepared_statement()
}
Item
_arena
::
Type
Prepared_statement
::
type
()
const
Query
_arena
::
Type
Prepared_statement
::
type
()
const
{
return
PREPARED_STATEMENT
;
}
sql/sql_select.cc
View file @
01b3c709
...
...
@@ -136,7 +136,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab, bool end_of_records);
static
enum_nested_loop_state
end_write_group
(
JOIN
*
join
,
JOIN_TAB
*
join_tab
,
bool
end_of_records
);
static
int
test_if_group_changed
(
List
<
Item_buff
>
&
list
);
static
int
test_if_group_changed
(
List
<
Cached_item
>
&
list
);
static
int
join_read_const_table
(
JOIN_TAB
*
tab
,
POSITION
*
pos
);
static
int
join_read_system
(
JOIN_TAB
*
tab
);
static
int
join_read_const
(
JOIN_TAB
*
tab
);
...
...
@@ -580,7 +580,7 @@ JOIN::optimize()
MEMROOT for prepared statements and stored procedures.
*/
Item
_arena
*
arena
=
thd
->
current_arena
,
backup
;
Query
_arena
*
arena
=
thd
->
current_arena
,
backup
;
if
(
arena
->
is_conventional
())
arena
=
0
;
// For easier test
else
...
...
@@ -12274,7 +12274,7 @@ alloc_group_fields(JOIN *join,ORDER *group)
{
for
(;
group
;
group
=
group
->
next
)
{
Item_buff
*
tmp
=
new_Item_buff
(
join
->
thd
,
*
group
->
item
);
Cached_item
*
tmp
=
new_Cached_item
(
join
->
thd
,
*
group
->
item
);
if
(
!
tmp
||
join
->
group_fields
.
push_front
(
tmp
))
return
TRUE
;
}
...
...
@@ -12285,12 +12285,12 @@ alloc_group_fields(JOIN *join,ORDER *group)
static
int
test_if_group_changed
(
List
<
Item_buff
>
&
list
)
test_if_group_changed
(
List
<
Cached_item
>
&
list
)
{
DBUG_ENTER
(
"test_if_group_changed"
);
List_iterator
<
Item_buff
>
li
(
list
);
List_iterator
<
Cached_item
>
li
(
list
);
int
idx
=
-
1
,
i
;
Item_buff
*
buff
;
Cached_item
*
buff
;
for
(
i
=
(
int
)
list
.
elements
-
1
;
(
buff
=
li
++
)
;
i
--
)
{
...
...
sql/sql_select.h
View file @
01b3c709
...
...
@@ -178,7 +178,7 @@ class JOIN :public Sql_alloc
table_map
const_table_map
,
found_const_table_map
,
outer_join
;
ha_rows
send_records
,
found_records
,
examined_rows
,
row_limit
,
select_limit
;
/*
Used to fetch no more than given amount of rows per one
Used to fetch no more than given amount of rows per one
fetch operation of server side cursor.
The value is checked in end_send and end_send_group in fashion, similar
to offset_limit_cnt:
...
...
@@ -190,7 +190,7 @@ class JOIN :public Sql_alloc
POSITION
positions
[
MAX_TABLES
+
1
],
best_positions
[
MAX_TABLES
+
1
];
double
best_read
;
List
<
Item
>
*
fields
;
List
<
Item_buff
>
group_fields
,
group_fields_cache
;
List
<
Cached_item
>
group_fields
,
group_fields_cache
;
TABLE
*
tmp_table
;
// used to store 2 possible tmp table of SELECT
TABLE
*
exec_tmp_table1
,
*
exec_tmp_table2
;
...
...
@@ -370,7 +370,7 @@ class JOIN :public Sql_alloc
statement for many cursors.
*/
class
Cursor
:
public
Sql_alloc
,
public
Item
_arena
class
Cursor
:
public
Sql_alloc
,
public
Query
_arena
{
JOIN
*
join
;
SELECT_LEX_UNIT
*
unit
;
...
...
@@ -396,7 +396,7 @@ class Cursor: public Sql_alloc, public Item_arena
void
close
();
void
set_unit
(
SELECT_LEX_UNIT
*
unit_arg
)
{
unit
=
unit_arg
;
}
Cursor
()
:
Item
_arena
(
TRUE
),
join
(
0
),
unit
(
0
)
{}
Cursor
()
:
Query
_arena
(
TRUE
),
join
(
0
),
unit
(
0
)
{}
~
Cursor
();
};
...
...
sql/sql_union.cc
View file @
01b3c709
...
...
@@ -274,7 +274,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
all collations together for UNION.
*/
List_iterator_fast
<
Item
>
tp
(
types
);
Item
_arena
*
arena
=
thd
->
current_arena
;
Query
_arena
*
arena
=
thd
->
current_arena
;
Item
*
type
;
while
((
type
=
tp
++
))
...
...
@@ -308,7 +308,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if
(
!
item_list
.
elements
)
{
Field
**
field
;
Item
_arena
*
tmp_arena
,
backup
;
Query
_arena
*
tmp_arena
,
backup
;
tmp_arena
=
thd
->
change_arena_if_needed
(
&
backup
);
for
(
field
=
table
->
field
;
*
field
;
field
++
)
...
...
sql/sql_view.cc
View file @
01b3c709
...
...
@@ -579,7 +579,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
For now we assume that tables will not be changed during PS life (it
will be TRUE as far as we make new table cache).
*/
Item
_arena
*
arena
=
thd
->
current_arena
,
backup
;
Query
_arena
*
arena
=
thd
->
current_arena
,
backup
;
if
(
arena
->
is_conventional
())
arena
=
0
;
else
...
...
sql/sql_yacc.yy
View file @
01b3c709
...
...
@@ -52,7 +52,7 @@ const LEX_STRING null_lex_str={0,0};
ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
#define
TEST_ASSERT
(A) \
#define
YYERROR_UNLESS
(A) \
if (!(A)) \
{ \
yyerror(ER(ER_SYNTAX_ERROR)); \
...
...
@@ -5094,7 +5094,7 @@ table_ref:
;
join_table_list:
derived_table_list {
TEST_ASSERT
($$=$1); }
derived_table_list {
YYERROR_UNLESS
($$=$1); }
;
/* Warning - may return NULL in case of incomplete SELECT */
...
...
@@ -5102,41 +5102,41 @@ derived_table_list:
table_ref { $$=$1; }
| derived_table_list ',' table_ref
{
TEST_ASSERT
($1 && ($$=$3));
YYERROR_UNLESS
($1 && ($$=$3));
}
;
join_table:
table_ref normal_join table_ref {
TEST_ASSERT
($1 && ($$=$3)); }
table_ref normal_join table_ref {
YYERROR_UNLESS
($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
{
TEST_ASSERT
($1 && ($$=$3)); $3->straight=1; }
{
YYERROR_UNLESS
($1 && ($$=$3)); $3->straight=1; }
| table_ref normal_join table_ref ON expr
{
TEST_ASSERT
($1 && ($$=$3)); add_join_on($3,$5); }
{
YYERROR_UNLESS
($1 && ($$=$3)); add_join_on($3,$5); }
| table_ref STRAIGHT_JOIN table_factor ON expr
{
TEST_ASSERT
($1 && ($$=$3)); $3->straight=1; add_join_on($3,$5); }
{
YYERROR_UNLESS
($1 && ($$=$3)); $3->straight=1; add_join_on($3,$5); }
| table_ref normal_join table_ref
USING
{
SELECT_LEX *sel= Select;
TEST_ASSERT
($1 && $3);
YYERROR_UNLESS
($1 && $3);
sel->save_names_for_using_list($1, $3);
}
'(' using_list ')'
{ add_join_on($3,$7); $$=$3; }
| table_ref LEFT opt_outer JOIN_SYM table_ref ON expr
{
TEST_ASSERT
($1 && $5); add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
{
YYERROR_UNLESS
($1 && $5); add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
| table_ref LEFT opt_outer JOIN_SYM table_factor
{
SELECT_LEX *sel= Select;
TEST_ASSERT
($1 && $5);
YYERROR_UNLESS
($1 && $5);
sel->save_names_for_using_list($1, $5);
}
USING '(' using_list ')'
{ add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
{
TEST_ASSERT
($1 && $6);
YYERROR_UNLESS
($1 && $6);
add_join_natural($1,$6);
$6->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
...
...
@@ -5144,7 +5144,7 @@ join_table:
| table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr
{
LEX *lex= Lex;
TEST_ASSERT
($1 && $5);
YYERROR_UNLESS
($1 && $5);
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
add_join_on($$, $7);
...
...
@@ -5152,7 +5152,7 @@ join_table:
| table_ref RIGHT opt_outer JOIN_SYM table_factor
{
SELECT_LEX *sel= Select;
TEST_ASSERT
($1 && $5);
YYERROR_UNLESS
($1 && $5);
sel->save_names_for_using_list($1, $5);
}
USING '(' using_list ')'
...
...
@@ -5164,14 +5164,14 @@ join_table:
}
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
{
TEST_ASSERT
($1 && $6);
YYERROR_UNLESS
($1 && $6);
add_join_natural($6,$1);
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
}
| table_ref NATURAL JOIN_SYM table_factor
{
TEST_ASSERT
($1 && ($$=$4)); add_join_natural($1,$4); };
{
YYERROR_UNLESS
($1 && ($$=$4)); add_join_natural($1,$4); };
normal_join:
...
...
@@ -5200,7 +5200,7 @@ table_factor:
sel->add_joined_table($$);
}
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
{
TEST_ASSERT
($3 && $7); add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
{
YYERROR_UNLESS
($3 && $7); add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
| select_derived_init get_select_lex select_derived2
{
LEX *lex= Lex;
...
...
@@ -8731,21 +8731,21 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume
xid: text_string
{
TEST_ASSERT
($1->length() <= MAXGTRIDSIZE);
YYERROR_UNLESS
($1->length() <= MAXGTRIDSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
}
| text_string ',' text_string
{
TEST_ASSERT
($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
YYERROR_UNLESS
($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}
| text_string ',' text_string ',' ulong_num
{
TEST_ASSERT
($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
YYERROR_UNLESS
($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
...
...
sql/table.cc
View file @
01b3c709
...
...
@@ -1926,7 +1926,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds,
(
check_opt_type
==
VIEW_CHECK_CASCADED
&&
ancestor
->
check_option
))
{
Item
_arena
*
arena
=
thd
->
current_arena
,
backup
;
Query
_arena
*
arena
=
thd
->
current_arena
,
backup
;
TABLE_LIST
*
tbl
=
this
;
if
(
arena
->
is_conventional
())
arena
=
0
;
// For easier test
...
...
@@ -2016,7 +2016,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds,
/* full text function moving to current select */
if
(
view
->
select_lex
.
ftfunc_list
->
elements
)
{
Item
_arena
*
arena
=
thd
->
current_arena
,
backup
;
Query
_arena
*
arena
=
thd
->
current_arena
,
backup
;
if
(
arena
->
is_conventional
())
arena
=
0
;
// For easier test
else
...
...
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