Modules/MTA-MySQL: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 5: Line 5:
   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  = [http://code.google.com/p/multitheftauto-modules/downloads/list Here] |
   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]
[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] |
   license        = [http://www.opensource.org/licenses/bsd-license.php BSD] |
   written_in    = C++ |
   written_in    = C++ |

Revision as of 14:22, 26 April 2016

[[|link=|]] Warning: This module too old, please use dbConnect.
Module info
Name MTA MySQL
Version 0.5
Author Alberto Alonso (ryden)
Module website Here
Download link Windows 32 bit
Windows 64 bit

Linux 32 bit
Linux 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

Uncompress the file mta_mysql.dll into your C:\Program files\MTA San Andreas\server\mods\deathmatch\modules\ directory and the file libmysql.dll into your C:\Program files\MTA San Andreas\server\ directory.

Then, add the following line in mtaserver.conf:

  <module src="mta_mysql.dll" />

GNU/Linux

Uncompress the file mta_mysql.so in the mods/deathmatch/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.15: cannot open shared object file: No such file or directory)! you have to install libmysqlclient15. You can get it here: http://automation.binarysage.net/?p=1311

If you experience an error on Unix systems: Try to add port and socket parameters to your mysql_connect.

Handler functions

Result managing functions

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()