Some Fixes for NULL

Just some fixes for NULL for extDB3 (since it is now supported properly
when doing prepared statements).

Reverted createTerritory to passing flag_stolen_by_uid to an input
value.
Just incase there is a 3rd party code that uses this, possible used by
admin tools to restore base without a flag etc...
This commit is contained in:
Declan Ireland 2017-02-23 16:49:48 +00:00
parent d54f60668a
commit 9afa3a4225
4 changed files with 166 additions and 36 deletions

View File

@ -0,0 +1,38 @@
/**
* ExileServer_object_construction_database_insert
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_constructionObject","_position","_vectorDirection","_vectorUp","_territoryFlag","_territoryID","_data","_extDB2Message","_constructionID"];
_constructionObject = _this;
_position = getPosATL _constructionObject;
_vectorDirection = vectorDir _constructionObject;
_vectorUp = vectorUp _constructionObject;
_territoryFlag = _constructionObject call ExileClient_util_world_getTerritoryAtPosition;
_territoryID = if (isNull _territoryFlag) then { '' } else { _territoryFlag getVariable ["ExileDatabaseID", '']};
_data =
[
typeOf _constructionObject,
_constructionObject getVariable ["ExileOwnerUID", ""],
_position select 0,
_position select 1,
_position select 2,
_vectorDirection select 0,
_vectorDirection select 1,
_vectorDirection select 2,
_vectorUp select 0,
_vectorUp select 1,
_vectorUp select 2,
_territoryID
];
_extDB2Message = ["insertConstruction", _data] call ExileServer_util_extDB2_createMessage;
_constructionID = _extDB2Message call ExileServer_system_database_query_insertSingle;
_constructionObject setVariable ["ExileDatabaseID", _constructionID];
_constructionObject setVariable ["ExileTerritoryID", _territoryID];
_constructionID

View File

@ -0,0 +1,91 @@
/**
* ExileServer_object_container_database_insert
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_containerObject","_position","_vectorDirection","_vectorUp","_territoryFlag","_territoryID","_data","_extDB2Message","_containerID","_cargoContainers"];
_containerObject = _this;
_position = getPosATL _containerObject;
_vectorDirection = vectorDir _containerObject;
_vectorUp = vectorUp _containerObject;
_territoryFlag = _containerObject call ExileClient_util_world_getTerritoryAtPosition;
_territoryID = if (isNull _territoryFlag) then { '' } else { _territoryFlag getVariable ["ExileDatabaseID", '']};
if !(ExileContainerCargo isEqualTo []) then
{
_data =
[
typeOf _containerObject,
_containerObject getVariable ["ExileOwnerUID", ""],
_position select 0,
_position select 1,
_position select 2,
_vectorDirection select 0,
_vectorDirection select 1,
_vectorDirection select 2,
_vectorUp select 0,
_vectorUp select 1,
_vectorUp select 2,
ExileContainerCargo select 0,
ExileContainerCargo select 1,
ExileContainerCargo select 2,
ExileContainerCargo select 3,
ExileContainerCargo select 4,
"0000",
_territoryID
];
} else
{
_data =
[
typeOf _containerObject,
_containerObject getVariable ["ExileOwnerUID", ""],
_position select 0,
_position select 1,
_position select 2,
_vectorDirection select 0,
_vectorDirection select 1,
_vectorDirection select 2,
_vectorUp select 0,
_vectorUp select 1,
_vectorUp select 2,
[],
[],
[],
[],
0,
"0000",
_territoryID
];
};
_extDB2Message = ["insertContainer", _data] call ExileServer_util_extDB2_createMessage;
_containerID = _extDB2Message call ExileServer_system_database_query_insertSingle;
if !(ExileContainerCargo isEqualTo []) then
{
[_containerObject, (_data select 11)] call ExileServer_util_fill_fillItems;
[_containerObject, (_data select 12)] call ExileServer_util_fill_fillMagazines;
[_containerObject, (_data select 13)] call ExileServer_util_fill_fillWeapons;
_cargoContainers = format ["loadContainerCargo:%1", _containerID] call ExileServer_system_database_query_selectSingle;
if !(_cargoContainers isEqualTo []) then
{
[_containerObject, (_cargoContainers select 0)] call ExileServer_util_fill_fillContainers;
};
ExileContainerCargo = [];
};
_containerObject setVariable ["ExileDatabaseID", _containerID];
_containerObject setVariable ["ExileIsPersistent", true];
_containerObject setVariable ["ExileIsContainer", true];
_containerObject setVariable ["ExileAccessCode","0000"];
_containerObject setVariable ["ExileTerritoryID", _territoryID];
_containerObject setVariable ["ExileMoney", parseNumber (_data select 15), true];
_containerObject addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; (_this select 0) call ExileServer_object_container_event_onMpKilled; }];
if(getNumber(configFile >> "CfgVehicles" >> typeOf _containerObject >> "exileIsLockable") isEqualTo 1)then
{
_containerObject setVariable ["ExileIsLocked",-1,true];
};
_containerID

View File

@ -5,7 +5,7 @@
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
@ -30,7 +30,8 @@ _data =
_flagTexture,
0,
_build_rights,
_moderators
_moderators,
""
];
_extDB2Message = ["createTerritory", _data] call ExileServer_util_extDB2_createMessage;
_territoryID = _extDB2Message call ExileServer_system_database_query_insertSingle;

View File

@ -1,12 +1,12 @@
[Default]
Version = 1
Version = 1
Strip Chars = "\/\|;{}<>\'"
Strip Chars Mode = 0
Input SQF Parser = false
Input SQF Parser = false
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Account related queries
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -14,7 +14,7 @@ Input SQF Parser = false
[isKnownAccount]
SQL1_1 = SELECT CASE WHEN EXISTS(SELECT uid FROM account WHERE uid = ?) THEN 'true' ELSE 'false' END
SQL1_INPUTS = 1
SQL1_INPUTS = 1
OUTPUT = 1
[createAccount]
@ -34,7 +34,7 @@ SQL1_INPUTS = 1
[getAccountStats]
SQL1_1 = SELECT score, kills, deaths, clan_id, locker, ai_kills FROM account WHERE uid = ?
SQL1_INPUTS = 1
SQL1_INPUTS = 1
OUTPUT = 1,2,3,4,5,6
[addAccountKill]
@ -50,23 +50,23 @@ SQL1_INPUTS = 1
[getAccountScore]
SQL1_1 = SELECT score FROM account WHERE uid = ?
SQL1_INPUTS = 1
SQL1_INPUTS = 1
OUTPUT = 1
[setAccountScore]
SQL1_1 = UPDATE account SET score = ? WHERE uid = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
[modifyAccountScore]
SQL1_1 = UPDATE account SET score = score + ? WHERE uid = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
[updateLocker]
SQL1_1 = UPDATE account SET locker = ? WHERE uid = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
[getLocker]
SQL1_1 = SELECT locker FROM account WHERE uid = ?
@ -96,7 +96,7 @@ SQL1_1 = INSERT INTO player_history SET account_uid = ?, name = ?, position_x =
SQL1_INPUTS = 1,2,3,4,5
[deletePlayer]
SQL1_1 = DELETE FROM player WHERE id = ?
SQL1_1 = DELETE FROM player WHERE id = ?
SQL1_INPUTS = 1
@ -150,8 +150,8 @@ SQL1_46 = p.wetness,
SQL1_47 = a.locker
SQL1_48 = FROM player p
SQL1_49 = INNER JOIN account a
SQL1_50 = ON a.uid = p.account_uid
SQL1_51 = LEFT JOIN clan c
SQL1_50 = ON a.uid = p.account_uid
SQL1_51 = LEFT JOIN clan c
SQL1_52 = ON c.id = a.clan_id
SQL1_53 = WHERE p.account_uid = ?
SQL1_INPUTS = 1
@ -206,8 +206,8 @@ SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[insertVehicle]
SQL1_1 = INSERT INTO vehicle SET
SQL1_2 = class = ?,
SQL1_1 = INSERT INTO vehicle SET
SQL1_2 = class = ?,
SQL1_3 = account_uid = ?,
SQL1_4 = is_locked = ?,
SQL1_5 = position_x = ?,
@ -247,10 +247,10 @@ SQL1_INPUTS = 1
OUTPUT = 1
[updateVehicle]
SQL1_1 = UPDATE vehicle SET
SQL1_2 = is_locked = ?,
SQL1_3 = fuel = ?,
SQL1_4 = damage = ?,
SQL1_1 = UPDATE vehicle SET
SQL1_2 = is_locked = ?,
SQL1_3 = fuel = ?,
SQL1_4 = damage = ?,
SQL1_5 = hitpoints = ?,
SQL1_6 = position_x = ?,
SQL1_7 = position_y = ?,
@ -285,9 +285,9 @@ SQL1_INPUTS = 1,2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[insertConstruction]
SQL1_1 = INSERT INTO construction SET
SQL1_2 = class = ?,
SQL1_3 = account_uid = ?,
SQL1_1 = INSERT INTO construction SET
SQL1_2 = class = ?,
SQL1_3 = account_uid = ?,
SQL1_4 = position_x = ?,
SQL1_5 = position_y = ?,
SQL1_6 = position_z = ?,
@ -299,13 +299,13 @@ SQL1_11 = up_y = ?,
SQL1_12 = up_z = ?,
SQL1_13 = territory_id = ?
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12-NULL
Return InsertID = true
[deleteConstruction]
SQL1_1 = DELETE FROM construction WHERE id = ?
SQL1_INPUTS = 1
SQL1_INPUTS = 1
[loadConstructionIdPage]
SQL1_1 = SELECT id FROM construction WHERE deleted_at IS NULL LIMIT ?,?
@ -316,7 +316,7 @@ OUTPUT = 1
[loadConstruction]
SQL1_1 = SELECT id,class,account_uid,spawned_at,position_x,position_y,position_z,direction_x,direction_y,direction_z,up_x,up_y,up_z,is_locked,pin_code,territory_id,deleted_at,damage FROM construction WHERE id = ?
SQL1_INPUTS = 1
SQL1_INPUTS = 1
OUTPUT = 1,2-STRING,3-STRING,4-STRING,5,6,7,8,9,10,11,12,13,14,15-STRING,16,17,18
[countConstruction]
@ -359,9 +359,9 @@ SQL1_INPUTS = 1,2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[insertContainer]
SQL1_1 = INSERT INTO container SET
SQL1_2 = class = ?,
SQL1_3 = account_uid = ?,
SQL1_1 = INSERT INTO container SET
SQL1_2 = class = ?,
SQL1_3 = account_uid = ?,
SQL1_4 = position_x = ?,
SQL1_5 = position_y = ?,
SQL1_6 = position_z = ?,
@ -379,7 +379,7 @@ SQL1_17 = money = ?,
SQL1_18 = pin_code = ?,
SQL1_19 = territory_id = ?
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18-NULL
Return InsertID = true
[deleteContainer]
@ -406,8 +406,8 @@ SQL1_INPUTS = 1
OUTPUT = 1
[updateContainer]
SQL1_1 = UPDATE container SET
SQL1_2 = is_locked = ?,
SQL1_1 = UPDATE container SET
SQL1_2 = is_locked = ?,
SQL1_3 = position_x = ?,
SQL1_4 = position_y = ?,
SQL1_5 = position_z = ?,
@ -512,9 +512,9 @@ SQL1_INPUTS = 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[createTerritory]
SQL1_1 = INSERT INTO territory SET owner_uid = ?, name = ?, position_x = ? , position_y = ? , position_z = ?, radius = ? , level = ? , flag_texture = ? , flag_stolen = ? , flag_stolen_by_uid = NULL , build_rights = ? , moderators = ?
SQL1_1 = INSERT INTO territory SET owner_uid = ?, name = ?, position_x = ? , position_y = ? , position_z = ?, radius = ? , level = ? , flag_texture = ? , flag_stolen = ? , flag_stolen_by_uid =? , build_rights = ? , moderators = ?
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11
SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,12-NULL,10,11
Return InsertID = true
[loadTerriotryIdPage]
@ -648,7 +648,7 @@ SQL2_INPUTS = 1
[setPlayerMoney]
SQL1_1 = UPDATE player SET money = ? WHERE id = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
[getPlayerMoney]
SQL1_1 = SELECT money FROM player WHERE id = ?
@ -659,12 +659,12 @@ OUTPUT = 1
[setContainerMoney]
SQL1_1 = UPDATE container SET money = ? WHERE id = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
[setVehicleMoney]
SQL1_1 = UPDATE vehicle SET money = ? WHERE id = ?
SQL1_INPUTS = 1,2
SQL1_INPUTS = 1,2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; XM8