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
d09d2b85
Commit
d09d2b85
authored
Mar 07, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New syntax to change client collation:
SET COLLATION latin1 SET COLLATION 'latin1' SET COLLATION DEFAULT
parent
b6a117fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
1 deletion
+83
-1
mysql-test/r/ctype_collate.result
mysql-test/r/ctype_collate.result
+39
-0
mysql-test/t/ctype_collate.test
mysql-test/t/ctype_collate.test
+15
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+29
-1
No files found.
mysql-test/r/ctype_collate.result
View file @
d09d2b85
...
...
@@ -511,16 +511,55 @@ SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL
SET NAMES 'latin1';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SET NAMES latin1;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1 2 1
SET NAMES latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SET NAMES 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_bin 2 0
SET NAMES koi8r;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r 2 1
SET COLLATION koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r_bin 2 0
SET COLLATION DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
koi8r koi8r 2 1
SET NAMES DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1 2 1
...
...
mysql-test/t/ctype_collate.test
View file @
d09d2b85
...
...
@@ -128,12 +128,27 @@ SHOW CREATE TABLE t1;
SHOW
FIELDS
FROM
t1
;
SET
NAMES
'latin1'
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SET
NAMES
latin1
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
SET
NAMES
latin1
COLLATE
latin1_bin
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SET
NAMES
'latin1'
COLLATE
'latin1_bin'
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
SET
NAMES
koi8r
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
SET
COLLATION
koi8r_bin
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
SET
COLLATION
DEFAULT
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
SET
NAMES
DEFAULT
;
SHOW
VARIABLES
LIKE
'client_collation'
;
SELECT
charset
(
'a'
),
collation
(
'a'
),
coercibility
(
'a'
),
'a'
=
'A'
;
--
error
1251
SET
NAMES
latin1
COLLATE
koi8r
;
...
...
sql/sql_yacc.yy
View file @
d09d2b85
...
...
@@ -4224,7 +4224,6 @@ option_value:
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
system_variables vars= thd->variables;
CHARSET_INFO *cs= $2 ? $2 : thd->db_charset;
CHARSET_INFO *cl= $3 ? $3 : cs;
...
...
@@ -4241,6 +4240,35 @@ option_value:
find_sys_var("client_collation"),
csname));
}
| COLLATION_SYM collation_name_or_default
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
system_variables *vars= &thd->variables;
CHARSET_INFO *cs= vars->thd_charset;
CHARSET_INFO *cl= $2;
if (!cl)
{
if (!(cl=get_charset_by_csname(cs->csname,MY_CS_PRIMARY,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"DEFAULT");
YYABORT;
}
}
else if ((cl != cs) && strcmp(cs->csname,cl->csname))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
YYABORT;
}
Item_string *csname= new Item_string(cl->name,
strlen(cl->name),
&my_charset_latin1);
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
csname));
}
| PASSWORD equal text_or_password
{
THD *thd=YYTHD;
...
...
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