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
5f24be65
Commit
5f24be65
authored
Mar 04, 2011
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed prefix from ES_ to STMT_ on Query arena state
parent
fd926652
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
31 deletions
+32
-31
sql/sp_head.cc
sql/sp_head.cc
+7
-7
sql/sp_head.h
sql/sp_head.h
+1
-1
sql/sql_class.h
sql/sql_class.h
+12
-12
sql/sql_cursor.h
sql/sql_cursor.h
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+9
-9
sql/table.cc
sql/table.cc
+2
-1
No files found.
sql/sp_head.cc
View file @
5f24be65
...
...
@@ -550,7 +550,7 @@ sp_head::operator delete(void *ptr, size_t size) throw()
sp_head
::
sp_head
()
:
Query_arena
(
&
main_mem_root
,
ES
_INITIALIZED_FOR_SP
),
:
Query_arena
(
&
main_mem_root
,
STMT
_INITIALIZED_FOR_SP
),
m_flags
(
0
),
m_sp_cache_version
(
0
),
unsafe_flags
(
0
),
...
...
@@ -1208,7 +1208,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Query_arena
*
old_arena
;
/* per-instruction arena */
MEM_ROOT
execute_mem_root
;
Query_arena
execute_arena
(
&
execute_mem_root
,
ES
_INITIALIZED_FOR_SP
),
Query_arena
execute_arena
(
&
execute_mem_root
,
STMT
_INITIALIZED_FOR_SP
),
backup_arena
;
query_id_t
old_query_id
;
TABLE
*
old_derived_tables
;
...
...
@@ -1488,7 +1488,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd
->
m_reprepare_observer
=
save_reprepare_observer
;
thd
->
stmt_arena
=
old_arena
;
state
=
ES
_EXECUTED
;
state
=
STMT
_EXECUTED
;
/*
Restore the caller's original warning information area:
...
...
@@ -1646,7 +1646,7 @@ sp_head::execute_trigger(THD *thd,
sp_rcontext
*
nctx
=
NULL
;
bool
err_status
=
FALSE
;
MEM_ROOT
call_mem_root
;
Query_arena
call_arena
(
&
call_mem_root
,
Query_arena
::
ES
_INITIALIZED_FOR_SP
);
Query_arena
call_arena
(
&
call_mem_root
,
Query_arena
::
STMT
_INITIALIZED_FOR_SP
);
Query_arena
backup_arena
;
DBUG_ENTER
(
"sp_head::execute_trigger"
);
...
...
@@ -1787,7 +1787,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
String
binlog_buf
(
buf
,
sizeof
(
buf
),
&
my_charset_bin
);
bool
err_status
=
FALSE
;
MEM_ROOT
call_mem_root
;
Query_arena
call_arena
(
&
call_mem_root
,
Query_arena
::
ES
_INITIALIZED_FOR_SP
);
Query_arena
call_arena
(
&
call_mem_root
,
Query_arena
::
STMT
_INITIALIZED_FOR_SP
);
Query_arena
backup_arena
;
DBUG_ENTER
(
"sp_head::execute_function"
);
DBUG_PRINT
(
"info"
,
(
"function %s"
,
m_name
.
str
));
...
...
@@ -2544,7 +2544,7 @@ sp_head::restore_thd_mem_root(THD *thd)
DBUG_ENTER
(
"sp_head::restore_thd_mem_root"
);
Item
*
flist
=
free_list
;
// The old list
set_query_arena
(
thd
);
// Get new free_list and mem_root
state
=
ES
_INITIALIZED_FOR_SP
;
state
=
STMT
_INITIALIZED_FOR_SP
;
DBUG_PRINT
(
"info"
,
(
"mem_root 0x%lx returned from thd mem root 0x%lx"
,
(
ulong
)
&
mem_root
,
(
ulong
)
&
thd
->
mem_root
));
...
...
@@ -3008,7 +3008,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
(
thd
->
stmt_da
->
sql_errno
()
!=
ER_CANT_REOPEN_TABLE
&&
thd
->
stmt_da
->
sql_errno
()
!=
ER_NO_SUCH_TABLE
&&
thd
->
stmt_da
->
sql_errno
()
!=
ER_UPDATE_TABLE_USED
))
thd
->
stmt_arena
->
state
=
Query_arena
::
ES
_EXECUTED
;
thd
->
stmt_arena
->
state
=
Query_arena
::
STMT
_EXECUTED
;
/*
Merge here with the saved parent's values
...
...
sql/sp_head.h
View file @
5f24be65
...
...
@@ -560,7 +560,7 @@ class sp_instr :public Query_arena, public Sql_alloc
/// Should give each a name or type code for debugging purposes?
sp_instr
(
uint
ip
,
sp_pcontext
*
ctx
)
:
Query_arena
(
0
,
ES
_INITIALIZED_FOR_SP
),
marked
(
0
),
m_ip
(
ip
),
m_ctx
(
ctx
)
:
Query_arena
(
0
,
STMT
_INITIALIZED_FOR_SP
),
marked
(
0
),
m_ip
(
ip
),
m_ctx
(
ctx
)
{}
virtual
~
sp_instr
()
...
...
sql/sql_class.h
View file @
5f24be65
...
...
@@ -624,14 +624,14 @@ class Query_arena
/*
The states relfects three diffrent life cycles for three
different types of statements:
Prepared statement:
ES_INITIALIZED -> ES_PREPARED -> ES
_EXECUTED.
Stored procedure:
ES_INITIALIZED_FOR_SP -> ES
_EXECUTED.
Other statements:
ES
_CONVENTIONAL_EXECUTION never changes.
Prepared statement:
STMT_INITIALIZED -> STMT_PREPARED -> STMT
_EXECUTED.
Stored procedure:
STMT_INITIALIZED_FOR_SP -> STMT
_EXECUTED.
Other statements:
STMT
_CONVENTIONAL_EXECUTION never changes.
*/
enum
enum_state
{
ES_INITIALIZED
=
0
,
ES_INITIALIZED_FOR_SP
=
1
,
ES
_PREPARED
=
2
,
ES_CONVENTIONAL_EXECUTION
=
3
,
ES_EXECUTED
=
4
,
ES
_ERROR
=
-
1
STMT_INITIALIZED
=
0
,
STMT_INITIALIZED_FOR_SP
=
1
,
STMT
_PREPARED
=
2
,
STMT_CONVENTIONAL_EXECUTION
=
3
,
STMT_EXECUTED
=
4
,
STMT
_ERROR
=
-
1
};
enum_state
state
;
...
...
@@ -654,18 +654,18 @@ class Query_arena
virtual
Type
type
()
const
;
virtual
~
Query_arena
()
{};
inline
bool
is_stmt_prepare
()
const
{
return
state
==
ES
_INITIALIZED
;
}
inline
bool
is_stmt_prepare
()
const
{
return
state
==
STMT
_INITIALIZED
;
}
inline
bool
is_first_sp_execute
()
const
{
return
state
==
ES
_INITIALIZED_FOR_SP
;
}
{
return
state
==
STMT
_INITIALIZED_FOR_SP
;
}
inline
bool
is_stmt_prepare_or_first_sp_execute
()
const
{
return
(
int
)
state
<
(
int
)
ES
_PREPARED
;
}
{
return
(
int
)
state
<
(
int
)
STMT
_PREPARED
;
}
inline
bool
is_stmt_prepare_or_first_stmt_execute
()
const
{
return
(
int
)
state
<=
(
int
)
ES
_PREPARED
;
}
inline
bool
is_first_stmt_execute
()
const
{
return
state
==
ES
_PREPARED
;
}
{
return
(
int
)
state
<=
(
int
)
STMT
_PREPARED
;
}
inline
bool
is_first_stmt_execute
()
const
{
return
state
==
STMT
_PREPARED
;
}
inline
bool
is_stmt_execute
()
const
{
return
state
==
ES_PREPARED
||
state
==
ES
_EXECUTED
;
}
{
return
state
==
STMT_PREPARED
||
state
==
STMT
_EXECUTED
;
}
inline
bool
is_conventional
()
const
{
return
state
==
ES
_CONVENTIONAL_EXECUTION
;
}
{
return
state
==
STMT
_CONVENTIONAL_EXECUTION
;
}
inline
void
*
alloc
(
size_t
size
)
{
return
alloc_root
(
mem_root
,
size
);
}
inline
void
*
calloc
(
size_t
size
)
...
...
sql/sql_cursor.h
View file @
5f24be65
...
...
@@ -46,7 +46,7 @@ class Server_side_cursor: protected Query_arena, public Sql_alloc
select_result
*
result
;
public:
Server_side_cursor
(
MEM_ROOT
*
mem_root_arg
,
select_result
*
result_arg
)
:
Query_arena
(
mem_root_arg
,
ES
_INITIALIZED
),
result
(
result_arg
)
:
Query_arena
(
mem_root_arg
,
STMT
_INITIALIZED
),
result
(
result_arg
)
{}
virtual
bool
is_open
()
const
=
0
;
...
...
sql/sql_prepare.cc
View file @
5f24be65
...
...
@@ -2712,7 +2712,7 @@ void mysqld_stmt_reset(THD *thd, char *packet)
*/
reset_stmt_params
(
stmt
);
stmt
->
state
=
Query_arena
::
ES
_PREPARED
;
stmt
->
state
=
Query_arena
::
STMT
_PREPARED
;
general_log_print
(
thd
,
thd
->
command
,
NullS
);
...
...
@@ -2830,7 +2830,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
=
Query_arena
::
ES
_ERROR
;
stmt
->
state
=
Query_arena
::
STMT
_ERROR
;
stmt
->
last_errno
=
ER_WRONG_ARGUMENTS
;
sprintf
(
stmt
->
last_error
,
ER
(
ER_WRONG_ARGUMENTS
),
"mysqld_stmt_send_long_data"
);
...
...
@@ -2846,7 +2846,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
=
Query_arena
::
ES
_ERROR
;
stmt
->
state
=
Query_arena
::
STMT
_ERROR
;
stmt
->
last_errno
=
ER_OUTOFMEMORY
;
sprintf
(
stmt
->
last_error
,
ER
(
ER_OUTOFMEMORY
),
0
);
}
...
...
@@ -2999,7 +2999,7 @@ Execute_sql_statement::execute_server_code(THD *thd)
Prepared_statement
::
Prepared_statement
(
THD
*
thd_arg
)
:
Statement
(
NULL
,
&
main_mem_root
,
ES
_INITIALIZED
,
++
thd_arg
->
statement_id_counter
),
STMT
_INITIALIZED
,
++
thd_arg
->
statement_id_counter
),
thd
(
thd_arg
),
result
(
thd_arg
),
param_array
(
0
),
...
...
@@ -3272,7 +3272,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
{
setup_set_params
();
lex
->
context_analysis_only
&=
~
CONTEXT_ANALYSIS_ONLY_PREPARE
;
state
=
Query_arena
::
ES
_PREPARED
;
state
=
Query_arena
::
STMT
_PREPARED
;
flags
&=
~
(
uint
)
IS_IN_USE
;
/*
...
...
@@ -3446,7 +3446,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
Item_change_list
save_change_list
;
thd
->
change_list
.
move_elements_to
(
&
save_change_list
);
state
=
ES
_CONVENTIONAL_EXECUTION
;
state
=
STMT
_CONVENTIONAL_EXECUTION
;
if
(
!
(
lex
=
new
(
mem_root
)
st_lex_local
))
return
TRUE
;
...
...
@@ -3657,7 +3657,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
status_var_increment
(
thd
->
status_var
.
com_stmt_execute
);
/* Check if we got an error when sending long data */
if
(
state
==
Query_arena
::
ES
_ERROR
)
if
(
state
==
Query_arena
::
STMT
_ERROR
)
{
my_message
(
last_errno
,
last_error
,
MYF
(
0
));
return
TRUE
;
...
...
@@ -3787,8 +3787,8 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd
->
set_statement
(
&
stmt_backup
);
thd
->
stmt_arena
=
old_stmt_arena
;
if
(
state
==
Query_arena
::
ES
_PREPARED
)
state
=
Query_arena
::
ES
_EXECUTED
;
if
(
state
==
Query_arena
::
STMT
_PREPARED
)
state
=
Query_arena
::
STMT
_EXECUTED
;
if
(
error
==
0
&&
this
->
lex
->
sql_command
==
SQLCOM_CALL
)
{
...
...
sql/table.cc
View file @
5f24be65
...
...
@@ -1933,7 +1933,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
Query_arena
*
backup_stmt_arena_ptr
=
thd
->
stmt_arena
;
Query_arena
backup_arena
;
Query_arena
part_func_arena
(
&
outparam
->
mem_root
,
Query_arena
::
ES_INITIALIZED
);
Query_arena
part_func_arena
(
&
outparam
->
mem_root
,
Query_arena
::
STMT_INITIALIZED
);
thd
->
set_n_backup_active_arena
(
&
part_func_arena
,
&
backup_arena
);
thd
->
stmt_arena
=
&
part_func_arena
;
bool
tmp
;
...
...
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