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
b81d8b2e
Commit
b81d8b2e
authored
Nov 22, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for signed sysvars.
Make max_user_connections signed, with min allowed value being -1.
parent
d2755a2c
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
131 additions
and
75 deletions
+131
-75
include/mysql/plugin.h
include/mysql/plugin.h
+8
-2
include/mysql/plugin_audit.h.pp
include/mysql/plugin_audit.h.pp
+3
-2
include/mysql/plugin_auth.h.pp
include/mysql/plugin_auth.h.pp
+3
-2
include/mysql/plugin_ftparser.h.pp
include/mysql/plugin_ftparser.h.pp
+3
-2
mysql-test/suite/sys_vars/r/max_user_connections_basic.result
...l-test/suite/sys_vars/r/max_user_connections_basic.result
+2
-4
mysql-test/t/user_limits.test
mysql-test/t/user_limits.test
+0
-1
sql/item_func.cc
sql/item_func.cc
+37
-25
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/set_var.h
sql/set_var.h
+2
-1
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_connect.cc
sql/sql_connect.cc
+1
-1
sql/sql_show.cc
sql/sql_show.cc
+12
-3
sql/sys_vars.cc
sql/sys_vars.cc
+1
-1
sql/sys_vars.h
sql/sys_vars.h
+57
-29
No files found.
include/mysql/plugin.h
View file @
b81d8b2e
...
@@ -159,12 +159,18 @@ MARIA_DECLARE_PLUGIN__(NAME, \
...
@@ -159,12 +159,18 @@ MARIA_DECLARE_PLUGIN__(NAME, \
*/
*/
enum
enum_mysql_show_type
enum
enum_mysql_show_type
{
{
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
INT
,
SHOW_
LONG
,
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
UINT
,
SHOW_U
LONG
,
SHOW_LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_
U
LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_SINT
,
SHOW_SLONG
,
SHOW_SLONGLONG
,
SHOW_always_last
SHOW_always_last
};
};
/* backward compatibility mapping. */
#define SHOW_INT SHOW_UINT
#define SHOW_LONG SHOW_ULONG
#define SHOW_LONGLONG SHOW_ULONGLONG
struct
st_mysql_show_var
{
struct
st_mysql_show_var
{
const
char
*
name
;
const
char
*
name
;
char
*
value
;
char
*
value
;
...
...
include/mysql/plugin_audit.h.pp
View file @
b81d8b2e
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
typedef
struct
st_mysql_xid
MYSQL_XID
;
typedef
struct
st_mysql_xid
MYSQL_XID
;
enum
enum_mysql_show_type
enum
enum_mysql_show_type
{
{
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
INT
,
SHOW_
LONG
,
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
UINT
,
SHOW_U
LONG
,
SHOW_LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_
U
LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_SINT
,
SHOW_SLONG
,
SHOW_SLONGLONG
,
SHOW_always_last
SHOW_always_last
};
};
struct
st_mysql_show_var
{
struct
st_mysql_show_var
{
...
...
include/mysql/plugin_auth.h.pp
View file @
b81d8b2e
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
typedef
struct
st_mysql_xid
MYSQL_XID
;
typedef
struct
st_mysql_xid
MYSQL_XID
;
enum
enum_mysql_show_type
enum
enum_mysql_show_type
{
{
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
INT
,
SHOW_
LONG
,
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
UINT
,
SHOW_U
LONG
,
SHOW_LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_
U
LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_SINT
,
SHOW_SLONG
,
SHOW_SLONGLONG
,
SHOW_always_last
SHOW_always_last
};
};
struct
st_mysql_show_var
{
struct
st_mysql_show_var
{
...
...
include/mysql/plugin_ftparser.h.pp
View file @
b81d8b2e
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
...
@@ -89,9 +89,10 @@ struct st_mysql_xid {
typedef
struct
st_mysql_xid
MYSQL_XID
;
typedef
struct
st_mysql_xid
MYSQL_XID
;
enum
enum_mysql_show_type
enum
enum_mysql_show_type
{
{
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
INT
,
SHOW_
LONG
,
SHOW_UNDEF
,
SHOW_BOOL
,
SHOW_
UINT
,
SHOW_U
LONG
,
SHOW_LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_
U
LONGLONG
,
SHOW_CHAR
,
SHOW_CHAR_PTR
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_ARRAY
,
SHOW_FUNC
,
SHOW_DOUBLE
,
SHOW_SINT
,
SHOW_SLONG
,
SHOW_SLONGLONG
,
SHOW_always_last
SHOW_always_last
};
};
struct
st_mysql_show_var
{
struct
st_mysql_show_var
{
...
...
mysql-test/suite/sys_vars/r/max_user_connections_basic.result
View file @
b81d8b2e
...
@@ -51,7 +51,7 @@ Warnings:
...
@@ -51,7 +51,7 @@ Warnings:
Warning 1292 Truncated incorrect max_user_connections value: '-1024'
Warning 1292 Truncated incorrect max_user_connections value: '-1024'
SELECT @@global.max_user_connections;
SELECT @@global.max_user_connections;
@@global.max_user_connections
@@global.max_user_connections
0
-1
SET @@global.max_user_connections = 4294967296;
SET @@global.max_user_connections = 4294967296;
Warnings:
Warnings:
Warning 1292 Truncated incorrect max_user_connections value: '4294967296'
Warning 1292 Truncated incorrect max_user_connections value: '4294967296'
...
@@ -59,11 +59,9 @@ SELECT @@global.max_user_connections;
...
@@ -59,11 +59,9 @@ SELECT @@global.max_user_connections;
@@global.max_user_connections
@@global.max_user_connections
2147483647
2147483647
SET @@global.max_user_connections = -1;
SET @@global.max_user_connections = -1;
Warnings:
Warning 1292 Truncated incorrect max_user_connections value: '-1'
SELECT @@global.max_user_connections;
SELECT @@global.max_user_connections;
@@global.max_user_connections
@@global.max_user_connections
0
-1
SET @@global.max_user_connections = 429496729500;
SET @@global.max_user_connections = 429496729500;
Warnings:
Warnings:
Warning 1292 Truncated incorrect max_user_connections value: '429496729500'
Warning 1292 Truncated incorrect max_user_connections value: '429496729500'
...
...
mysql-test/t/user_limits.test
View file @
b81d8b2e
skip
enable
when
max_user_connections
can
be
negative
#
#
# Test behavior of various per-account limits (aka quotas)
# Test behavior of various per-account limits (aka quotas)
#
#
...
...
sql/item_func.cc
View file @
b81d8b2e
...
@@ -5491,16 +5491,15 @@ void Item_func_get_system_var::fix_length_and_dec()
...
@@ -5491,16 +5491,15 @@ void Item_func_get_system_var::fix_length_and_dec()
switch
(
var
->
show_type
())
switch
(
var
->
show_type
())
{
{
case
SHOW_LONG
:
case
SHOW_INT
:
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
unsigned_flag
=
TRUE
;
//var->show_type() != SHOW_INT;
case
SHOW_UINT
:
collation
.
set_numeric
();
case
SHOW_ULONG
:
fix_char_length
(
MY_INT64_NUM_DECIMAL_DIGITS
);
case
SHOW_ULONGLONG
:
decimals
=
0
;
break
;
case
SHOW_LONGLONG
:
unsigned_flag
=
TRUE
;
unsigned_flag
=
TRUE
;
/* fall through */
case
SHOW_SINT
:
case
SHOW_SLONG
:
case
SHOW_SLONGLONG
:
collation
.
set_numeric
();
collation
.
set_numeric
();
fix_char_length
(
MY_INT64_NUM_DECIMAL_DIGITS
);
fix_char_length
(
MY_INT64_NUM_DECIMAL_DIGITS
);
decimals
=
0
;
decimals
=
0
;
...
@@ -5535,13 +5534,11 @@ void Item_func_get_system_var::fix_length_and_dec()
...
@@ -5535,13 +5534,11 @@ void Item_func_get_system_var::fix_length_and_dec()
break
;
break
;
case
SHOW_BOOL
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
unsigned_flag
=
FALSE
;
collation
.
set_numeric
();
collation
.
set_numeric
();
fix_char_length
(
1
);
fix_char_length
(
1
);
decimals
=
0
;
decimals
=
0
;
break
;
break
;
case
SHOW_DOUBLE
:
case
SHOW_DOUBLE
:
unsigned_flag
=
FALSE
;
decimals
=
6
;
decimals
=
6
;
collation
.
set_numeric
();
collation
.
set_numeric
();
fix_char_length
(
DBL_DIG
+
6
);
fix_char_length
(
DBL_DIG
+
6
);
...
@@ -5565,9 +5562,12 @@ enum Item_result Item_func_get_system_var::result_type() const
...
@@ -5565,9 +5562,12 @@ enum Item_result Item_func_get_system_var::result_type() const
{
{
case
SHOW_BOOL
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_INT
:
case
SHOW_SINT
:
case
SHOW_LONG
:
case
SHOW_SLONG
:
case
SHOW_LONGLONG
:
case
SHOW_SLONGLONG
:
case
SHOW_UINT
:
case
SHOW_ULONG
:
case
SHOW_ULONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
return
INT_RESULT
;
return
INT_RESULT
;
case
SHOW_CHAR
:
case
SHOW_CHAR
:
...
@@ -5589,9 +5589,12 @@ enum_field_types Item_func_get_system_var::field_type() const
...
@@ -5589,9 +5589,12 @@ enum_field_types Item_func_get_system_var::field_type() const
{
{
case
SHOW_BOOL
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_INT
:
case
SHOW_SINT
:
case
SHOW_LONG
:
case
SHOW_SLONG
:
case
SHOW_LONGLONG
:
case
SHOW_SLONGLONG
:
case
SHOW_UINT
:
case
SHOW_ULONG
:
case
SHOW_ULONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
return
MYSQL_TYPE_LONGLONG
;
return
MYSQL_TYPE_LONGLONG
;
case
SHOW_CHAR
:
case
SHOW_CHAR
:
...
@@ -5660,9 +5663,12 @@ longlong Item_func_get_system_var::val_int()
...
@@ -5660,9 +5663,12 @@ longlong Item_func_get_system_var::val_int()
switch
(
var
->
show_type
())
switch
(
var
->
show_type
())
{
{
case
SHOW_INT
:
get_sys_var_safe
(
uint
);
case
SHOW_SINT
:
get_sys_var_safe
(
int
);
case
SHOW_LONG
:
get_sys_var_safe
(
ulong
);
case
SHOW_SLONG
:
get_sys_var_safe
(
long
);
case
SHOW_LONGLONG
:
get_sys_var_safe
(
ulonglong
);
case
SHOW_SLONGLONG
:
get_sys_var_safe
(
longlong
);
case
SHOW_UINT
:
get_sys_var_safe
(
uint
);
case
SHOW_ULONG
:
get_sys_var_safe
(
ulong
);
case
SHOW_ULONGLONG
:
get_sys_var_safe
(
ulonglong
);
case
SHOW_HA_ROWS
:
get_sys_var_safe
(
ha_rows
);
case
SHOW_HA_ROWS
:
get_sys_var_safe
(
ha_rows
);
case
SHOW_BOOL
:
get_sys_var_safe
(
bool
);
case
SHOW_BOOL
:
get_sys_var_safe
(
bool
);
case
SHOW_MY_BOOL
:
get_sys_var_safe
(
my_bool
);
case
SHOW_MY_BOOL
:
get_sys_var_safe
(
my_bool
);
...
@@ -5763,9 +5769,12 @@ String* Item_func_get_system_var::val_str(String* str)
...
@@ -5763,9 +5769,12 @@ String* Item_func_get_system_var::val_str(String* str)
break
;
break
;
}
}
case
SHOW_INT
:
case
SHOW_SINT
:
case
SHOW_LONG
:
case
SHOW_SLONG
:
case
SHOW_LONGLONG
:
case
SHOW_SLONGLONG
:
case
SHOW_UINT
:
case
SHOW_ULONG
:
case
SHOW_ULONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
case
SHOW_BOOL
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
...
@@ -5855,9 +5864,12 @@ double Item_func_get_system_var::val_real()
...
@@ -5855,9 +5864,12 @@ double Item_func_get_system_var::val_real()
cache_present
|=
GET_SYS_VAR_CACHE_DOUBLE
;
cache_present
|=
GET_SYS_VAR_CACHE_DOUBLE
;
return
cached_dval
;
return
cached_dval
;
}
}
case
SHOW_INT
:
case
SHOW_SINT
:
case
SHOW_LONG
:
case
SHOW_SLONG
:
case
SHOW_LONGLONG
:
case
SHOW_SLONGLONG
:
case
SHOW_UINT
:
case
SHOW_ULONG
:
case
SHOW_ULONGLONG
:
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
case
SHOW_BOOL
:
case
SHOW_BOOL
:
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
...
...
sql/set_var.cc
View file @
b81d8b2e
...
@@ -308,7 +308,7 @@ void sys_var::do_deprecated_warning(THD *thd)
...
@@ -308,7 +308,7 @@ void sys_var::do_deprecated_warning(THD *thd)
bool
throw_bounds_warning
(
THD
*
thd
,
const
char
*
name
,
bool
throw_bounds_warning
(
THD
*
thd
,
const
char
*
name
,
bool
fixed
,
bool
is_unsigned
,
longlong
v
)
bool
fixed
,
bool
is_unsigned
,
longlong
v
)
{
{
if
(
fixed
||
(
!
is_unsigned
&&
v
<
0
)
)
if
(
fixed
)
{
{
char
buf
[
22
];
char
buf
[
22
];
...
...
sql/set_var.h
View file @
b81d8b2e
...
@@ -201,7 +201,8 @@ public:
...
@@ -201,7 +201,8 @@ public:
enum_var_type
type
;
enum_var_type
type
;
union
///< temp storage to hold a value between sys_var::check and ::update
union
///< temp storage to hold a value between sys_var::check and ::update
{
{
ulonglong
ulonglong_value
;
///< for all integer, set, enum sysvars
ulonglong
ulonglong_value
;
///< for unsigned integer, set, enum sysvars
longlong
longlong_value
;
///< for signed integer
double
double_value
;
///< for Sys_var_double
double
double_value
;
///< for Sys_var_double
plugin_ref
plugin
;
///< for Sys_var_plugin
plugin_ref
plugin
;
///< for Sys_var_plugin
Time_zone
*
time_zone
;
///< for Sys_var_tz
Time_zone
*
time_zone
;
///< for Sys_var_tz
...
...
sql/sql_class.h
View file @
b81d8b2e
...
@@ -520,7 +520,7 @@ typedef struct system_variables
...
@@ -520,7 +520,7 @@ typedef struct system_variables
ulong
query_cache_type
;
ulong
query_cache_type
;
ulong
tx_isolation
;
ulong
tx_isolation
;
ulong
updatable_views_with_limit
;
ulong
updatable_views_with_limit
;
u
int
max_user_connections
;
int
max_user_connections
;
/**
/**
In slave thread we need to know in behalf of which
In slave thread we need to know in behalf of which
thread the query is being run to replicate temp tables properly
thread the query is being run to replicate temp tables properly
...
...
sql/sql_connect.cc
View file @
b81d8b2e
...
@@ -130,7 +130,7 @@ int check_for_max_user_connections(THD *thd, USER_CONN *uc)
...
@@ -130,7 +130,7 @@ int check_for_max_user_connections(THD *thd, USER_CONN *uc)
/* Root is not affected by the value of max_user_connections */
/* Root is not affected by the value of max_user_connections */
if
(
global_system_variables
.
max_user_connections
&&
if
(
global_system_variables
.
max_user_connections
&&
!
uc
->
user_resources
.
user_conn
&&
!
uc
->
user_resources
.
user_conn
&&
global_system_variables
.
max_user_connections
<
(
uint
)
uc
->
connections
&&
global_system_variables
.
max_user_connections
<
uc
->
connections
&&
!
(
thd
->
security_ctx
->
master_access
&
SUPER_ACL
))
!
(
thd
->
security_ctx
->
master_access
&
SUPER_ACL
))
{
{
my_error
(
ER_TOO_MANY_USER_CONNECTIONS
,
MYF
(
0
),
uc
->
user
);
my_error
(
ER_TOO_MANY_USER_CONNECTIONS
,
MYF
(
0
),
uc
->
user
);
...
...
sql/sql_show.cc
View file @
b81d8b2e
...
@@ -2367,14 +2367,14 @@ static bool show_status_array(THD *thd, const char *wild,
...
@@ -2367,14 +2367,14 @@ static bool show_status_array(THD *thd, const char *wild,
case
SHOW_LONG_STATUS
:
case
SHOW_LONG_STATUS
:
value
=
((
char
*
)
status_var
+
(
intptr
)
value
);
value
=
((
char
*
)
status_var
+
(
intptr
)
value
);
/* fall through */
/* fall through */
case
SHOW_LONG
:
case
SHOW_
U
LONG
:
case
SHOW_LONG_NOFLUSH
:
// the difference lies in refresh_status()
case
SHOW_LONG_NOFLUSH
:
// the difference lies in refresh_status()
end
=
int10_to_str
(
*
(
long
*
)
value
,
buff
,
10
);
end
=
int10_to_str
(
*
(
long
*
)
value
,
buff
,
10
);
break
;
break
;
case
SHOW_LONGLONG_STATUS
:
case
SHOW_LONGLONG_STATUS
:
value
=
((
char
*
)
status_var
+
(
intptr
)
value
);
value
=
((
char
*
)
status_var
+
(
intptr
)
value
);
/* fall through */
/* fall through */
case
SHOW_LONGLONG
:
case
SHOW_
U
LONGLONG
:
end
=
longlong10_to_str
(
*
(
longlong
*
)
value
,
buff
,
10
);
end
=
longlong10_to_str
(
*
(
longlong
*
)
value
,
buff
,
10
);
break
;
break
;
case
SHOW_HA_ROWS
:
case
SHOW_HA_ROWS
:
...
@@ -2386,9 +2386,18 @@ static bool show_status_array(THD *thd, const char *wild,
...
@@ -2386,9 +2386,18 @@ static bool show_status_array(THD *thd, const char *wild,
case
SHOW_MY_BOOL
:
case
SHOW_MY_BOOL
:
end
=
strmov
(
buff
,
*
(
my_bool
*
)
value
?
"ON"
:
"OFF"
);
end
=
strmov
(
buff
,
*
(
my_bool
*
)
value
?
"ON"
:
"OFF"
);
break
;
break
;
case
SHOW_INT
:
case
SHOW_
U
INT
:
end
=
int10_to_str
((
long
)
*
(
uint
*
)
value
,
buff
,
10
);
end
=
int10_to_str
((
long
)
*
(
uint
*
)
value
,
buff
,
10
);
break
;
break
;
case
SHOW_SINT
:
end
=
int10_to_str
((
long
)
*
(
uint
*
)
value
,
buff
,
-
10
);
break
;
case
SHOW_SLONG
:
end
=
int10_to_str
(
*
(
long
*
)
value
,
buff
,
-
10
);
break
;
case
SHOW_SLONGLONG
:
end
=
longlong10_to_str
(
*
(
longlong
*
)
value
,
buff
,
-
10
);
break
;
case
SHOW_HAVE
:
case
SHOW_HAVE
:
{
{
SHOW_COMP_OPTION
tmp
=
*
(
SHOW_COMP_OPTION
*
)
value
;
SHOW_COMP_OPTION
tmp
=
*
(
SHOW_COMP_OPTION
*
)
value
;
...
...
sql/sys_vars.cc
View file @
b81d8b2e
...
@@ -1255,7 +1255,7 @@ static Sys_var_max_user_conn Sys_max_user_connections(
...
@@ -1255,7 +1255,7 @@ static Sys_var_max_user_conn Sys_max_user_connections(
"The maximum number of active connections for a single user "
"The maximum number of active connections for a single user "
"(0 = no limit)"
,
"(0 = no limit)"
,
SESSION_VAR
(
max_user_connections
),
CMD_LINE
(
REQUIRED_ARG
),
SESSION_VAR
(
max_user_connections
),
CMD_LINE
(
REQUIRED_ARG
),
VALID_RANGE
(
0
,
INT_MAX
),
DEFAULT
(
0
),
BLOCK_SIZE
(
1
),
NO_MUTEX_GUARD
,
VALID_RANGE
(
-
1
,
INT_MAX
),
DEFAULT
(
0
),
BLOCK_SIZE
(
1
),
NO_MUTEX_GUARD
,
NOT_IN_BINLOG
,
ON_CHECK
(
if_checking_enabled
));
NOT_IN_BINLOG
,
ON_CHECK
(
if_checking_enabled
));
static
Sys_var_ulong
Sys_max_tmp_tables
(
static
Sys_var_ulong
Sys_max_tmp_tables
(
...
...
sql/sys_vars.h
View file @
b81d8b2e
...
@@ -104,21 +104,22 @@ struct CMD_LINE
...
@@ -104,21 +104,22 @@ struct CMD_LINE
};
};
/**
/**
Sys_var_unsigned template is used to generate Sys_var_* classes
Sys_var_integer template is used to generate Sys_var_* classes
for variables that represent the value as an unsigned integer.
for variables that represent the value as an integer number.
They are Sys_var_uint, Sys_var_ulong, Sys_var_harows, Sys_var_ulonglong.
They are Sys_var_uint, Sys_var_ulong, Sys_var_harows, Sys_var_ulonglong,
Sys_var_int.
An integer variable has a minimal and maximal values, and a "block_size"
An integer variable has a minimal and maximal values, and a "block_size"
(any valid value of the variable must be divisible by the block_size).
(any valid value of the variable must be divisible by the block_size).
Class specific constructor arguments: min, max, block_size
Class specific constructor arguments: min, max, block_size
Backing store:
uint, ulong, ha_rows, ulonglong, depending on the Sys_var_*
Backing store:
int, uint, ulong, ha_rows, ulonglong, depending on the class
*/
*/
template
<
typename
T
,
ulong
ARGT
,
enum
enum_mysql_show_type
SHOWT
>
template
<
typename
T
,
ulong
ARGT
,
enum
enum_mysql_show_type
SHOWT
>
class
Sys_var_
unsigned
:
public
sys_var
class
Sys_var_
integer
:
public
sys_var
{
{
public:
public:
Sys_var_
unsigned
(
const
char
*
name_arg
,
Sys_var_
integer
(
const
char
*
name_arg
,
const
char
*
comment
,
int
flag_args
,
ptrdiff_t
off
,
size_t
size
,
const
char
*
comment
,
int
flag_args
,
ptrdiff_t
off
,
size_t
size
,
CMD_LINE
getopt
,
CMD_LINE
getopt
,
T
min_val
,
T
max_val
,
T
def_val
,
uint
block_size
,
PolyLock
*
lock
=
0
,
T
min_val
,
T
max_val
,
T
def_val
,
uint
block_size
,
PolyLock
*
lock
=
0
,
...
@@ -147,24 +148,49 @@ public:
...
@@ -147,24 +148,49 @@ public:
}
}
bool
do_check
(
THD
*
thd
,
set_var
*
var
)
bool
do_check
(
THD
*
thd
,
set_var
*
var
)
{
{
my_bool
fixed
=
FALSE
;
my_bool
fixed
=
FALSE
,
unused
;
longlong
v
=
var
->
value
->
val_int
();
if
((
ARGT
==
GET_HA_ROWS
)
||
(
ARGT
==
GET_UINT
)
||
(
ARGT
==
GET_ULONG
)
||
(
ARGT
==
GET_ULL
))
{
ulonglong
uv
;
ulonglong
uv
;
longlong
v
;
v
=
var
->
value
->
val_int
();
/*
if
(
var
->
value
->
unsigned_flag
)
if the value is signed and negative,
uv
=
(
ulonglong
)
v
;
and a variable is unsigned, it is set to zero
*/
if
((
fixed
=
(
!
var
->
value
->
unsigned_flag
&&
v
<
0
)))
uv
=
0
;
else
else
uv
=
(
ulonglong
)
(
v
<
0
?
0
:
v
)
;
uv
=
v
;
var
->
save_result
.
ulonglong_value
=
var
->
save_result
.
ulonglong_value
=
getopt_ull_limit_value
(
uv
,
&
option
,
&
fix
ed
);
getopt_ull_limit_value
(
uv
,
&
option
,
&
unus
ed
);
if
(
max_var_ptr
()
&&
var
->
save_result
.
ulonglong_value
>
*
max_var_ptr
())
if
(
max_var_ptr
()
&&
(
T
)
var
->
save_result
.
ulonglong_value
>
*
max_var_ptr
())
var
->
save_result
.
ulonglong_value
=
*
max_var_ptr
();
var
->
save_result
.
ulonglong_value
=
*
max_var_ptr
();
return
throw_bounds_warning
(
thd
,
name
.
str
,
fixed
=
fixed
||
var
->
save_result
.
ulonglong_value
!=
uv
;
var
->
save_result
.
ulonglong_value
!=
uv
,
}
else
{
/*
if the value is unsigned and has the highest bit set
and a variable is signed, it is set to max signed value
*/
if
((
fixed
=
(
var
->
value
->
unsigned_flag
&&
v
<
0
)))
v
=
LONGLONG_MAX
;
var
->
save_result
.
longlong_value
=
getopt_ll_limit_value
(
v
,
&
option
,
&
unused
);
if
(
max_var_ptr
()
&&
(
T
)
var
->
save_result
.
longlong_value
>
*
max_var_ptr
())
var
->
save_result
.
longlong_value
=
*
max_var_ptr
();
fixed
=
fixed
||
var
->
save_result
.
longlong_value
!=
v
;
}
return
throw_bounds_warning
(
thd
,
name
.
str
,
fixed
,
var
->
value
->
unsigned_flag
,
v
);
var
->
value
->
unsigned_flag
,
v
);
}
}
bool
session_update
(
THD
*
thd
,
set_var
*
var
)
bool
session_update
(
THD
*
thd
,
set_var
*
var
)
...
@@ -191,10 +217,11 @@ public:
...
@@ -191,10 +217,11 @@ public:
}
}
};
};
typedef
Sys_var_unsigned
<
uint
,
GET_UINT
,
SHOW_INT
>
Sys_var_uint
;
typedef
Sys_var_integer
<
int
,
GET_INT
,
SHOW_SINT
>
Sys_var_int
;
typedef
Sys_var_unsigned
<
ulong
,
GET_ULONG
,
SHOW_LONG
>
Sys_var_ulong
;
typedef
Sys_var_integer
<
uint
,
GET_UINT
,
SHOW_UINT
>
Sys_var_uint
;
typedef
Sys_var_unsigned
<
ha_rows
,
GET_HA_ROWS
,
SHOW_HA_ROWS
>
Sys_var_harows
;
typedef
Sys_var_integer
<
ulong
,
GET_ULONG
,
SHOW_ULONG
>
Sys_var_ulong
;
typedef
Sys_var_unsigned
<
ulonglong
,
GET_ULL
,
SHOW_LONGLONG
>
Sys_var_ulonglong
;
typedef
Sys_var_integer
<
ha_rows
,
GET_HA_ROWS
,
SHOW_HA_ROWS
>
Sys_var_harows
;
typedef
Sys_var_integer
<
ulonglong
,
GET_ULL
,
SHOW_ULONGLONG
>
Sys_var_ulonglong
;
/**
/**
Helper class for variables that take values from a TYPELIB
Helper class for variables that take values from a TYPELIB
...
@@ -883,7 +910,7 @@ public:
...
@@ -883,7 +910,7 @@ public:
Backing store: uint
Backing store: uint
*/
*/
class
Sys_var_max_user_conn
:
public
Sys_var_
u
int
class
Sys_var_max_user_conn
:
public
Sys_var_int
{
{
public:
public:
Sys_var_max_user_conn
(
const
char
*
name_arg
,
Sys_var_max_user_conn
(
const
char
*
name_arg
,
...
@@ -895,7 +922,7 @@ public:
...
@@ -895,7 +922,7 @@ public:
on_check_function
on_check_func
=
0
,
on_check_function
on_check_func
=
0
,
on_update_function
on_update_func
=
0
,
on_update_function
on_update_func
=
0
,
uint
deprecated_version
=
0
,
const
char
*
substitute
=
0
)
uint
deprecated_version
=
0
,
const
char
*
substitute
=
0
)
:
Sys_var_
u
int
(
name_arg
,
comment
,
SESSION
,
off
,
size
,
getopt
,
:
Sys_var_int
(
name_arg
,
comment
,
SESSION
,
off
,
size
,
getopt
,
min_val
,
max_val
,
def_val
,
block_size
,
min_val
,
max_val
,
def_val
,
block_size
,
lock
,
binlog_status_arg
,
on_check_func
,
on_update_func
,
lock
,
binlog_status_arg
,
on_check_func
,
on_update_func
,
deprecated_version
,
substitute
)
deprecated_version
,
substitute
)
...
@@ -1779,9 +1806,10 @@ public:
...
@@ -1779,9 +1806,10 @@ public:
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
template
class
List
<
set_var_base
>;
template
class
List
<
set_var_base
>;
template
class
List_iterator_fast
<
set_var_base
>;
template
class
List_iterator_fast
<
set_var_base
>;
template
class
Sys_var_unsigned
<
uint
,
GET_UINT
,
SHOW_INT
>;
template
class
Sys_var_integer
<
int
,
GET_INT
,
SHOW_SINT
>;
template
class
Sys_var_unsigned
<
ulong
,
GET_ULONG
,
SHOW_LONG
>;
template
class
Sys_var_integer
<
uint
,
GET_UINT
,
SHOW_INT
>;
template
class
Sys_var_unsigned
<
ha_rows
,
GET_HA_ROWS
,
SHOW_HA_ROWS
>;
template
class
Sys_var_integer
<
ulong
,
GET_ULONG
,
SHOW_LONG
>;
template
class
Sys_var_unsigned
<
ulonglong
,
GET_ULL
,
SHOW_LONGLONG
>;
template
class
Sys_var_integer
<
ha_rows
,
GET_HA_ROWS
,
SHOW_HA_ROWS
>;
template
class
Sys_var_integer
<
ulonglong
,
GET_ULL
,
SHOW_LONGLONG
>;
#endif
#endif
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