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
359549be
Commit
359549be
authored
May 18, 2011
by
Mayank Prasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge from 5.1 for bug#11764633
parent
a48bff1d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
2 deletions
+54
-2
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+26
-2
sql/mysqld.h
sql/mysqld.h
+8
-0
sql/sql_class.cc
sql/sql_class.cc
+19
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
No files found.
libmysqld/lib_sql.cc
View file @
359549be
...
...
@@ -50,6 +50,23 @@ extern "C" void unireg_clear(int exit_code)
DBUG_VOID_RETURN
;
}
/*
Wrapper error handler for embedded server to call client/server error
handler based on whether thread is in client/server context
*/
static
void
embedded_error_handler
(
uint
error
,
const
char
*
str
,
myf
MyFlags
)
{
DBUG_ENTER
(
"embedded_error_handler"
);
/*
If current_thd is NULL, it means restore_global has been called and
thread is in client context, then call client error handler else call
server error handler.
*/
DBUG_RETURN
(
current_thd
?
my_message_sql
(
error
,
str
,
MyFlags
)
:
my_message_stderr
(
error
,
str
,
MyFlags
));
}
/*
Reads error information from the MYSQL_DATA and puts
...
...
@@ -106,7 +123,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
if
(
mysql
->
status
!=
MYSQL_STATUS_READY
)
{
set_mysql_error
(
mysql
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
return
1
;
result
=
1
;
goto
end
;
}
/* Clear result variables */
...
...
@@ -147,6 +165,9 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
#if defined(ENABLED_PROFILING)
thd
->
profiling
.
finish_current_query
();
#endif
end:
thd
->
restore_globals
();
return
result
;
}
...
...
@@ -545,7 +566,10 @@ int init_embedded_server(int argc, char **argv, char **groups)
return
1
;
}
error_handler_hook
=
my_message_sql
;
/*
set error_handler_hook to embedded_error_handler wrapper.
*/
error_handler_hook
=
embedded_error_handler
;
acl_error
=
0
;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
...
...
sql/mysqld.h
View file @
359549be
...
...
@@ -216,6 +216,10 @@ extern char err_shared_dir[];
extern
TYPELIB
thread_handling_typelib
;
extern
my_decimal
decimal_zero
;
/*
THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
*/
extern
pthread_key
(
MEM_ROOT
**
,
THR_MALLOC
);
#ifdef HAVE_PSI_INTERFACE
...
...
@@ -503,6 +507,10 @@ get_thread_running()
extern
"C"
THD
*
_current_thd_noinline
();
#define _current_thd() _current_thd_noinline()
#else
/*
THR_THD is a key which will be used to set/get THD* for a thread,
using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
*/
extern
pthread_key
(
THD
*
,
THR_THD
);
inline
THD
*
_current_thd
(
void
)
{
...
...
sql/sql_class.cc
View file @
359549be
...
...
@@ -1354,6 +1354,25 @@ bool THD::store_globals()
return
0
;
}
/*
Remove the thread specific info (THD and mem_root pointer) stored during
store_global call for this thread.
*/
bool
THD
::
restore_globals
()
{
/*
Assert that thread_stack is initialized: it's necessary to be able
to track stack overrun.
*/
DBUG_ASSERT
(
thread_stack
);
/* Undocking the thread specific data. */
my_pthread_setspecific_ptr
(
THR_THD
,
NULL
);
my_pthread_setspecific_ptr
(
THR_MALLOC
,
NULL
);
return
0
;
}
/*
Cleanup after query.
...
...
sql/sql_class.h
View file @
359549be
...
...
@@ -2199,6 +2199,7 @@ class THD :public Statement,
void
cleanup
(
void
);
void
cleanup_after_query
();
bool
store_globals
();
bool
restore_globals
();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline
void
set_active_vio
(
Vio
*
vio
)
{
...
...
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