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
039c6b1b
Commit
039c6b1b
authored
Jun 28, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added interface for first set of dynamic variables.
parent
e0087780
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
265 additions
and
128 deletions
+265
-128
include/mysql_com.h
include/mysql_com.h
+3
-3
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+1
-1
mysys/my_getopt.c
mysys/my_getopt.c
+14
-14
sql/filesort.cc
sql/filesort.cc
+8
-4
sql/ha_heap.cc
sql/ha_heap.cc
+2
-1
sql/item_sum.cc
sql/item_sum.cc
+4
-3
sql/mysql_priv.h
sql/mysql_priv.h
+16
-16
sql/mysqld.cc
sql/mysqld.cc
+122
-61
sql/net_serv.cc
sql/net_serv.cc
+2
-2
sql/records.cc
sql/records.cc
+4
-2
sql/sql_acl.cc
sql/sql_acl.cc
+1
-0
sql/sql_class.cc
sql/sql_class.cc
+7
-3
sql/sql_class.h
sql/sql_class.h
+21
-0
sql/sql_delete.cc
sql/sql_delete.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+8
-6
sql/sql_select.cc
sql/sql_select.cc
+11
-6
sql/sql_show.cc
sql/sql_show.cc
+20
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+16
-3
sql/structs.h
sql/structs.h
+2
-1
No files found.
include/mysql_com.h
View file @
039c6b1b
...
...
@@ -164,9 +164,6 @@ enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
extern
"C"
{
#endif
extern
unsigned
long
max_allowed_packet
;
extern
unsigned
long
net_buffer_length
;
int
my_net_init
(
NET
*
net
,
Vio
*
vio
);
void
net_end
(
NET
*
net
);
void
net_clear
(
NET
*
net
);
...
...
@@ -225,6 +222,9 @@ typedef struct st_udf_init
extern
"C"
{
#endif
extern
unsigned
long
max_allowed_packet
;
extern
unsigned
long
net_buffer_length
;
void
randominit
(
struct
rand_struct
*
,
unsigned
long
seed1
,
unsigned
long
seed2
);
double
rnd
(
struct
rand_struct
*
);
...
...
libmysqld/lib_sql.cc
View file @
039c6b1b
...
...
@@ -220,7 +220,7 @@ check_connections2(THD * thd)
if
(
thd
->
client_capabilities
&
CLIENT_CONNECT_WITH_DB
)
db
=
strend
(
passwd
)
+
1
;
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
thd
->
inactive_timeout
=
net_interactive_timeout
;
thd
->
inactive_timeout
=
thd
->
variables
.
net_interactive_timeout
;
if
(
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
thd
->
net
.
return_status
=
&
thd
->
server_status
;
net
->
timeout
=
net_read_timeout
;
...
...
mysys/my_getopt.c
View file @
039c6b1b
...
...
@@ -620,32 +620,32 @@ static void init_variables(const struct my_option *options)
{
switch
(
options
->
var_type
)
{
case
GET_BOOL
:
*
((
my_bool
*
)
options
->
u_max_value
)
=
*
((
my_bool
*
)
options
->
value
)
=
(
my_bool
)
options
->
def_value
;
*
((
my_bool
*
)
options
->
u_max_value
)
=
(
my_bool
)
options
->
max_value
;
*
((
my_bool
*
)
options
->
value
)
=
(
my_bool
)
options
->
def_value
;
break
;
case
GET_INT
:
*
((
int
*
)
options
->
u_max_value
)
=
*
((
int
*
)
options
->
value
)
=
(
int
)
options
->
def_value
;
*
((
int
*
)
options
->
u_max_value
)
=
(
int
)
options
->
max_value
;
*
((
int
*
)
options
->
value
)
=
(
int
)
options
->
def_value
;
break
;
case
GET_UINT
:
*
((
uint
*
)
options
->
u_max_value
)
=
*
((
uint
*
)
options
->
value
)
=
(
uint
)
options
->
def_value
;
*
((
uint
*
)
options
->
u_max_value
)
=
(
uint
)
options
->
max_value
;
*
((
uint
*
)
options
->
value
)
=
(
uint
)
options
->
def_value
;
break
;
case
GET_LONG
:
*
((
long
*
)
options
->
u_max_value
)
=
*
((
long
*
)
options
->
value
)
=
(
long
)
options
->
def_value
;
*
((
long
*
)
options
->
u_max_value
)
=
(
long
)
options
->
max_value
;
*
((
long
*
)
options
->
value
)
=
(
long
)
options
->
def_value
;
break
;
case
GET_ULONG
:
*
((
ulong
*
)
options
->
u_max_value
)
=
*
((
ulong
*
)
options
->
value
)
=
(
ulong
)
options
->
def_value
;
*
((
ulong
*
)
options
->
u_max_value
)
=
(
ulong
)
options
->
max_value
;
*
((
ulong
*
)
options
->
value
)
=
(
ulong
)
options
->
def_value
;
break
;
case
GET_LL
:
*
((
longlong
*
)
options
->
u_max_value
)
=
*
((
longlong
*
)
options
->
value
)
=
(
longlong
)
options
->
def_value
;
*
((
longlong
*
)
options
->
u_max_value
)
=
(
longlong
)
options
->
max_value
;
*
((
longlong
*
)
options
->
value
)
=
(
longlong
)
options
->
def_value
;
break
;
case
GET_ULL
:
*
((
ulonglong
*
)
options
->
u_max_value
)
=
*
((
ulonglong
*
)
options
->
value
)
=
(
ulonglong
)
options
->
def_value
;
*
((
ulonglong
*
)
options
->
u_max_value
)
=
(
ulonglong
)
options
->
max_value
;
*
((
ulonglong
*
)
options
->
value
)
=
(
ulonglong
)
options
->
def_value
;
break
;
default:
/* dummy default to avoid compiler warnings */
break
;
...
...
sql/filesort.cc
View file @
039c6b1b
...
...
@@ -75,6 +75,8 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
uchar
**
sort_keys
;
IO_CACHE
tempfile
,
buffpek_pointers
,
*
selected_records_file
,
*
outfile
;
SORTPARAM
param
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"filesort"
);
DBUG_EXECUTE
(
"info"
,
TEST_filesort
(
sortorder
,
s_length
,
special
););
#ifdef SKIP_DBUG_IN_FILESORT
...
...
@@ -134,7 +136,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
goto
err
;
#endif
memavl
=
sortbuff_size
;
memavl
=
thd
->
variables
.
sortbuff_size
;
while
(
memavl
>=
MIN_SORT_MEMORY
)
{
ulong
old_memavl
;
...
...
@@ -149,7 +151,8 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
}
if
(
memavl
<
MIN_SORT_MEMORY
)
{
my_error
(
ER_OUTOFMEMORY
,
MYF
(
ME_ERROR
+
ME_WAITTANG
),
sortbuff_size
);
my_error
(
ER_OUTOFMEMORY
,
MYF
(
ME_ERROR
+
ME_WAITTANG
),
thd
->
variables
.
sortbuff_size
);
goto
err
;
}
if
(
open_cached_file
(
&
buffpek_pointers
,
mysql_tmpdir
,
TEMP_PREFIX
,
...
...
@@ -909,6 +912,7 @@ static uint
sortlength
(
SORT_FIELD
*
sortorder
,
uint
s_length
)
{
reg2
uint
length
;
THD
*
thd
=
current_thd
;
length
=
0
;
for
(;
s_length
--
;
sortorder
++
)
...
...
@@ -916,7 +920,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if
(
sortorder
->
field
)
{
if
(
sortorder
->
field
->
type
()
==
FIELD_TYPE_BLOB
)
sortorder
->
length
=
max_item_sort_length
;
sortorder
->
length
=
thd
->
variables
.
max_item_sort_length
;
else
{
sortorder
->
length
=
sortorder
->
field
->
pack_length
();
...
...
@@ -952,7 +956,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
if
(
sortorder
->
item
->
maybe_null
)
length
++
;
// Place for NULL marker
}
set_if_smaller
(
sortorder
->
length
,
max_item_sort_length
);
set_if_smaller
(
sortorder
->
length
,
thd
->
variables
.
max_item_sort_length
);
length
+=
sortorder
->
length
;
}
sortorder
->
field
=
(
Field
*
)
0
;
// end marker
...
...
sql/ha_heap.cc
View file @
039c6b1b
...
...
@@ -37,6 +37,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
ulong
max_rows
;
HP_KEYDEF
*
keydef
;
HP_KEYSEG
*
seg
;
THD
*
thd
=
current_thd
;
for
(
key
=
parts
=
0
;
key
<
table
->
keys
;
key
++
)
parts
+=
table
->
key_info
[
key
].
key_parts
;
...
...
@@ -83,7 +84,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
}
}
mem_per_row
+=
MY_ALIGN
(
table
->
reclength
+
1
,
sizeof
(
char
*
));
max_rows
=
(
ulong
)
(
max_heap_table_size
/
mem_per_row
);
max_rows
=
(
ulong
)
(
thd
->
variables
.
max_heap_table_size
/
mem_per_row
);
file
=
heap_open
(
name
,
mode
,
table
->
keys
,
keydef
,
table
->
reclength
,
...
...
sql/item_sum.cc
View file @
039c6b1b
...
...
@@ -1040,7 +1040,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
}
}
init_tree
(
&
tree
,
min
(
max_heap_table_size
,
sortbuff_size
/
16
),
0
,
init_tree
(
&
tree
,
min
(
thd
->
variables
.
max_heap_table_size
,
thd
->
variables
.
sortbuff_size
/
16
),
0
,
key_length
,
compare_key
,
0
,
NULL
,
cmp_arg
);
use_tree
=
1
;
...
...
@@ -1050,8 +1051,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
but this has to be handled - otherwise someone can crash
the server with a DoS attack
*/
max_elements_in_tree
=
((
key_length
)
?
max_heap_table_size
/
key_length
:
1
);
max_elements_in_tree
=
((
key_length
)
?
thd
->
variables
.
max_heap_table_size
/
key_length
:
1
);
}
return
0
;
}
...
...
sql/mysql_priv.h
View file @
039c6b1b
...
...
@@ -468,7 +468,8 @@ int mysqld_show_create(THD *thd, TABLE_LIST *table_list);
void
mysqld_list_processes
(
THD
*
thd
,
const
char
*
user
,
bool
verbose
);
int
mysqld_show_status
(
THD
*
thd
);
int
mysqld_show_variables
(
THD
*
thd
,
const
char
*
wild
);
int
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
);
int
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
struct
system_variables
*
variable_values
);
/* sql_handler.cc */
int
mysql_ha_open
(
THD
*
thd
,
TABLE_LIST
*
tables
);
...
...
@@ -550,8 +551,6 @@ int write_record(TABLE *table,COPY_INFO *info);
extern
ulong
volatile
manager_status
;
extern
bool
volatile
manager_thread_in_use
,
mqh_used
;
extern
pthread_t
manager_thread
;
extern
pthread_mutex_t
LOCK_manager
;
extern
pthread_cond_t
COND_manager
;
pthread_handler_decl
(
handle_manager
,
arg
);
/* sql_test.cc */
...
...
@@ -611,12 +610,13 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_thread_count
,
LOCK_mapped_file
,
LOCK_user_locks
,
LOCK_status
,
LOCK_grant
,
LOCK_error_log
,
LOCK_delayed_insert
,
LOCK_delayed_status
,
LOCK_delayed_create
,
LOCK_crypt
,
LOCK_timezone
,
LOCK_server_id
,
LOCK_slave_list
,
LOCK_active_mi
;
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
;
LOCK_server_id
,
LOCK_slave_list
,
LOCK_active_mi
,
LOCK_manager
,
LOCK_global_system_variables
;
extern
pthread_cond_t
COND_refresh
,
COND_thread_count
,
COND_manager
;
extern
pthread_attr_t
connection_attrib
;
extern
bool
opt_endinfo
,
using_udf_functions
,
locked_in_memory
,
opt_using_transactions
,
use_temp_pool
,
mysql_embedded
;
extern
my_bool
opt_local_infile
;
extern
char
f_fyllchar
;
extern
ulong
ha_read_count
,
ha_write_count
,
ha_delete_count
,
ha_update_count
,
ha_read_key_count
,
ha_read_next_count
,
ha_read_prev_count
,
...
...
@@ -628,27 +628,27 @@ extern uchar *days_in_month;
extern
DATE_FORMAT
dayord
;
extern
double
log_10
[
32
];
extern
uint
protocol_version
,
dropping_tables
;
extern
ulong
keybuff_size
,
sortbuff_size
,
max_item_sort_length
,
table_cache_size
,
max_join_size
,
join_buff_size
,
tmp_table_size
,
max_connections
,
max_connect_errors
,
long_query_time
,
extern
ulong
keybuff_size
,
table_cache_size
,
max_connections
,
max_connect_errors
,
max_insert_delayed_threads
,
max_user_connections
,
long_query_count
,
net_wait_timeout
,
net_interactive_timeout
,
net_read_timeout
,
net_write_timeout
,
long_query_count
,
net_read_timeout
,
net_write_timeout
,
what_to_log
,
flush_time
,
opt_sql_mode
,
max_tmp_tables
,
max_heap_table_size
,
query_buff_size
,
lower_case_table_names
,
thread_stack
,
thread_stack_min
,
binlog_cache_size
,
max_binlog_cache_size
,
record_rnd_cache_size
;
query_buff_size
,
lower_case_table_names
,
thread_stack
,
thread_stack_min
,
binlog_cache_size
,
max_binlog_cache_size
;
extern
ulong
com_stat
[(
uint
)
SQLCOM_END
],
com_other
;
extern
ulong
specialflag
,
current_pid
;
extern
bool
low_priority_updates
,
using_update_log
;
extern
bool
opt_sql_bin_update
,
opt_safe_show_db
,
opt_warnings
,
opt_safe_user_create
,
opt_no_mix_types
;
extern
bool
opt_sql_bin_update
,
opt_safe_show_db
,
opt_safe_user_create
,
opt_no_mix_types
;
extern
char
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
blob_newline
;
extern
const
char
**
errmesg
;
/* Error messages */
extern
const
char
*
default_tx_isolation_name
;
extern
String
empty_string
;
extern
struct
show_var_st
init_vars
[];
extern
struct
show_var_st
status_vars
[];
extern
struct
system_variables
global_system_variables
;
extern
enum
db_type
default_table_type
;
extern
enum
enum_tx_isolation
default_tx_isolation
;
extern
char
glob_hostname
[
FN_REFLEN
];
...
...
sql/mysqld.cc
View file @
039c6b1b
This diff is collapsed.
Click to expand it.
sql/net_serv.cc
View file @
039c6b1b
...
...
@@ -86,7 +86,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#define TEST_BLOCKING 8
#define MAX_THREE_BYTES 255L*255L*255L
ulong
net_buffer_length
=
8192
;
/* Default length. Enlarged if necessary */
ulong
net_buffer_length
=
8192
;
/* Default length. Enlarged if necessary */
static
int
net_write_buff
(
NET
*
net
,
const
char
*
packet
,
ulong
len
);
...
...
@@ -105,7 +105,7 @@ int my_net_init(NET *net, Vio* vio)
net
->
vio
=
vio
;
net
->
no_send_ok
=
0
;
net
->
error
=
0
;
net
->
return_errno
=
0
;
net
->
return_status
=
0
;
net
->
timeout
=
(
uint
)
net_read_timeout
;
/* Timeout for read */
net
->
timeout
=
(
uint
)
net_read_timeout
;
/* Timeout for read */
net
->
pkt_nr
=
net
->
compress_pkt_nr
=
0
;
net
->
write_pos
=
net
->
read_pos
=
net
->
buff
;
net
->
last_error
[
0
]
=
0
;
...
...
sql/records.cc
View file @
039c6b1b
...
...
@@ -61,7 +61,7 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
table
->
file
->
rnd_init
(
0
);
if
(
!
(
specialflag
&
SPECIAL_SAFE_MODE
)
&&
record_rnd_cache_size
&&
thd
->
variables
.
record_rnd_cache_size
&&
!
table
->
file
->
fast_key_read
()
&&
(
table
->
db_stat
&
HA_READ_ONLY
||
table
->
reginfo
.
lock_type
<=
TL_READ_NO_INSERT
)
&&
...
...
@@ -229,6 +229,8 @@ static int rr_from_pointers(READ_RECORD *info)
static
int
init_rr_cache
(
READ_RECORD
*
info
)
{
uint
rec_cache_size
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"init_rr_cache"
);
info
->
struct_length
=
3
+
MAX_REFLENGTH
;
...
...
@@ -237,7 +239,7 @@ static int init_rr_cache(READ_RECORD *info)
info
->
reclength
=
ALIGN_SIZE
(
info
->
struct_length
);
info
->
error_offset
=
info
->
table
->
reclength
;
info
->
cache_records
=
record_rnd_cache_size
/
info
->
cache_records
=
thd
->
variables
.
record_rnd_cache_size
/
(
info
->
reclength
+
info
->
struct_length
);
rec_cache_size
=
info
->
cache_records
*
info
->
reclength
;
info
->
rec_cache_size
=
info
->
cache_records
*
info
->
ref_length
;
...
...
sql/sql_acl.cc
View file @
039c6b1b
...
...
@@ -779,6 +779,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip,
db_access
=
0
;
host_access
=
~
0
;
char
key
[
ACL_KEY_LENGTH
],
*
tmp_db
,
*
end
;
acl_entry
*
entry
;
THD
*
thd
=
current_thd
;
VOID
(
pthread_mutex_lock
(
&
acl_cache
->
lock
));
memcpy_fixed
(
&
key
,
bin_ip
,
sizeof
(
struct
in_addr
));
...
...
sql/sql_class.cc
View file @
039c6b1b
...
...
@@ -87,6 +87,9 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
host_or_ip
=
"unknown ip"
;
locked
=
killed
=
count_cuted_fields
=
some_tables_deleted
=
no_errors
=
password
=
query_start_used
=
safe_to_cache_query
=
0
;
pthread_mutex_lock
(
&
LOCK_global_system_variables
);
variables
=
global_system_variables
;
pthread_mutex_unlock
(
&
LOCK_global_system_variables
);
db_length
=
query_length
=
col_access
=
0
;
query_error
=
0
;
next_insert_id
=
last_insert_id
=
0
;
...
...
@@ -134,14 +137,15 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
query_cache_type
=
0
;
//Safety
#endif
sql_mode
=
(
uint
)
opt_sql_mode
;
inactive_timeout
=
net_wait_timeout
;
inactive_timeout
=
variables
.
net_wait_timeout
;
open_options
=
ha_open_options
;
tx_isolation
=
session_tx_isolation
=
default_tx_isolation
;
command
=
COM_CONNECT
;
set_query_id
=
1
;
default_select_limit
=
HA_POS_ERROR
;
max_join_size
=
((
::
max_join_size
!=
~
(
ulong
)
0L
)
?
::
max_join_size
:
HA_POS_ERROR
);
max_join_size
=
((
variables
.
max_join_size
!=
~
(
ulong
)
0L
)
?
variables
.
max_join_size
:
HA_POS_ERROR
);
db_access
=
NO_ACCESS
;
/* Initialize sub structures */
...
...
sql/sql_class.h
View file @
039c6b1b
...
...
@@ -280,6 +280,26 @@ class delayed_insert;
#define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC)
struct
system_variables
{
my_bool
opt_local_infile
;
my_bool
opt_warnings
;
ulong
join_buff_size
;
ulong
long_query_time
;
ulong
max_heap_table_size
;
ulong
max_item_sort_length
;
ulong
max_join_size
;
ulong
max_tmp_tables
;
ulong
myisam_max_extra_sort_file_size
;
ulong
myisam_max_sort_file_size
;
ulong
net_interactive_timeout
;
ulong
net_wait_timeout
;
ulong
record_rnd_cache_size
;
ulong
sortbuff_size
;
ulong
tmp_table_size
;
};
/* system variables */
/* For each client connection we create a separate thread with THD serving as
a thread/connection descriptor */
...
...
@@ -292,6 +312,7 @@ class THD :public ilink {
String
packet
;
// dynamic string buffer used for network I/O
struct
sockaddr_in
remote
;
// client socket address
struct
rand_struct
rand
;
// used for authentication
struct
system_variables
variables
;
/* query points to the current query,
thread_stack is a pointer to the stack frame of handle_one_connection(),
...
...
sql/sql_delete.cc
View file @
039c6b1b
...
...
@@ -201,7 +201,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
Delete multiple tables from join
***************************************************************************/
#define MEM_STRIP_BUF_SIZE sortbuff_size
#define MEM_STRIP_BUF_SIZE
current_thd->variables.
sortbuff_size
int
refposcmp2
(
void
*
arg
,
const
void
*
a
,
const
void
*
b
)
{
...
...
sql/sql_lex.cc
View file @
039c6b1b
...
...
@@ -151,6 +151,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
ignore_space
=
test
(
thd
->
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
slave_thd_opt
=
0
;
lex
->
sql_command
=
SQLCOM_END
;
bzero
(
&
lex
->
mi
,
sizeof
(
lex
->
mi
));
return
lex
;
}
...
...
sql/sql_lex.h
View file @
039c6b1b
...
...
@@ -162,6 +162,7 @@ typedef struct st_lex
LEX_USER
*
grant_user
;
gptr
yacc_yyss
,
yacc_yyvs
;
THD
*
thd
;
struct
system_variables
*
variable_values
;
udf_func
udf
;
HA_CHECK_OPT
check_opt
;
// check/repair options
HA_CREATE_INFO
create_info
;
...
...
sql/sql_parse.cc
View file @
039c6b1b
...
...
@@ -559,7 +559,7 @@ check_connections(THD *thd)
if
(
thd
->
client_capabilities
&
CLIENT_CONNECT_WITH_DB
)
db
=
strend
(
passwd
)
+
1
;
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
thd
->
inactive_timeout
=
net_interactive_timeout
;
thd
->
inactive_timeout
=
thd
->
variables
.
net_interactive_timeout
;
if
((
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
&&
opt_using_transactions
)
thd
->
net
.
return_status
=
&
thd
->
server_status
;
...
...
@@ -661,7 +661,7 @@ pthread_handler_decl(handle_one_connection,arg)
free_root
(
&
thd
->
mem_root
,
MYF
(
0
));
if
(
net
->
error
&&
net
->
vio
!=
0
)
{
if
(
!
thd
->
killed
&&
opt_warnings
)
if
(
!
thd
->
killed
&&
thd
->
variables
.
opt_warnings
)
sql_print_error
(
ER
(
ER_NEW_ABORTING_CONNECTION
),
thd
->
thread_id
,(
thd
->
db
?
thd
->
db
:
"unconnected"
),
thd
->
user
?
thd
->
user
:
"unauthenticated"
,
...
...
@@ -1192,7 +1192,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
thd
->
proc_info
=
"logging slow query"
;
if
((
ulong
)
(
thd
->
start_time
-
thd
->
time_after_lock
)
>
long_query_time
||
if
((
ulong
)
(
thd
->
start_time
-
thd
->
time_after_lock
)
>
thd
->
variables
.
long_query_time
||
((
thd
->
lex
.
select_lex
.
options
&
(
QUERY_NO_INDEX_USED
|
QUERY_NO_GOOD_INDEX_USED
))
&&
(
specialflag
&
SPECIAL_LONG_LOG_FORMAT
)))
...
...
@@ -2036,11 +2037,12 @@ mysql_execute_command(void)
thd
->
priv_user
,
lex
->
verbose
);
break
;
case
SQLCOM_SHOW_STATUS
:
res
=
mysqld_show
(
thd
,(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
),
status_vars
);
res
=
mysqld_show
(
thd
,(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
),
status_vars
,
(
struct
system_variables
*
)
0
);
break
;
case
SQLCOM_SHOW_VARIABLES
:
res
=
mysqld_show
(
thd
,
(
lex
->
wild
?
lex
->
wild
->
ptr
()
:
NullS
),
init_vars
);
init_vars
,
lex
->
variable_values
);
break
;
case
SQLCOM_SHOW_LOGS
:
{
...
...
@@ -2147,7 +2149,7 @@ mysql_execute_command(void)
else
{
if
(
!
(
thd
->
client_capabilities
&
CLIENT_LOCAL_FILES
)
||
!
opt_local_infile
)
!
thd
->
variables
.
opt_local_infile
)
{
send_error
(
&
thd
->
net
,
ER_NOT_ALLOWED_COMMAND
);
goto
error
;
...
...
sql/sql_select.cc
View file @
039c6b1b
...
...
@@ -1717,6 +1717,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
{
ulong
rec
;
double
tmp
;
THD
*
thd
=
current_thd
;
if
(
!
rest_tables
)
{
...
...
@@ -1983,7 +1984,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
tmp
=
(
double
)
s
->
read_time
;
/* Calculate time to read through cache */
tmp
*=
(
1.0
+
floor
((
double
)
cache_record_length
(
join
,
idx
)
*
record_count
/
(
double
)
join_buff_size
));
record_count
/
(
double
)
thd
->
variables
.
join_buff_size
));
}
if
(
best
==
DBL_MAX
||
(
tmp
+
record_count
/
(
double
)
TIME_FOR_COMPARE
*
s
->
found_records
<
...
...
@@ -3774,12 +3776,13 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param
->
recinfo
=
recinfo
;
store_record
(
table
,
2
);
// Make empty default record
if
(
tmp_table_size
==
~
(
ulong
)
0
)
// No limit
if
(
t
hd
->
variables
.
t
mp_table_size
==
~
(
ulong
)
0
)
// No limit
table
->
max_rows
=
~
(
ha_rows
)
0
;
else
table
->
max_rows
=
(((
table
->
db_type
==
DB_TYPE_HEAP
)
?
min
(
tmp_table_size
,
max_heap_table_size
)
:
tmp_table_size
)
/
table
->
reclength
);
min
(
thd
->
variables
.
tmp_table_size
,
thd
->
variables
.
max_heap_table_size
)
:
thd
->
variables
.
tmp_table_size
)
/
table
->
reclength
);
set_if_bigger
(
table
->
max_rows
,
1
);
// For dummy start options
keyinfo
=
param
->
keyinfo
;
...
...
@@ -5760,6 +5763,8 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
int
error
;
ulong
reclength
,
offset
;
uint
field_count
;
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"remove_duplicates"
);
entry
->
reginfo
.
lock_type
=
TL_WRITE
;
...
...
@@ -5788,7 +5793,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
if
(
entry
->
db_type
==
DB_TYPE_HEAP
||
(
!
entry
->
blob_fields
&&
((
ALIGN_SIZE
(
reclength
)
+
sizeof
(
HASH_LINK
))
*
entry
->
file
->
records
<
sortbuff_size
)))
thd
->
variables
.
sortbuff_size
)))
error
=
remove_dup_with_hash_index
(
join
->
thd
,
entry
,
field_count
,
first_field
,
reclength
,
having
);
...
...
@@ -6109,7 +6114,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
cache
->
length
=
length
+
blobs
*
sizeof
(
char
*
);
cache
->
blobs
=
blobs
;
*
blob_ptr
=
0
;
/* End sequentel */
size
=
max
(
join_buff_size
,
cache
->
length
);
size
=
max
(
thd
->
variables
.
join_buff_size
,
cache
->
length
);
if
(
!
(
cache
->
buff
=
(
uchar
*
)
my_malloc
(
size
,
MYF
(
0
))))
DBUG_RETURN
(
1
);
/* Don't use cache */
/* purecov: inspected */
cache
->
end
=
cache
->
buff
+
size
;
...
...
sql/sql_show.cc
View file @
039c6b1b
...
...
@@ -1142,13 +1142,16 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
*****************************************************************************/
int
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
)
int
mysqld_show
(
THD
*
thd
,
const
char
*
wild
,
show_var_st
*
variables
,
struct
system_variables
*
values
)
{
uint
i
;
char
buff
[
8192
];
String
packet2
(
buff
,
sizeof
(
buff
));
List
<
Item
>
field_list
;
CONVERT
*
convert
=
thd
->
convert_set
;
ulong
offset
;
DBUG_ENTER
(
"mysqld_show"
);
field_list
.
push_back
(
new
Item_empty_string
(
"Variable_name"
,
30
));
field_list
.
push_back
(
new
Item_empty_string
(
"Value"
,
256
));
...
...
@@ -1168,6 +1171,11 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
case
SHOW_LONG_CONST
:
net_store_data
(
&
packet2
,(
uint32
)
*
(
ulong
*
)
variables
[
i
].
value
);
break
;
case
SHOW_LONG_OFFSET
:
offset
=
(
ulong
)
variables
[
i
].
value
;
net_store_data
(
&
packet2
,
(
uint32
)
*
(
ulong
*
)
(((
char
*
)
values
)
+
offset
));
break
;
case
SHOW_BOOL
:
net_store_data
(
&
packet2
,(
ulong
)
*
(
bool
*
)
variables
[
i
].
value
?
"ON"
:
"OFF"
);
...
...
@@ -1176,10 +1184,21 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables)
net_store_data
(
&
packet2
,(
ulong
)
*
(
my_bool
*
)
variables
[
i
].
value
?
"ON"
:
"OFF"
);
break
;
case
SHOW_MY_BOOL_OFFSET
:
offset
=
(
ulong
)
variables
[
i
].
value
;
net_store_data
(
&
packet2
,
((
ulong
)
*
(
my_bool
*
)
(((
char
*
)
values
)
+
offset
))
?
"ON"
:
"OFF"
);
break
;
case
SHOW_INT_CONST
:
case
SHOW_INT
:
net_store_data
(
&
packet2
,(
uint32
)
*
(
int
*
)
variables
[
i
].
value
);
break
;
case
SHOW_INT_OFFSET
:
offset
=
(
ulong
)
variables
[
i
].
value
;
net_store_data
(
&
packet2
,
(
uint32
)
*
(
int
*
)
(((
char
*
)
values
)
+
offset
));
break
;
case
SHOW_HAVE
:
{
SHOW_COMP_OPTION
tmp
=
*
(
SHOW_COMP_OPTION
*
)
variables
[
i
].
value
;
...
...
sql/sql_yacc.yy
View file @
039c6b1b
...
...
@@ -519,7 +519,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <num>
type int_type real_type order_dir opt_field_spec set_option lock_option
udf_type if_exists opt_local opt_table_options table_options
table_option opt_if_not_exists
table_option opt_if_not_exists
opt_var_type
%type <ulong_num>
ULONG_NUM raid_types merge_insert_types
...
...
@@ -2621,8 +2621,15 @@ show_param:
{ Lex->sql_command= SQLCOM_SHOW_STATUS; }
| opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
| VARIABLES wild
{ Lex->sql_command= SQLCOM_SHOW_VARIABLES; }
| opt_var_type VARIABLES wild
{
THD *thd= current_thd;
thd->lex.sql_command= SQLCOM_SHOW_VARIABLES;
if ($1)
thd->lex.variable_values= &thd->variables;
else
thd->lex.variable_values= &global_system_variables;
}
| LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; }
| GRANTS FOR_SYM user
...
...
@@ -2659,6 +2666,12 @@ opt_full:
/* empty */ { Lex->verbose=0; }
| FULL { Lex->verbose=1; };
opt_var_type:
/* empty */ { $$=1; /* local variable */ }
| LOCAL_SYM { $$=1; }
| GLOBAL_SYM { $$=0; }
;
from_or_in:
FROM
| IN_SYM;
...
...
sql/structs.h
View file @
039c6b1b
...
...
@@ -126,7 +126,8 @@ typedef struct {
enum
SHOW_TYPE
{
SHOW_LONG
,
SHOW_CHAR
,
SHOW_INT
,
SHOW_CHAR_PTR
,
SHOW_BOOL
,
SHOW_MY_BOOL
,
SHOW_OPENTABLES
,
SHOW_STARTTIME
,
SHOW_QUESTION
,
SHOW_LONG_CONST
,
SHOW_INT_CONST
,
SHOW_HAVE
SHOW_LONG_CONST
,
SHOW_INT_CONST
,
SHOW_HAVE
,
SHOW_LONG_OFFSET
,
SHOW_INT_OFFSET
,
SHOW_MY_BOOL_OFFSET
#ifdef HAVE_OPENSSL
,
SHOW_SSL_CTX_SESS_ACCEPT
,
SHOW_SSL_CTX_SESS_ACCEPT_GOOD
,
SHOW_SSL_GET_VERSION
,
SHOW_SSL_CTX_GET_SESSION_CACHE_MODE
...
...
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