Connection Character Sets and Collations
776
This time we have a column with a
latin1
character set and a default collation. Although it
might seem natural, the default collation is not taken from the table level. Instead, because the
default collation for
latin1
is always
latin1_swedish_ci
, column
c1
has a collation of
latin1_swedish_ci
(not
latin1_danish_ci
).
Example 3: Table and Column Definition
CREATE TABLE t1
(
c1 CHAR(10)
) DEFAULT CHARACTER SET latin1 COLLATE latin1_danish_ci;
We have a column with a default character set and a default collation. In this circumstance, MySQL
checks the table level to determine the column character set and collation. Consequently, the character
set for column
c1
is
latin1
and its collation is
latin1_danish_ci
.
Example 4: Database, Table, and Column Definition
CREATE DATABASE d1
DEFAULT CHARACTER SET latin2 COLLATE latin2_czech_ci;
USE d1;
CREATE TABLE t1
(
c1 CHAR(10)
);
We create a column without specifying its character set and collation. We're also not specifying a
character set and a collation at the table level. In this circumstance, MySQL checks the database
level to determine the table settings, which thereafter become the column settings.) Consequently, the
character set for column
c1
is
latin2
and its collation is
latin2_czech_ci
.
10.1.3.8. Compatibility with Other DBMSs
For MaxDB compatibility these two statements are the same:
CREATE TABLE t1 (f1 CHAR(
N
) UNICODE);
CREATE TABLE t1 (f1 CHAR(
N
) CHARACTER SET ucs2);
10.1.4. Connection Character Sets and Collations
Several character set and collation system variables relate to a client's interaction with the server.
Some of these have been mentioned in earlier sections:
• The server character set and collation are the values of the
character_set_server
[443]
and
collation_server
[444]
system variables.
• The character set and collation of the default database are the values of the
character_set_database
[442]
and
collation_database
[444]
system variables.
Additional character set and collation system variables are involved in handling traffic for the
connection between a client and the server. Every client has connection-related character set and
collation system variables.
A “connection” is what you make when you connect to the server. The client sends SQL statements,
such as queries, over the connection to the server. The server sends responses, such as result sets or
error messages, over the connection back to the client. This leads to several questions about character
set and collation handling for client connections, each of which can be answered in terms of system
variables:
• What character set is the statement in when it leaves the client?
The server takes the
character_set_client
[441]
system variable to be the character set in
which statements are sent by the client.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...