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
ace0eac6
Commit
ace0eac6
authored
Feb 26, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set_var.cc, set_var.h:
New thread variable client_character_set
parent
b1b00be0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
sql/set_var.cc
sql/set_var.cc
+52
-0
sql/set_var.h
sql/set_var.h
+17
-0
No files found.
sql/set_var.cc
View file @
ace0eac6
...
...
@@ -104,6 +104,7 @@ sys_var_str sys_charset("character_set",
sys_check_charset
,
sys_update_charset
,
sys_set_default_charset
);
sys_var_thd_client_charset
sys_client_charset
(
"client_character_set"
);
sys_var_thd_conv_charset
sys_convert_charset
(
"convert_character_set"
);
sys_var_bool_ptr
sys_concurrent_insert
(
"concurrent_insert"
,
&
myisam_concurrent_insert
);
...
...
@@ -331,6 +332,7 @@ sys_var *sys_variables[]=
&
sys_binlog_cache_size
,
&
sys_buffer_results
,
&
sys_bulk_insert_buff_size
,
&
sys_client_charset
,
&
sys_concurrent_insert
,
&
sys_connect_timeout
,
&
sys_convert_charset
,
...
...
@@ -437,6 +439,7 @@ struct show_var_st init_vars[]= {
{
sys_bulk_insert_buff_size
.
name
,(
char
*
)
&
sys_bulk_insert_buff_size
,
SHOW_SYS
},
{
sys_charset
.
name
,
(
char
*
)
&
sys_charset
,
SHOW_SYS
},
{
"character_sets"
,
(
char
*
)
&
charsets_list
,
SHOW_CHAR_PTR
},
{
sys_client_charset
.
name
,
(
char
*
)
&
sys_client_charset
,
SHOW_SYS
},
{
sys_concurrent_insert
.
name
,(
char
*
)
&
sys_concurrent_insert
,
SHOW_SYS
},
{
sys_connect_timeout
.
name
,
(
char
*
)
&
sys_connect_timeout
,
SHOW_SYS
},
{
sys_convert_charset
.
name
,
(
char
*
)
&
sys_convert_charset
,
SHOW_SYS
},
...
...
@@ -1174,6 +1177,55 @@ byte *sys_var_thd_conv_charset::value_ptr(THD *thd, enum_var_type type)
}
bool
sys_var_thd_client_charset
::
check
(
THD
*
thd
,
set_var
*
var
)
{
CHARSET_INFO
*
tmp
;
char
buff
[
80
];
String
str
(
buff
,
sizeof
(
buff
),
system_charset_info
),
*
res
;
if
(
!
var
->
value
)
// Default value
{
var
->
save_result
.
charset
=
(
var
->
type
!=
OPT_GLOBAL
?
global_system_variables
.
thd_charset
:
default_charset_info
);
return
0
;
}
if
(
!
(
res
=
var
->
value
->
val_str
(
&
str
)))
res
=
&
empty_string
;
if
(
!
(
tmp
=
get_charset_by_csname
(
res
->
c_ptr
(),
MYF
(
0
))))
{
my_error
(
ER_UNKNOWN_CHARACTER_SET
,
MYF
(
0
),
res
->
c_ptr
());
return
1
;
}
var
->
save_result
.
charset
=
tmp
;
// Save for update
return
0
;
}
bool
sys_var_thd_client_charset
::
update
(
THD
*
thd
,
set_var
*
var
)
{
if
(
var
->
type
==
OPT_GLOBAL
)
global_system_variables
.
thd_charset
=
var
->
save_result
.
charset
;
else
{
thd
->
variables
.
thd_charset
=
var
->
save_result
.
charset
;
thd
->
protocol_simple
.
init
(
thd
);
thd
->
protocol_prep
.
init
(
thd
);
}
return
0
;
}
byte
*
sys_var_thd_client_charset
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
{
CHARSET_INFO
*
cs
=
((
type
==
OPT_GLOBAL
)
?
global_system_variables
.
thd_charset
:
thd
->
variables
.
thd_charset
);
return
cs
?
(
byte
*
)
cs
->
csname
:
(
byte
*
)
""
;
}
bool
sys_var_timestamp
::
update
(
THD
*
thd
,
set_var
*
var
)
{
...
...
sql/set_var.h
View file @
ace0eac6
...
...
@@ -423,6 +423,22 @@ class sys_var_thd_conv_charset :public sys_var_thd
bool
check_default
(
enum_var_type
type
)
{
return
0
;
}
};
class
sys_var_thd_client_charset
:
public
sys_var_thd
{
public:
sys_var_thd_client_charset
(
const
char
*
name_arg
)
:
sys_var_thd
(
name_arg
)
{}
bool
check
(
THD
*
thd
,
set_var
*
var
);
bool
update
(
THD
*
thd
,
set_var
*
var
);
SHOW_TYPE
type
()
{
return
SHOW_CHAR
;
}
byte
*
value_ptr
(
THD
*
thd
,
enum_var_type
type
);
bool
check_update_type
(
Item_result
type
)
{
return
type
!=
STRING_RESULT
;
/* Only accept strings */
}
bool
check_default
(
enum_var_type
type
)
{
return
0
;
}
};
/* Variable that you can only read from */
...
...
@@ -473,6 +489,7 @@ class set_var :public set_var_base
enum_var_type
type
;
union
{
CHARSET_INFO
*
charset
;
CONVERT
*
convert
;
ulong
ulong_value
;
}
save_result
;
...
...
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