0

Quoth MySQL docs - mysql_set_character_set():

This function works like the SET NAMES statement, but also sets the value of mysql->charset, and thus affects the character set used by mysql_real_escape_string()

When it says "works like the SET NAMES statement", does it mean that the actual MySQL query SET NAMES will be issued to the server?

Or does it mean that the functionality of mysql_set_character_set mimics the query SET NAMES but no actual messages or data will be sent from the web server to the database server?

Pacerier
  • 86,231
  • 106
  • 366
  • 634

1 Answers1

1

From the manual (my emphasis):

SET NAMES 'charset_name' [COLLATE 'collation_name']

SET NAMES indicates what character set the client will use to send SQL statements to the server. Thus, SET NAMES 'cp1251' tells the server, “future incoming messages from this client are in character set cp1251.” It also specifies the character set that the server should use for sending results back to the client. (For example, it indicates what character set to use for column values if you use a SELECT statement.)

If the SET NAMES command affects the character set used in communication from the server to the client, then this character set information will have to be transferred to the server somehow.

So, yes. This function call will result in data transfer to the server.

r3mainer
  • 23,981
  • 3
  • 51
  • 88