首页 > 其他 > 详细

SET NAMES

时间:2016-09-04 01:39:49      阅读:273      评论:0      收藏:0      [点我收藏+]

High Performance MySQL, Third Editionby Baron Schwartz, Peter Zaitsev, and Vadim Tkachenko

Settings for client/server communication When the server and the client communicate with each other, they might send data back and forth in different character sets. The server will translate as needed:

• The server assumes the client is sending statements in the character set specifiedby character_set_client.

• After the server receives a statement from the client, it translates it into the characterset specified by character_set_connection. It also uses this setting to determinehow to convert numbers into strings.

• When the server returns results or error messages back to the client, it translatesthem into character_set_result.

Suppose you open a client connection with latin1 (the default character set, unlessyou’ve used mysql_options() to change it) and then use SET NAMES utf8 to tell the serverto assume the client is sending data in UTF-8. You’ve created a character set mismatch,which can cause errors and even security problems.

SET NAMES

原文:http://www.cnblogs.com/yuanjiangw/p/5838445.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!