Modules/MTA-MySQL/mysql set character set: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ Changes the character set used for the current MySQL session. ==Syntax== <syntaxhighlight lang="lua"> bool mysql_set_character_set ( MySQLConnection handler, string charset_name ) </syntaxhighlight> ===R...) |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<pageclass class="#AA7592" subcaption="MTA-MySQL Module"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
{{ModuleFunction|MTA-MySQL}} | |||
Changes the character set used for the current MySQL session. | Changes the character set used for the current MySQL session. | ||
Latest revision as of 17:59, 5 January 2011
This function is provided by the external module MTA-MySQL. You must install this module to use this function. | |
Changes the character set used for the current MySQL session.
Syntax
bool mysql_set_character_set ( MySQLConnection handler, string charset_name )
Required arguments
- handler: A valid MySQL link
- charset_name: The new character set name
Returns
It it succeeds returns true, in other case returns false.
Example
Example 1:
handler = mysql_connect("localhost", "user", "password", "mta_users") if (not handler) then outputDebugString("Unable to connect to the MySQL server") elseif (not mysql_set_character_set(handler, "utf8")) then -- Change the charset to UTF-8 outputDebugString("Unable to change the connection character set to utf8: (" .. mysql_errno(handler) .. ")" .. mysql_error(handler)) mysql_close(handler) -- Close the connection afther the error end
See also
- mysql_connect
- mysql_close
- mysql_errno
- mysql_error
- mysql_ping
- mysql_select_db
- mysql_escape_string
- mysql_affected_rows
- mysql_change_user
- mysql_get_character_set_info
- mysql_get_client_info
- mysql_get_client_version
- mysql_get_host_info
- mysql_get_proto_info
- mysql_get_server_info
- mysql_get_server_version
- mysql_hex_string
- mysql_info
- mysql_insert_id
- mysql_query
- mysql_unbuffered_query
- mysql_set_character_set
- mysql_stat
- mysql_warning_count