
This commit includes several changes to improve the performance and stability of ArmaRAMDb: * **Increased Buffer Size:** Increased the buffer size in `Main.cs` to 10240 to handle larger data chunks. * **Debug Logging:** Added `#ifdef __A3__DEBUG__` preprocessor directives to enable debug logging in various `.sqf` functions for easier troubleshooting. * **Improved Chunking Logic:** Refactored the chunking logic in `Utils.cs` to correctly handle array data and improve efficiency. * **ListStore Formatting:** Modified `ListStore.cs` to correctly format list values as JSON strings when retrieving or setting list elements. * **Removed Unnecessary Code:** Removed unnecessary `_dataString` variable in `fnc_fetch.sqf`. * **Updated DLL/SO:** Updated the ArmaRAMDb_x64.dll and ArmaRAMDb_x64.so files.
77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
@file Title: ArmaRAMDb Framework by Creedcoder, J.Schmidt
|
|
@file Version: 0.1
|
|
@file Name: fnc_fetch.sqf
|
|
@file Author: Creedcoder, J.Schmidt
|
|
@file edit: 03.25.2024
|
|
Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved
|
|
|
|
Do not edit without permission!
|
|
|
|
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlikes 4.0 International License.
|
|
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons,
|
|
444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
|
|
|
|
Fetch from DB:
|
|
ramdb_db_fetch_array
|
|
|
|
["uniqueID", "function", "index", "indextotal", "datachunk", "call", "netId"]
|
|
*/
|
|
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaRAMDb: 'ramdb_db_fnc_fetch' Input: %1", _this];
|
|
#endif
|
|
|
|
params ["_uniqueID", "_function", "_index", "_total", "_datachunk", "_call", "_netId"];
|
|
|
|
private _index_array = [];
|
|
private _count_total = -1;
|
|
|
|
ramdb_db_fetch_array pushBackUnique [_uniqueID, _function, _index, _total, _datachunk, _call, _netId];
|
|
|
|
_count_total = {
|
|
if (_uniqueID == _x select 0) then {
|
|
_index_array pushBackUnique [_x select 2, _x select 4];
|
|
true
|
|
} else {
|
|
false
|
|
}
|
|
} count ramdb_db_fetch_array;
|
|
|
|
if (_count_total == _total) then {
|
|
_index_array sort true;
|
|
|
|
private _allElements = [];
|
|
|
|
{
|
|
private _chunkData = _x select 1;
|
|
private _chunkArray = [];
|
|
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaRAMDb: Processing chunk: %1", _chunkData];
|
|
#endif
|
|
|
|
try {
|
|
_chunkArray = parseSimpleArray _chunkData;
|
|
_allElements append _chunkArray;
|
|
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaRAMDb: Parsed chunk successfully with %1 elements", count _chunkArray];
|
|
#endif
|
|
} catch {
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaRAMDb: Error parsing chunk: %1", _chunkData];
|
|
#endif
|
|
};
|
|
} forEach _index_array;
|
|
|
|
#ifdef __A3__DEBUG__
|
|
diag_log text format ["ArmaRAMDb: 'ramdb_db_fnc_fetch' Combined %1 chunks into array with %2 elements", count _index_array, count _allElements];
|
|
#endif
|
|
|
|
[_uniqueID, _function, _call, _allElements, _netId] call FUNC(handler);
|
|
|
|
ramdb_db_fetch_array = ramdb_db_fetch_array select {!((_x select 0) in [_uniqueID])};
|
|
}; |