OO_EXTDB3 - A driver for extDB3 addon Mysql
Lastest version : 0.2 by Code34


GitHub : https://github.com/code34/oo_extdb3.altis
OO_extDB3 is a driver for extDB3 addons

Features
    - Encapsulate totaly EXTDB3 commands through an object
    - Standardize methods name and return values

Licence
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author   /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2017-2018 Nicolas BOITEUX CLASS OO_EXTDB3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ Create a main bus message between clients & server Usage: install the extdb3 addon put the "oo_extdb3.sqf" and the "oop.h" files in your mission directory put this code into your mission init.sqf call compile preprocessFileLineNumbers "oo_extdb3.sqf"; See example mission in directory: init.sqf Licence: You can share, modify, distribute this script but don't remove the licence and the name of the original author logs: 0.1 - OO EXTDB3 - first release   Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2017-2018 Nicolas BOITEUX CLASS OO_EXTDB3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------------------------------------------- Function: _extdb3 = "new" call OO_EXTDB3; Create a new extdb3 object Parameters: string -------------------------------------------------------------------------------------------------------------- Function: _version = "getVersion" call _extdb3; Return string extdb3 version -------------------------------------------------------------------------------------------------------------- Function: _bool = "isDllEnabled" call _extdb3; Return bool - is extdb3 is loaded -------------------------------------------------------------------------------------------------------------- Function: ["setEscapeChar", _string] call _extdb3; param string : "TEXT", "TEXT2", "NULL" -------------------------------------------------------------------------------------------------------------- Function: ["setSessionId", _string] call _extdb3; param string : unique string to identify the session (default "SQL") ------------------------------------------------------------------------------------------------------------- Function: ["setIniSectionDatabase", _string] call _extdb3; param string : set Ini Section concerning Database (default "Database") ------------------------------------------------------------------------------------------------------------- Function: ["setDatabaseName", _string] call _extdb3; param string : set the databasename used ------------------------------------------------------------------------------------------------------------- Function: ["setQueryType", _string] call _extdb3; param string : set the type of SQL queries (default SQL) "SQL" : Classic sql "SQL_CUSTOM" : SQL prepared statement "LOG" : log ------------------------------------------------------------------------------------------------------------- Function: ["setSqlCustomIniFile", _string] call _extdb3; param string : set the SQL CUSTOM ini file ------------------------------------------------------------------------------------------------------------- Function: _bool = "connect" call _extdb3; connect to database Return bool - true if connected ------------------------------------------------------------------------------------------------------------- Function: _return = ["executeQuery", [_query, _defaultreturnvalue]] call _extdb3; params: string SQL query or SQL CUSTOM method default value return if nothing is return ------------------------------------------------------------------------------------------------------------- Function: _return = ["executeQuery", _query] call _extdb3; params: string SQL query if nothing is return, return empty string ------------------------------------------------------------------------------------------------------------- Function: _array = ["lock", _string] call _extdb3; Disables all System Commands except for VERSION + LOCK_STATUS + various TIME/DATA Commands params: string - password lock return array ------------------------------------------------------------------------------------------------------------- Function: _array = ["unlock", _string] call _extdb3; params: string - password lock return array ------------------------------------------------------------------------------------------------------------- Function: _array = "lockStatus" call _extdb3; return array - lock status [0] // extension is unlocked. [1] // extension is locked. ------------------------------------------------------------------------------------------------------------- Function: _array = "reset" call _extdb3; reset the dll when debug .dll is used return: return [0] or return [1] if success ------------------------------------------------------------------------------------------------------------- Function: _locatime = "getLocalTime" call _extdb3; return array - local time ------------------------------------------------------------------------------------------------------------- Function: _utctime = "getUtcTime" call _extdb3; return array - utc time ------------------------------------------------------------------------------------------------------------- Function: _uptime = ["getUptime", _string] call _extdb3; params : "SECONDS", "MINUTES", "HOURS" ------------------------------------------------------------------------------------------------------------- Function: _array = ["addDate", _array] call _extdb3; params : param [[0,0, Days, Hours, Minutes, Seconds], [+x Days, +x Hours, +x Minutes, +x Seconds]] ------------------------------------------------------------------------------------------------------------- Function: _scalar = "getOutPutSize" call _extdb3; return _scalar -------------------------------------------------------------------------------------------------------------- Function: ["delete", _extdb3] call OO_EXTDB3; Destroy the template object Parameters: object - extdb3 object Return : nothing    
Examples call compile preprocessFileLineNumbers "oo_extdb3.sqf"; sleep 2; /* SQL CUSTOM Example with prepared statements in test.ini files Call the query getAll private _extdb3 = "new" call OO_extDB3; ["setDatabaseConfigName", "Database"] call _extdb3; ["setDatabaseName", "extdb3"] call _extdb3; ["setIniFile", "test.ini"] call _extdb3; ["setDatabaseProtocol", "SQL_CUSTOM"] call _extdb3; _result = "connect" call _extdb3; private _query = ["getAll", []]; _result = ["executeQuery", _query] call _extdb3; hintc format ["%1", _result]; */ /* SQL CLASSIC QUERY private _extdb3 = "new" call OO_extDB3; ["setDatabaseConfigName", "Database"] call _extdb3; ["setDatabaseName", "extdb3"] call _extdb3; ["setDatabaseProtocol", "SQL"] call _extdb3; _result = "connect" call _extdb3; private _query = "SELECT * FROM test LIMIT 10;"; _result = ["executeQuery", _query] call _extdb3; hintc format ["%1", _result]; */