Jump to content
torndeco

extDB (arma3 extension linux/windows)

Recommended Posts

Is there any good tutorial how to setup this for custom mission (new game mode)? Things that confuse me:

 

1. Downloaded files from https://bitbucket.org/torndeco/extdb3/downloads, but can't find there:  tbbmalloc.dll and extdb3-conf.ini

2. Where and how can I setup SQL querries? For example I have set variable in mission like:

player setvariable ["test",1,false];

 

How to store it via extdb3? I mean where should I put SQL querry etc.

 

maybe it's just me, but can't find answers in documentation on download page. It's awesome mod, but pretty hard to start.

Share this post


Link to post
Share on other sites

1) The files are in the 7zip files
2) You need to look at wiki documentation, I recommend you look at other addons / missions using extDB3 i.e Exile / A3Wasteland / Arma Life RPG or another framework using extDB3.

Its harder to give basic examples..
Because depending on your mission you can have different Database Scheme/Structure.
Then there is using prepared statements or normal sql queries.
Not to mention with extDB3 you can connect to multiple databases etc



If you have no knowledge of SQL using something like iniDB might be easier.



 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks, now I have all files I need :)

 

Well I know SQL, but studying Altis Life to find what I really need to store some variables in database will be pretty hard ;) I'll keep trying. Thank you.

 

That would be perfect if you could create one day some extremly basic example of extdb3 usage. For example:

 

1. Basic mysql strucutre database, users tabele with lets say 2 variables - name && test or something like that

2. Basic mission structure (do I need to initialize something from init.sqf? etc)

3. Some basic SQL querry in sqf files like create/update

 

Share this post


Link to post
Share on other sites

Why removed download links to version 2? This version still in use on many old installations. And i need it now. Have someone it?

Share this post


Link to post
Share on other sites

Version 2 is over a year old, most missions/mods have updated to the newer version.
It is very little work todo the update & its faster and better supported.

It is very little work to update to extDB3, just some minor changes are required.

Share this post


Link to post
Share on other sites

Just started learning how to use extDB3, and I'm having a hard time grabbing values from the database. I am able to use INSERT and UPDATE no problem at all, but custom calls with output values show up with a bunch of extra brackets and what appears to be the returnID? even though I have that disabled.

 

One of my functions for instance:

[getMoney]
;; Prepared Statement = true
;;   If set to false, uses SQL instead of Prepared Statement
Return InsertID = false

;; Strip Chars = ""
;; Strip Chars Mode = 0
;;    Incase you want to override the Strip Chars from [Default]

SQL1_1 = SELECT Money FROM stats WHERE PlayerUID = ?;
SQL1_INPUTS = 1
OUTPUT = 1

Will return [1, [[3000]]]

 

Stripping [] character would help in an instance like this, but would not work on stored values like loadouts. I'm also not sure how to get rid that of preceding '1', as Return InsertID = false

 

 

When I issue the callExtension for these functions using either of the 'GET' functions, my whole game just crashes with nothing to the logs. Not sure if maybe I'm just using those incorrectly? Are the 'GET' functions considered Async? I'm guessing I wouldn't want to use 0:Sync often for retrieval of values?

 

_result = "extDB3" callExtension "0:sql:getMoney:666"; -> returns [1, [[3000]]]

 

_result = "extDB3" callExtension "4:sql:getMoney:666"; -> crashes

 

 

Here's what my database looks like Link

 

 

Thanks for any help! Loving the addon so far!

 

 

**EDIT**

 

I've found a rather hacky way to isolate the variables when I call them.

 

_key = call compile format["%1",_result];
_key = _key select 1;
_key = _key select 0;
_key = _key select 0;

Seems to get around all those pesky square brackets, it just feels as if this is not the proper way to retrieve values (correct me if I'm wrong).

 

 

Edited by ezremake
Small headway

Share this post


Link to post
Share on other sites

I will be pushing an update tomorrow, with some fixes.
Please note the dlls are signed by Startcom (new certificate) like before, but the signature chain isn't trusted by Windows anymore (atleast for windows 10).



I will prob not be fixing this issue anytime unless someone donates the money for me to buy a new code signing cert.
Just can't be affording to purchase anyother code signing certificate atm for arma
But it shouldn't be a major issue for users 

 

Share this post


Link to post
Share on other sites

Version 1.030
https://bitbucket.org/torndeco/extdb3/downloads
 

Changelog

  • UPDATED: MariaDB C Connector
  •  
  • ADDED: Support for MYSQL TIMESTAMP Datatype
  • FIXED: Bug in code for memory allocator (thanks Dedmen)


Couple bug fixes in the MariaDB C Connector, but the main for linux users. Is looking for mysql / mariadb configuration file in correct locations.

Share this post


Link to post
Share on other sites

Hello @torndeco

 

I have a query which returns 15 rows. 

It works fine. 

But if I add 1 more row in my table, then it doesn't work anymore

I get these logs : 

 1:56:35 "[2,""100""]"
 1:58:15 "[2,""101""]"
 1:58:24 "[2,""102""]"

Do you know what it means ? 

 

_query = "getAllVehicles";
_result = call compile ("extDB3" callExtension format["0:sql:%1",_query]);
diag_log str _result;

 

Share this post


Link to post
Share on other sites

Version 1.031
https://bitbucket.org/torndeco/extdb3/downloads
 

Changelog

  • UPDATED: MariaDB C Connector (Fixes crash on Windows after TLS reconnect)
  •  
  • FIXED: Crash when fetching a multi-part message etc, when you send it characters instead of a valid job id number.
  • ADDED: SQL_CUSTOM: Added Return InsertID String, wraps quotations around the InsertID (to avoid arma issue dealing with numbers over 6 digits in size)
  • ADDED: SQL_CUSTOM: Added Option -REMOVE_QUOTE   strips " ' from value


Mainly 2 crash fixes & SQL_CUSTOM additions to deal with when auto increment id numbers go over 6 digits i.e 1,234,567.
 

Share this post


Link to post
Share on other sites
Guest

What is the maximum number of characters that can be returned by a query? In Arma 2 there is a ~16K characters limit, in extDB3 there is that limit?

Share this post


Link to post
Share on other sites

That is what multi message support for extDB2/3 is for. It passes you the string in pieces that you put back together
Also Arma2 its 2k limit

Share this post


Link to post
Share on other sites

Version 1.032
Windows Version only atm, Linux sometime this weekend
https://bitbucket.org/torndeco/extdb3/downloads
 

Changelog

  • FIXED: Minor Issue with MySQL Idle Connection
  •  
  • ADDED: SQL_CUSTOM: "Number of Retrys" Option 


More info for Number of Retrys is at https://bitbucket.org/torndeco/extdb3/wiki/extDB3 - sql_custom.ini
It can be defined per call etc

----------------
This version is mainly for people using a remote database connection etc. Or connecting via TCP etc

Share this post


Link to post
Share on other sites

Hi Torndeco, I recently came back to Arma 3 to develop a mission using extDB3 and i got kinda confused when i tried to retrieve Char values from the database; They're not wrapped with commas like they used to in extDB2, Even after using the 'TEXT' & 'TEXT2' options. I wanted to know if it was a design choice and if it possible to have this feature in the next update ?

 

0 call BIS_fnc_recompile;

[] call WAR_fnc_dbAPIReset;
["Warzone_Dev"] call WAR_fnc_dbAddDatabase;
["Warzone_Dev","SQL","Warzone_Dev_SQL","TEXT2-NULL"] call WAR_fnc_dbAddDatabaseProtocol;
//["Warzone_Dev_SQL","SELECT * FROM player"] call WAR_fnc_dbQuery;
var = "extdb3" callExtension "0:Warzone_Dev_SQL:SELECT * FROM player";

/*
--- Query's return :
[1,[[1,76561197995843303,Name,NameProfile,NameSteam,'Description',...

--- Should be :
[1,[[1,'76561197995843303','Name','NameProfile','NameSteam','Description',...

--- Table construction :
CREATE TABLE Player(
        ID          INT UNSIGNED Auto_increment  NOT NULL ,
        UID         CHAR (17) NOT NULL ,
        Name        CHAR (31),
        NameProfile CHAR (31),
        NameSteam   CHAR (31),
        Description Varchar (1023),
        FirstName   CHAR (31),
        LastName    CHAR (31),
        Email       CHAR (254),
        Fund        FLOAT ,
        ID_Object_Player INT UNSIGNED,
        ID_Object_Inventory INT UNSIGNED,
        PRIMARY KEY (ID ) ,
        UNIQUE (UID )
)ENGINE=InnoDB;

 

Youpala.

Share this post


Link to post
Share on other sites

Nevermind pretty sure got it figured out.
Change your CHAR -> VAR_CHAR and it should work fine.
I might look at adding an option to enable it for CHAR, don't wanna change default behaviour incase it breaks on someone.
Since its been this way for longtime now.

Share this post


Link to post
Share on other sites

Alright, Well for the time being i'll just change my CHARs into VARCHARs and keep a look out for updates on protocol options. Thanks for the fast feedback !

Share this post


Link to post
Share on other sites

Are there any tutorials or guidelines when it comes to compiling and building this from the source?

Share this post


Link to post
Share on other sites

It uses a Cmake build system
You may need to edit CMakelist.txt as i think i hardcoded some paths  (pretty obvious in the file) to make my life easier when building it on windows.

There is no support/guides on how to build it
But honestly if you can't compile, then you prob shouldn't be messing around with the code.
 

Share this post


Link to post
Share on other sites
13 hours ago, torndeco said:

It uses a Cmake build system
You may need to edit CMakelist.txt as i think i hardcoded some paths  (pretty obvious in the file) to make my life easier when building it on windows.

There is no support/guides on how to build it
But honestly if you can't compile, then you prob shouldn't be messing around with the code.
 

Well I wanted to try to make extDB2 with 64 bit support. I'm trying to use it for remote rcon via in game. But do you by any chance have a backup of the extDB2 documentation/wiki? If so, could I take a look at it?

Share this post


Link to post
Share on other sites

Sorry extDB2 is no longer supported and has known bugs etc, just let that extension die etc..

Only some old missions are using and Exile (but community has changes required to implement extDB3)
It is also more awkward to build and slower for database queries etc
Besides with sqf servercommand, there is little reason for rcon commands, that you can implement better with sqf

Share this post


Link to post
Share on other sites

SQLite will prob never happen for extDB3, am busy with other projects & RL.
I might revisit this if/when dayz sa modding support comes out and  if dayz sa has some version of extensions.

Share this post


Link to post
Share on other sites

I can connect the database and the server but it does not make any entries in the database

 

Code:

 

"extDB3" callExtension "9:ADD_DATABASE:ftpCoop"//connection to DB,   [ftpCoop] = name in extDB3-conf.ini

"extDB3" callExtension "9:ADD_DATABASE_PROTOCOL:ftpCoop:SQL:SQL_QUERY"//saw that on the internet it works so it's ok

//both works and gets executed in init.sqf

 

"extDB3" callExtension format ["0:SQL_QUERY:INSERT INTO main (steamID, lastUsername) VALUES ('%1','%2')",(getPlayerUID player),(profileName)];

//inserts playerUID (primary key in database) and last username in the database (and other things like date & time, [...]  automatically with CURRENT_TIMESTAMP and other standard values in the database itself)

//doesn't work if the player is already in  the database, but it doesn't crash everything so it's ok
"extDB3" callExtension format ["0:SQL_QUERY:UPDATE main SET steamID='%1', lastUsername='%2' WHERE steamID='%3'",(getPlayerUID player),(profileName),(getPlayerUID player)];

//refreshes data in database

//tried to execute it on different scripts e.g. onPlayerRespawn.sqf, init.sqf, initPlayerLocal.sqf and initPlayerServer.sqf

 

 

If I execute the insertion command in the debug console, it only works if I execute it on the server (not local or global). Then the playerUID is empty and the name is 'arma3'.

The last command doesn't cause any problems if I execute it in the debug console.

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×