Modules/MTA-MySQL/mysql hex string
Jump to navigation
Jump to search
This function is provided by the external module MTA-MySQL. You must install this module to use this function. | |
Converts a string to an hexadecimal representation of it. It is useful to insert binary data in blob fields, or to retreive and show it in your resources. It doesn't append '0x' or 'X' to the retreived string, the programmer must add it.
Syntax
string mysql_hex_string ( string theString )
Required arguments
- theString: The string to convert
Returns
An hexadecimal formatted string.
Example
Example 1: This function receives a string with a binary file content and stores it in a blob field of the database.
function savePlayerAvatar(playerName, imgRawData) local imgHexData = mysql_hex_string(imgRawData) mysql_query(handler, "UPDATE account SET avatar='0x" .. imgHexData .. "' WHERE name='" .. playerName .. "'") 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