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
d80ebc17
Commit
d80ebc17
authored
Apr 02, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanups
Don't use DBUG library for struct st_my_thread_var to make code less complicated.
parent
591bda67
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
74 additions
and
78 deletions
+74
-78
Docs/manual.texi
Docs/manual.texi
+3
-1
acinclude.m4
acinclude.m4
+2
-2
client/mysql.cc
client/mysql.cc
+11
-8
client/mysqladmin.c
client/mysqladmin.c
+1
-1
client/mysqltest.c
client/mysqltest.c
+4
-3
include/my_pthread.h
include/my_pthread.h
+5
-0
include/my_sys.h
include/my_sys.h
+1
-4
include/mysql.h
include/mysql.h
+10
-9
libmysql/libmysql.c
libmysql/libmysql.c
+8
-8
mysys/my_static.h
mysys/my_static.h
+4
-3
mysys/my_thr_init.c
mysys/my_thr_init.c
+15
-32
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+3
-2
sql/net_pkg.cc
sql/net_pkg.cc
+6
-4
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
No files found.
Docs/manual.texi
View file @
d80ebc17
...
@@ -32537,7 +32537,7 @@ mysql> select MD5("testing");
...
@@ -32537,7 +32537,7 @@ mysql> select MD5("testing");
This is an "RSA Data Security, Inc. MD5 Message-Digest Algorithm".
This is an "RSA Data Security, Inc. MD5 Message-Digest Algorithm".
@findex DES_ENCRYPT()
@findex DES_ENCRYPT()
@item DES_ENCRYPT(string_to_encrypt
, flag,
[, (key_number | key_string) ] )
@item DES_ENCRYPT(string_to_encrypt [, (key_number | key_string) ] )
Encrypts the string with the given key using the DES algorithm, which
Encrypts the string with the given key using the DES algorithm, which
provides strong encryption.
provides strong encryption.
...
@@ -48931,6 +48931,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -48931,6 +48931,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
Don't give an error for @code{CREATE TABLE ...(... VARCHAR(0))}.
@item
Fixed @code{SIGINT} and @code{SIGQUIT} problems in @file{mysql.cc} on Linux
Fixed @code{SIGINT} and @code{SIGQUIT} problems in @file{mysql.cc} on Linux
with some @code{glibc} versions.
with some @code{glibc} versions.
@item
@item
acinclude.m4
View file @
d80ebc17
...
@@ -703,14 +703,14 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
...
@@ -703,14 +703,14 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
AC_DEFUN(MYSQL_FIND_OPENSSL, [
AC_DEFUN(MYSQL_FIND_OPENSSL, [
for d in /usr/ssl/include /usr/local/ssl/include /usr/include/openssl \
for d in /usr/ssl/include /usr/local/ssl/include /usr/include/openssl \
/usr/include/ssl /opt/ssl/include /opt/openssl/include \
/usr/include/ssl /opt/ssl/include /opt/openssl/include \
/usr/local/ssl/include/openssl ; do
/usr/local/ssl/include/openssl
/usr/local/include/openssl
; do
if test -f $d/ssl.h ; then
if test -f $d/ssl.h ; then
OPENSSL_INCLUDE=$d
OPENSSL_INCLUDE=$d
fi
fi
done
done
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /opt/ssl/lib /opt/openssl/lib ; do
/usr/lib /opt/ssl/lib /opt/openssl/lib
/usr/local/lib/
; do
if test -f $d/libssl.a ; then
if test -f $d/libssl.a ; then
OPENSSL_LIB=$d
OPENSSL_LIB=$d
fi
fi
...
...
client/mysql.cc
View file @
d80ebc17
...
@@ -2340,7 +2340,7 @@ static int
...
@@ -2340,7 +2340,7 @@ static int
com_status
(
String
*
buffer
__attribute__
((
unused
)),
com_status
(
String
*
buffer
__attribute__
((
unused
)),
char
*
line
__attribute__
((
unused
)))
char
*
line
__attribute__
((
unused
)))
{
{
char
*
status
;
c
onst
c
har
*
status
;
tee_puts
(
"--------------"
,
stdout
);
tee_puts
(
"--------------"
,
stdout
);
usage
(
1
);
/* Print version */
usage
(
1
);
/* Print version */
if
(
connected
)
if
(
connected
)
...
@@ -2635,18 +2635,21 @@ static const char* construct_prompt() {
...
@@ -2635,18 +2635,21 @@ static const char* construct_prompt() {
processed_prompt
.
append
(
current_db
?
current_db
:
"(none)"
);
processed_prompt
.
append
(
current_db
?
current_db
:
"(none)"
);
break
;
break
;
case
'h'
:
case
'h'
:
if
(
strstr
(
mysql_get_host_info
(
&
mysql
),
"Localhost"
))
{
{
const
char
*
prompt
=
mysql_get_host_info
(
&
mysql
);
if
(
strstr
(
prompt
,
"Localhost"
))
processed_prompt
.
append
(
"localhost"
);
processed_prompt
.
append
(
"localhost"
);
}
else
else
{
{
processed_prompt
.
append
(
strtok
(
mysql_get_host_info
(
&
mysql
),
" "
));
const
char
*
end
=
strcend
(
prompt
,
' '
);
processed_prompt
.
append
(
prompt
,
(
uint
)
(
end
-
prompt
));
}
}
break
;
break
;
}
case
'p'
:
case
'p'
:
if
(
strstr
(
mysql_get_host_info
(
&
mysql
),
"TCP/IP"
)
if
(
strstr
(
mysql_get_host_info
(
&
mysql
),
"TCP/IP"
)
||
||
!
mysql
.
unix_socket
)
{
!
mysql
.
unix_socket
)
add_int_to_prompt
(
mysql
.
port
);
add_int_to_prompt
(
mysql
.
port
);
}
else
else
processed_prompt
.
append
(
strrchr
(
mysql
.
unix_socket
,
'/'
)
+
1
);
processed_prompt
.
append
(
strrchr
(
mysql
.
unix_socket
,
'/'
)
+
1
);
break
;
break
;
...
...
client/mysqladmin.c
View file @
d80ebc17
...
@@ -400,7 +400,7 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user,
...
@@ -400,7 +400,7 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user,
static
int
execute_commands
(
MYSQL
*
mysql
,
int
argc
,
char
**
argv
)
static
int
execute_commands
(
MYSQL
*
mysql
,
int
argc
,
char
**
argv
)
{
{
char
*
status
;
c
onst
c
har
*
status
;
for
(;
argc
>
0
;
argv
++
,
argc
--
)
for
(;
argc
>
0
;
argv
++
,
argc
--
)
{
{
...
...
client/mysqltest.c
View file @
d80ebc17
...
@@ -268,7 +268,7 @@ struct st_replace;
...
@@ -268,7 +268,7 @@ struct st_replace;
struct
st_replace
*
init_replace
(
my_string
*
from
,
my_string
*
to
,
uint
count
,
struct
st_replace
*
init_replace
(
my_string
*
from
,
my_string
*
to
,
uint
count
,
my_string
word_end_chars
);
my_string
word_end_chars
);
uint
replace_strings
(
struct
st_replace
*
rep
,
my_string
*
start
,
uint
replace_strings
(
struct
st_replace
*
rep
,
my_string
*
start
,
uint
*
max_length
,
my_string
from
);
uint
*
max_length
,
const
char
*
from
);
void
free_replace
();
void
free_replace
();
static
int
insert_pointer_name
(
reg1
POINTER_ARRAY
*
pa
,
my_string
name
);
static
int
insert_pointer_name
(
reg1
POINTER_ARRAY
*
pa
,
my_string
name
);
void
free_pointer_array
(
POINTER_ARRAY
*
pa
);
void
free_pointer_array
(
POINTER_ARRAY
*
pa
);
...
@@ -2041,7 +2041,8 @@ void reject_dump(const char* record_file, char* buf, int size)
...
@@ -2041,7 +2041,8 @@ void reject_dump(const char* record_file, char* buf, int size)
/* Append the string to ds, with optional replace */
/* Append the string to ds, with optional replace */
static
void
replace_dynstr_append_mem
(
DYNAMIC_STRING
*
ds
,
char
*
val
,
int
len
)
static
void
replace_dynstr_append_mem
(
DYNAMIC_STRING
*
ds
,
const
char
*
val
,
int
len
)
{
{
if
(
glob_replace
)
if
(
glob_replace
)
{
{
...
@@ -3236,7 +3237,7 @@ static uint replace_len(my_string str)
...
@@ -3236,7 +3237,7 @@ static uint replace_len(my_string str)
/* Replace strings; Return length of result string */
/* Replace strings; Return length of result string */
uint
replace_strings
(
REPLACE
*
rep
,
my_string
*
start
,
uint
*
max_length
,
uint
replace_strings
(
REPLACE
*
rep
,
my_string
*
start
,
uint
*
max_length
,
my_string
from
)
const
char
*
from
)
{
{
reg1
REPLACE
*
rep_pos
;
reg1
REPLACE
*
rep_pos
;
reg2
REPLACE_STRING
*
rep_str
;
reg2
REPLACE_STRING
*
rep_str
;
...
...
include/my_pthread.h
View file @
d80ebc17
...
@@ -602,6 +602,11 @@ struct st_my_thread_var
...
@@ -602,6 +602,11 @@ struct st_my_thread_var
extern
struct
st_my_thread_var
*
_my_thread_var
(
void
)
__attribute__
((
const
));
extern
struct
st_my_thread_var
*
_my_thread_var
(
void
)
__attribute__
((
const
));
#define my_thread_var (_my_thread_var())
#define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno
#define my_errno my_thread_var->thr_errno
/*
Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
*/
extern
pthread_t
shutdown_th
,
main_th
,
signal_th
;
/* statistics_xxx functions are for not essential statistic */
/* statistics_xxx functions are for not essential statistic */
...
...
include/my_sys.h
View file @
d80ebc17
...
@@ -137,10 +137,7 @@ extern int NEAR my_errno; /* Last error in mysys */
...
@@ -137,10 +137,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern
uint
sf_malloc_prehunc
,
sf_malloc_endhunc
,
sf_malloc_quick
;
extern
uint
sf_malloc_prehunc
,
sf_malloc_endhunc
,
sf_malloc_quick
;
extern
ulonglong
safemalloc_mem_limit
;
extern
ulonglong
safemalloc_mem_limit
;
/* keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
*/
extern
pthread_t
shutdown_th
,
main_th
,
signal_th
;
#define CALLER_INFO_PROTO , const char *sFile, uint uLine
#define CALLER_INFO_PROTO , const char *sFile, uint uLine
#define CALLER_INFO , __FILE__, __LINE__
#define CALLER_INFO , __FILE__, __LINE__
#define ORIG_CALLER_INFO , sFile, uLine
#define ORIG_CALLER_INFO , sFile, uLine
...
...
include/mysql.h
View file @
d80ebc17
...
@@ -272,15 +272,15 @@ my_bool STDCALL mysql_eof(MYSQL_RES *res);
...
@@ -272,15 +272,15 @@ my_bool STDCALL mysql_eof(MYSQL_RES *res);
MYSQL_FIELD
*
STDCALL
mysql_fetch_field_direct
(
MYSQL_RES
*
res
,
MYSQL_FIELD
*
STDCALL
mysql_fetch_field_direct
(
MYSQL_RES
*
res
,
unsigned
int
fieldnr
);
unsigned
int
fieldnr
);
MYSQL_FIELD
*
STDCALL
mysql_fetch_fields
(
MYSQL_RES
*
res
);
MYSQL_FIELD
*
STDCALL
mysql_fetch_fields
(
MYSQL_RES
*
res
);
MYSQL_ROW
S
*
STDCALL
mysql_row_tell
(
MYSQL_RES
*
res
);
MYSQL_ROW
_OFFSET
STDCALL
mysql_row_tell
(
MYSQL_RES
*
res
);
unsigned
int
STDCALL
mysql_field_tell
(
MYSQL_RES
*
res
);
MYSQL_FIELD_OFFSET
STDCALL
mysql_field_tell
(
MYSQL_RES
*
res
);
unsigned
int
STDCALL
mysql_field_count
(
MYSQL
*
mysql
);
unsigned
int
STDCALL
mysql_field_count
(
MYSQL
*
mysql
);
my_ulonglong
STDCALL
mysql_affected_rows
(
MYSQL
*
mysql
);
my_ulonglong
STDCALL
mysql_affected_rows
(
MYSQL
*
mysql
);
my_ulonglong
STDCALL
mysql_insert_id
(
MYSQL
*
mysql
);
my_ulonglong
STDCALL
mysql_insert_id
(
MYSQL
*
mysql
);
unsigned
int
STDCALL
mysql_errno
(
MYSQL
*
mysql
);
unsigned
int
STDCALL
mysql_errno
(
MYSQL
*
mysql
);
char
*
STDCALL
mysql_error
(
MYSQL
*
mysql
);
c
onst
c
har
*
STDCALL
mysql_error
(
MYSQL
*
mysql
);
char
*
STDCALL
mysql_info
(
MYSQL
*
mysql
);
c
onst
c
har
*
STDCALL
mysql_info
(
MYSQL
*
mysql
);
unsigned
long
STDCALL
mysql_thread_id
(
MYSQL
*
mysql
);
unsigned
long
STDCALL
mysql_thread_id
(
MYSQL
*
mysql
);
const
char
*
STDCALL
mysql_character_set_name
(
MYSQL
*
mysql
);
const
char
*
STDCALL
mysql_character_set_name
(
MYSQL
*
mysql
);
...
@@ -353,10 +353,10 @@ int STDCALL mysql_refresh(MYSQL *mysql,
...
@@ -353,10 +353,10 @@ int STDCALL mysql_refresh(MYSQL *mysql,
unsigned
int
refresh_options
);
unsigned
int
refresh_options
);
int
STDCALL
mysql_kill
(
MYSQL
*
mysql
,
unsigned
long
pid
);
int
STDCALL
mysql_kill
(
MYSQL
*
mysql
,
unsigned
long
pid
);
int
STDCALL
mysql_ping
(
MYSQL
*
mysql
);
int
STDCALL
mysql_ping
(
MYSQL
*
mysql
);
char
*
STDCALL
mysql_stat
(
MYSQL
*
mysql
);
c
onst
c
har
*
STDCALL
mysql_stat
(
MYSQL
*
mysql
);
char
*
STDCALL
mysql_get_server_info
(
MYSQL
*
mysql
);
c
onst
c
har
*
STDCALL
mysql_get_server_info
(
MYSQL
*
mysql
);
char
*
STDCALL
mysql_get_client_info
(
void
);
c
onst
c
har
*
STDCALL
mysql_get_client_info
(
void
);
char
*
STDCALL
mysql_get_host_info
(
MYSQL
*
mysql
);
c
onst
c
har
*
STDCALL
mysql_get_host_info
(
MYSQL
*
mysql
);
unsigned
int
STDCALL
mysql_get_proto_info
(
MYSQL
*
mysql
);
unsigned
int
STDCALL
mysql_get_proto_info
(
MYSQL
*
mysql
);
MYSQL_RES
*
STDCALL
mysql_list_dbs
(
MYSQL
*
mysql
,
const
char
*
wild
);
MYSQL_RES
*
STDCALL
mysql_list_dbs
(
MYSQL
*
mysql
,
const
char
*
wild
);
MYSQL_RES
*
STDCALL
mysql_list_tables
(
MYSQL
*
mysql
,
const
char
*
wild
);
MYSQL_RES
*
STDCALL
mysql_list_tables
(
MYSQL
*
mysql
,
const
char
*
wild
);
...
@@ -370,7 +370,8 @@ int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
...
@@ -370,7 +370,8 @@ int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
void
STDCALL
mysql_free_result
(
MYSQL_RES
*
result
);
void
STDCALL
mysql_free_result
(
MYSQL_RES
*
result
);
void
STDCALL
mysql_data_seek
(
MYSQL_RES
*
result
,
void
STDCALL
mysql_data_seek
(
MYSQL_RES
*
result
,
my_ulonglong
offset
);
my_ulonglong
offset
);
MYSQL_ROW_OFFSET
STDCALL
mysql_row_seek
(
MYSQL_RES
*
result
,
MYSQL_ROW_OFFSET
);
MYSQL_ROW_OFFSET
STDCALL
mysql_row_seek
(
MYSQL_RES
*
result
,
MYSQL_ROW_OFFSET
offset
);
MYSQL_FIELD_OFFSET
STDCALL
mysql_field_seek
(
MYSQL_RES
*
result
,
MYSQL_FIELD_OFFSET
STDCALL
mysql_field_seek
(
MYSQL_RES
*
result
,
MYSQL_FIELD_OFFSET
offset
);
MYSQL_FIELD_OFFSET
offset
);
MYSQL_ROW
STDCALL
mysql_fetch_row
(
MYSQL_RES
*
result
);
MYSQL_ROW
STDCALL
mysql_fetch_row
(
MYSQL_RES
*
result
);
...
...
libmysql/libmysql.c
View file @
d80ebc17
...
@@ -2673,7 +2673,7 @@ mysql_dump_debug_info(MYSQL *mysql)
...
@@ -2673,7 +2673,7 @@ mysql_dump_debug_info(MYSQL *mysql)
DBUG_RETURN
(
simple_command
(
mysql
,
COM_DEBUG
,
0
,
0
,
0
));
DBUG_RETURN
(
simple_command
(
mysql
,
COM_DEBUG
,
0
,
0
,
0
));
}
}
char
*
STDCALL
c
onst
c
har
*
STDCALL
mysql_stat
(
MYSQL
*
mysql
)
mysql_stat
(
MYSQL
*
mysql
)
{
{
DBUG_ENTER
(
"mysql_stat"
);
DBUG_ENTER
(
"mysql_stat"
);
...
@@ -2698,14 +2698,14 @@ mysql_ping(MYSQL *mysql)
...
@@ -2698,14 +2698,14 @@ mysql_ping(MYSQL *mysql)
}
}
char
*
STDCALL
c
onst
c
har
*
STDCALL
mysql_get_server_info
(
MYSQL
*
mysql
)
mysql_get_server_info
(
MYSQL
*
mysql
)
{
{
return
((
char
*
)
mysql
->
server_version
);
return
((
char
*
)
mysql
->
server_version
);
}
}
char
*
STDCALL
c
onst
c
har
*
STDCALL
mysql_get_host_info
(
MYSQL
*
mysql
)
mysql_get_host_info
(
MYSQL
*
mysql
)
{
{
return
(
mysql
->
host_info
);
return
(
mysql
->
host_info
);
...
@@ -2718,7 +2718,7 @@ mysql_get_proto_info(MYSQL *mysql)
...
@@ -2718,7 +2718,7 @@ mysql_get_proto_info(MYSQL *mysql)
return
(
mysql
->
protocol_version
);
return
(
mysql
->
protocol_version
);
}
}
char
*
STDCALL
c
onst
c
har
*
STDCALL
mysql_get_client_info
(
void
)
mysql_get_client_info
(
void
)
{
{
return
(
char
*
)
MYSQL_SERVER_VERSION
;
return
(
char
*
)
MYSQL_SERVER_VERSION
;
...
@@ -2803,12 +2803,12 @@ MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res)
...
@@ -2803,12 +2803,12 @@ MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res)
return
(
res
)
->
fields
;
return
(
res
)
->
fields
;
}
}
MYSQL_ROW
S
*
STDCALL
mysql_row_tell
(
MYSQL_RES
*
res
)
MYSQL_ROW
_OFFSET
STDCALL
mysql_row_tell
(
MYSQL_RES
*
res
)
{
{
return
res
->
data_cursor
;
return
res
->
data_cursor
;
}
}
uint
STDCALL
mysql_field_tell
(
MYSQL_RES
*
res
)
MYSQL_FIELD_OFFSET
STDCALL
mysql_field_tell
(
MYSQL_RES
*
res
)
{
{
return
(
res
)
->
current_field
;
return
(
res
)
->
current_field
;
}
}
...
@@ -2835,12 +2835,12 @@ uint STDCALL mysql_errno(MYSQL *mysql)
...
@@ -2835,12 +2835,12 @@ uint STDCALL mysql_errno(MYSQL *mysql)
return
mysql
->
net
.
last_errno
;
return
mysql
->
net
.
last_errno
;
}
}
char
*
STDCALL
mysql_error
(
MYSQL
*
mysql
)
c
onst
c
har
*
STDCALL
mysql_error
(
MYSQL
*
mysql
)
{
{
return
mysql
->
net
.
last_error
;
return
mysql
->
net
.
last_error
;
}
}
char
*
STDCALL
mysql_info
(
MYSQL
*
mysql
)
c
onst
c
har
*
STDCALL
mysql_info
(
MYSQL
*
mysql
)
{
{
return
mysql
->
info
;
return
mysql
->
info
;
}
}
...
...
mysys/my_static.h
View file @
d80ebc17
...
@@ -57,10 +57,11 @@ extern const char *soundex_map;
...
@@ -57,10 +57,11 @@ extern const char *soundex_map;
extern
USED_MEM
*
my_once_root_block
;
extern
USED_MEM
*
my_once_root_block
;
extern
uint
my_once_extra
;
extern
uint
my_once_extra
;
/* these threads are exept from safemalloc leak scrutiny unless
/*
PEDANTIC_SAFEMALLOC is defined
These threads are exept from safemalloc leak scrutiny unless
PEDANTIC_SAFEMALLOC is defined
*/
*/
extern
pthread_t
signal_thread
,
kill_thread
;
extern
pthread_t
signal_thread
,
kill_thread
;
#ifndef HAVE_TEMPNAM
#ifndef HAVE_TEMPNAM
extern
int
_my_tempnam_used
;
extern
int
_my_tempnam_used
;
...
...
mysys/my_thr_init.c
View file @
d80ebc17
...
@@ -111,6 +111,7 @@ my_bool my_thread_init(void)
...
@@ -111,6 +111,7 @@ my_bool my_thread_init(void)
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_lock
(
&
THR_LOCK_lock
);
pthread_mutex_lock
(
&
THR_LOCK_lock
);
#endif
#endif
#if !defined(__WIN__) || defined(USE_TLS)
#if !defined(__WIN__) || defined(USE_TLS)
if
(
my_pthread_getspecific
(
struct
st_my_thread_var
*
,
THR_KEY_mysys
))
if
(
my_pthread_getspecific
(
struct
st_my_thread_var
*
,
THR_KEY_mysys
))
{
{
...
@@ -121,17 +122,8 @@ my_bool my_thread_init(void)
...
@@ -121,17 +122,8 @@ my_bool my_thread_init(void)
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
return
0
;
/* Safequard */
return
0
;
/* Safequard */
}
}
/* We must have many calloc() here because these are freed on
pthread_exit */
/*
Sasha: the above comment does not make sense. I have changed calloc() to
equivalent my_malloc() but it was calloc() before. It seems like the
comment is out of date - we always call my_thread_end() before
pthread_exit() to clean up. Note that I have also fixed up DBUG
code to be able to call it from my_thread_init()
*/
if
(
!
(
tmp
=
(
struct
st_my_thread_var
*
)
if
(
!
(
tmp
=
(
struct
st_my_thread_var
*
)
my_malloc
(
sizeof
(
struct
st_my_thread_var
),
MYF
(
MY_WME
|
MY_ZEROFILL
))))
calloc
(
1
,
sizeof
(
struct
st_my_thread_var
))))
{
{
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
return
1
;
return
1
;
...
@@ -139,21 +131,18 @@ my_bool my_thread_init(void)
...
@@ -139,21 +131,18 @@ my_bool my_thread_init(void)
pthread_setspecific
(
THR_KEY_mysys
,
tmp
);
pthread_setspecific
(
THR_KEY_mysys
,
tmp
);
#else
#else
/* Sasha: TODO - explain what exactly we are doing on Windows
/*
At first glance, I have a hard time following the code
Skip initialization if the thread specific variable is already initialized
*/
*/
if
(
THR_KEY_mysys
.
id
)
/* Already initialized */
if
(
THR_KEY_mysys
.
id
)
{
goto
end
;
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
#endif
return
0
;
}
tmp
=
&
THR_KEY_mysys
;
tmp
=
&
THR_KEY_mysys
;
#endif
#endif
tmp
->
id
=
++
thread_id
;
tmp
->
id
=
++
thread_id
;
pthread_mutex_init
(
&
tmp
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
tmp
->
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
tmp
->
suspend
,
NULL
);
pthread_cond_init
(
&
tmp
->
suspend
,
NULL
);
end:
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
pthread_mutex_unlock
(
&
THR_LOCK_lock
);
#endif
#endif
...
@@ -170,11 +159,7 @@ void my_thread_end(void)
...
@@ -170,11 +159,7 @@ void my_thread_end(void)
if
(
tmp
)
if
(
tmp
)
{
{
#if !defined(DBUG_OFF)
#if !defined(DBUG_OFF)
/* Sasha: tmp->dbug is allocated inside DBUG library
/* tmp->dbug is allocated inside DBUG library */
so for now we will not mess with trying to use my_malloc()/
my_free(), but in the future it would be nice to figure out a
way to do it
*/
if
(
tmp
->
dbug
)
if
(
tmp
->
dbug
)
{
{
free
(
tmp
->
dbug
);
free
(
tmp
->
dbug
);
...
@@ -186,15 +171,13 @@ void my_thread_end(void)
...
@@ -186,15 +171,13 @@ void my_thread_end(void)
#endif
#endif
pthread_mutex_destroy
(
&
tmp
->
mutex
);
pthread_mutex_destroy
(
&
tmp
->
mutex
);
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
/* we need to setspecific to 0 BEFORE we call my_free, as my_free
free
(
tmp
);
uses some DBUG_ macros that will use the follow the specific
pointer after the block it is pointing to has been freed if
specific does not get reset first
*/
pthread_setspecific
(
THR_KEY_mysys
,
0
);
my_free
((
gptr
)
tmp
,
MYF
(
MY_WME
));
#endif
#endif
}
}
/* The following free has to be done, even if my_thread_var() is 0 */
#if (!defined(__WIN__) && !defined(OS2)) || defined(USE_TLS)
pthread_setspecific
(
THR_KEY_mysys
,
0
);
#endif
}
}
struct
st_my_thread_var
*
_my_thread_var
(
void
)
struct
st_my_thread_var
*
_my_thread_var
(
void
)
...
...
sql/item_cmpfunc.cc
View file @
d80ebc17
...
@@ -790,8 +790,9 @@ String *Item_func_coalesce::val_str(String *str)
...
@@ -790,8 +790,9 @@ String *Item_func_coalesce::val_str(String *str)
null_value
=
0
;
null_value
=
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
{
if
(
args
[
i
]
->
val_str
(
str
)
!=
NULL
)
String
*
res
;
return
args
[
i
]
->
val_str
(
str
);
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
return
res
;
}
}
null_value
=
1
;
null_value
=
1
;
return
0
;
return
0
;
...
...
sql/net_pkg.cc
View file @
d80ebc17
...
@@ -108,10 +108,12 @@ net_printf(NET *net, uint errcode, ...)
...
@@ -108,10 +108,12 @@ net_printf(NET *net, uint errcode, ...)
thd
->
query_error
=
1
;
// if we are here, something is wrong :-)
thd
->
query_error
=
1
;
// if we are here, something is wrong :-)
query_cache_abort
(
net
);
// Safety
query_cache_abort
(
net
);
// Safety
va_start
(
args
,
errcode
);
va_start
(
args
,
errcode
);
// Sasha: this is needed to make net_printf() work with 0 argument for
/*
// errorcode and use the argument after that as the format string. This
The following is needed to make net_printf() work with 0 argument for
// is usefull for rare errors that are not worth the hassle to put in
errorcode and use the argument after that as the format string. This
// errmsg.sys, but at the same time, the message is not fixed text
is useful for rare errors that are not worth the hassle to put in
errmsg.sys, but at the same time, the message is not fixed text
*/
format
=
errcode
?
ER
(
errcode
)
:
va_arg
(
args
,
char
*
);
format
=
errcode
?
ER
(
errcode
)
:
va_arg
(
args
,
char
*
);
offset
=
net
->
return_errno
?
2
:
0
;
offset
=
net
->
return_errno
?
2
:
0
;
text_pos
=
(
char
*
)
net
->
buff
+
head_length
+
offset
+
1
;
text_pos
=
(
char
*
)
net
->
buff
+
head_length
+
offset
+
1
;
...
...
sql/sql_parse.cc
View file @
d80ebc17
...
@@ -2990,7 +2990,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
...
@@ -2990,7 +2990,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
if
(
new_field
->
length
>=
MAX_FIELD_WIDTH
||
if
(
new_field
->
length
>=
MAX_FIELD_WIDTH
||
(
!
new_field
->
length
&&
!
(
new_field
->
flags
&
BLOB_FLAG
)
&&
(
!
new_field
->
length
&&
!
(
new_field
->
flags
&
BLOB_FLAG
)
&&
type
!=
FIELD_TYPE_STRING
))
type
!=
FIELD_TYPE_STRING
&&
type
!=
FIELD_TYPE_VAR_STRING
))
{
{
net_printf
(
&
thd
->
net
,
ER_TOO_BIG_FIELDLENGTH
,
field_name
,
net_printf
(
&
thd
->
net
,
ER_TOO_BIG_FIELDLENGTH
,
field_name
,
MAX_FIELD_WIDTH
-
1
);
/* purecov: inspected */
MAX_FIELD_WIDTH
-
1
);
/* purecov: inspected */
...
...
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