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
85067c83
Commit
85067c83
authored
Nov 07, 2008
by
Kristofer Pettersson
Browse files
Options
Browse Files
Download
Plain Diff
Automerge
parents
f309f847
95007f5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
sql/sql_class.cc
sql/sql_class.cc
+27
-12
No files found.
sql/sql_class.cc
View file @
85067c83
...
@@ -306,20 +306,25 @@ void thd_inc_row_count(THD *thd)
...
@@ -306,20 +306,25 @@ void thd_inc_row_count(THD *thd)
thd
->
row_count
++
;
thd
->
row_count
++
;
}
}
/*
/**
Dumps a text description of a thread, its security context
Dumps a text description of a thread, its security context
(user, host) and the current query.
(user, host) and the current query.
SYNOPSIS
@param thd current thread context
thd_security_context()
@param buffer pointer to preferred result buffer
thd current thread context
@param length length of buffer
buffer pointer to preferred result buffer
@param max_query_len how many chars of query to copy (0 for all)
length length of buffer
max_query_len how many chars of query to copy (0 for all)
@req LOCK_thread_count
RETURN VALUES
@note LOCK_thread_count mutex is not necessary when the function is invoked on
pointer to string
the currently running thread (current_thd) or if the caller in some other
way guarantees that access to thd->query is serialized.
@return Pointer to string
*/
*/
extern
"C"
extern
"C"
char
*
thd_security_context
(
THD
*
thd
,
char
*
buffer
,
unsigned
int
length
,
char
*
thd_security_context
(
THD
*
thd
,
char
*
buffer
,
unsigned
int
length
,
unsigned
int
max_query_len
)
unsigned
int
max_query_len
)
...
@@ -328,6 +333,16 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
...
@@ -328,6 +333,16 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
const
Security_context
*
sctx
=
&
thd
->
main_security_ctx
;
const
Security_context
*
sctx
=
&
thd
->
main_security_ctx
;
char
header
[
64
];
char
header
[
64
];
int
len
;
int
len
;
/*
The pointers thd->query and thd->proc_info might change since they are
being modified concurrently. This is acceptable for proc_info since its
values doesn't have to very accurate and the memory it points to is static,
but we need to attempt a snapshot on the pointer values to avoid using NULL
values. The pointer to thd->query however, doesn't point to static memory
and has to be protected by LOCK_thread_count or risk pointing to
uninitialized memory.
*/
const
char
*
proc_info
=
thd
->
proc_info
;
len
=
my_snprintf
(
header
,
sizeof
(
header
),
len
=
my_snprintf
(
header
,
sizeof
(
header
),
"MySQL thread id %lu, query id %lu"
,
"MySQL thread id %lu, query id %lu"
,
...
@@ -353,10 +368,10 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
...
@@ -353,10 +368,10 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
str
.
append
(
sctx
->
user
);
str
.
append
(
sctx
->
user
);
}
}
if
(
thd
->
proc_info
)
if
(
proc_info
)
{
{
str
.
append
(
' '
);
str
.
append
(
' '
);
str
.
append
(
thd
->
proc_info
);
str
.
append
(
proc_info
);
}
}
if
(
thd
->
query
)
if
(
thd
->
query
)
...
...
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