Modules/MTA-MySQL: Difference between revisions
mNo edit summary |
(the font size is intentional) |
||
(27 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
<pageclass class="#AA7592" subcaption="MTA-MySQL Module"></pageclass> | <pageclass class="#AA7592" subcaption="MTA-MySQL Module"></pageclass> | ||
<!-- The font size is intentional, do not modify !--> | |||
<div style="font-size: 4em; line-height: 1em;">{{Warning|We don't provide any support for this module!}}</div> | |||
<br> | |||
<div style="font-size: 10em; line-height: 1em;">{{Warning|This module is too old, please use [[dbConnect]] instead.}}</div> | |||
{{Module_Info| | {{Module_Info| | ||
name = MTA MySQL | | name = MTA MySQL | | ||
version = 0.5 | | version = 0.5 | | ||
author = [[User:ryden|Alberto Alonso (ryden)]] | | author = [[User:ryden|Alberto Alonso (ryden)]] | | ||
author2 = [[User:ryden|Alberto Alonso (ryden)]] | | |||
module_website = [http://code.google.com/p/multitheftauto-modules Here] | | module_website = [http://code.google.com/p/multitheftauto-modules Here] | | ||
download_link = [ | download_link = [https://nightly.mtasa.com/files/modules/32/mta_mysql.dll Windows 32 bit]<br/>[https://nightly.mtasa.com/files/modules/64/mta_mysql.dll Windows 64 bit] | ||
license = [http://www.opensource.org/licenses/bsd-license.php BSD] | [https://nightly.mtasa.com/files/modules/32/mta_mysql.so Linux 32 bit]<br/>[https://nightly.mtasa.com/files/modules/64/mta_mysql.so Linux 64 bit] | | ||
license = [http://www.opensource.org/licenses/bsd-license.php BSD] | | |||
written_in = C++ | | |||
operating_system = Cross-platform | | |||
compatible_with = DP2.x & 1.X | | |||
}} | }} | ||
MTA MySQL is an alternative to the default [[Modules/MySQL|ml_mysql]] module provided by the MTA team. | MTA MySQL is an alternative to the default [[Modules/MySQL|ml_mysql]] module provided by the MTA team. | ||
Line 16: | Line 24: | ||
==Installation== | ==Installation== | ||
===Windows=== | ===Windows=== | ||
'''32 bit:''' Copy 32 bit mta_mysql.dll into the '''MTA San Andreas\server\mods\deathmatch\modules\''' directory.<br/> | |||
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x86.exe 32 bit VS2013 Runtime Redist])'' | |||
'''64 bit:''' Copy 64 bit mta_mysql.dll into the '''MTA San Andreas\server\x64\modules\''' directory.<br/> | |||
''(You might also need to install [https://nightly.mtasa.com/files/vcredist_2013_x64.exe 64 bit VS2013 Runtime Redist])'' | |||
Then, add the following line in mtaserver.conf: | Then, add the following line in mtaserver.conf: | ||
Line 24: | Line 36: | ||
===GNU/Linux=== | ===GNU/Linux=== | ||
'''32 bit:''' Copy 32 bit mta_mysql.so into the '''mods/deathmatch/modules/''' directory.<br/> | |||
'''64 bit:''' Copy 64 bit mta_mysql.so into the '''x64/modules/''' directory. | |||
Then, add the following line in mtaserver.conf: | Then, add the following line in mtaserver.conf: | ||
Line 30: | Line 44: | ||
<module src="mta_mysql.so" /> | <module src="mta_mysql.so" /> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To fix '''MODULE: Unable to find modules/mta_mysql.so (libmysqlclient.so.16: cannot open shared object file: No such file or directory)!''' copy ''libmysqlclient.so.16'' into '''/usr/lib''' ([https://nightly.mtasa.com/files/modules/32/libmysqlclient.so.16 32 bit], [https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16 64 bit]) | |||
'''If you experience an error on Unix systems:''' | '''If you experience an error on Unix systems:''' | ||
Try to add port and socket parameters to your mysql_connect. | Try to add port and socket parameters to your mysql_connect. | ||
==Handler functions== | ==Handler functions== | ||
Line 55: | Line 69: | ||
[[Category:Modules]] | [[Category:Modules]] | ||
[[ru:Modules/MTA-MySQL]] |
Latest revision as of 10:08, 8 February 2023
Module info | |
Name | MTA MySQL |
Version | 0.5 |
Author | Alberto Alonso (ryden) |
Module website | Here |
Download link | Windows 32 bit Windows 64 bit |
License | BSD |
Written in | C++ |
Operating system | Cross-platform |
Compatible with | DP2.x & 1.X |
MTA MySQL is an alternative to the default ml_mysql module provided by the MTA team. It is available for Windows and GNU/Linux and provides the source code.
Note: From version 0.4 it supports both DP2.3 and 1.0 servers.
Installation
Windows
32 bit: Copy 32 bit mta_mysql.dll into the MTA San Andreas\server\mods\deathmatch\modules\ directory.
(You might also need to install 32 bit VS2013 Runtime Redist)
64 bit: Copy 64 bit mta_mysql.dll into the MTA San Andreas\server\x64\modules\ directory.
(You might also need to install 64 bit VS2013 Runtime Redist)
Then, add the following line in mtaserver.conf:
<module src="mta_mysql.dll" />
GNU/Linux
32 bit: Copy 32 bit mta_mysql.so into the mods/deathmatch/modules/ directory.
64 bit: Copy 64 bit mta_mysql.so into the x64/modules/ directory.
Then, add the following line in mtaserver.conf:
<module src="mta_mysql.so" />
To fix MODULE: Unable to find modules/mta_mysql.so (libmysqlclient.so.16: cannot open shared object file: No such file or directory)! copy libmysqlclient.so.16 into /usr/lib (32 bit, 64 bit)
If you experience an error on Unix systems: Try to add port and socket parameters to your mysql_connect.
Handler functions
- 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
Result managing functions
- mysql_data_seek
- mysql_fetch_field
- mysql_fields
- mysql_fetch_lengths
- mysql_fetch_row
- mysql_rows
- mysql_fetch_assoc
- mysql_rows_assoc
- mysql_field_length
- mysql_field_name
- mysql_field_seek
- mysql_field_tell
- mysql_num_fields
- mysql_num_rows
- mysql_result
- mysql_free_result
- mysql_null
Version 0.5 calling method
From version 0.5 onwards you can call all this module functions, except mysql_connect and mysql_null, as if they are methods of an object.
For example, having a valid MySQL handler, you can do handler:query ( "SELECT * FROM table" ) instead of mysql_query ( handler, "SELECT * FROM table" ).
Function aliases
A function alias is a second name for a function, which makes calling any of the original name or the alias have the same result. The new aliases introduced in version 0.5 are:
- result:num_rows() is the same as result:numrows()
- result:num_fields() is the same as result:numfields()
- result:free_result() is the same as result:free()