Page 1 of 1

MySQL Module

Posted: Sat Jan 19, 2019 8:58 pm
by Vortrex
This is a simple MySQL module for those who want to use it for their server. Most of the functions have been lightly tested, but if you run into any issues please leave a reply on this topic.

How to Use:
Place into your server's "modules" folder and put "<module src="module_folder_name/module_file_name" />" into the modules section of your server XML. Be sure to include the folder your modules are stored in (it's relative to the main server directory) and do **not** include a file extension.

Code: Select all

    <module src="modules/mod_mysql" />
For Windows, you'll need to download the libmysql file that goes with your server's platform and architecture. A list of these is available on the releases page, found on the link above.

For Linux, you'll need to install libmysqlclient18 ... Use your distro's package manager or download from the mysql website. Unlike Windows, you don't need any extra files in the server directory for this to work.

Sample Code:

Code: Select all

let db = module.mysql.connect("localhost", "username", "password", "database", 3306);
let result = db.query("SELECT id, something FROM test");
if(result.numRows > 0) {
    let row = result.fetchRow();
    console.log("ID is " + String(row[0]));

Function/Property List:

Code: Select all

connectionHandle = module.mysql.connect(string host, string user, string password, string database, int port);
resultHandle = connectionHandle.query(string query);

void connectionHandle.close(void);
int connectionHandle.affectedRows;
int connectionHandle.insertId;
string connectionHandle.error;
int connectionHandle.errorNum;
int connectionHandle.warningCount;
string connectionHandle.escapeString(string unsafeString);
void connectionHandle.selectDatabase(string database);
void connectionHandle.changeUser(string username, string password);

int resultHandle.numRows;
int resultHandle.numFields;
table resultHandle.fetchAssoc();
array resultHandle.fetchRow();


Re: MySQL Module

Posted: Sat May 18, 2019 8:50 am
by Vortrex
Module Update
Version 1.1
  • Added query.fetchAssoc() function

Re: MySQL Module

Posted: Wed Oct 30, 2019 8:05 am
by Vortrex
Module Update
Version 1.2
  • Updated to work with new SDK format

Re: MySQL Module

Posted: Sat Mar 14, 2020 10:32 am
by Vortrex
Module Update
Version 1.3
  • Renamed the module to mod_mysql to support both GTAC and TRML