Jump to content
  • 0

Get data from DB


Notsapl

Question

Hi, can u help me ?

I have some problem with get any data from db , this is my example code : 

    _key = format["CHILD:999:select `value` from `notsa_addon_data` where `addon` = 'communication' and `key`='last_id' LIMIT 1:[]:"];
	//_data = "HiveEXT" callExtension _key;              
	//_result = call compile _data;
	_result = _key call server_hiveReadWrite;
	_status    = _result select 0;            // get the status of the result
	if (_status == "CustomStreamStart") then {    //check if the stream coming from the hive was opened
		_val = _result select 1;                  // get the number of entries that will be coming in the stream
		if(_val > 0) then {
			_result = _key call server_hiveReadWrite;
			_bankingstart = _result select 0;
		};
	};
    _notsacommunication_last_id = _bankingstart;

	diag_log("[NotsaAddon Communication] Load last key : "+str(_notsacommunication_last_id) );


	_key = format["CHILD:999:select `message`,`author`,`id` from `notsa_communication_msg` where `id` > %1  LIMIT 1:[]:",_notsacommunication_last_id];
	_result = _key call server_hiveReadWrite;

 

Why second query is  : " select `message`,`author`,`id` from `notsa_communication_msg` where `id` >   " when in log i can read:

[Information] Result : ["CustomStreamStart",1]

[Information] Result : [5] <-- Here is true data from db : last_id = 5

Why in second query variable _notsacommunication_last_id is empty ?

 

Thanks for any help ! :)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...