<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler" xml:lang="en-US">
<title>handler</title>
<indexterm><primary>handler</primary></indexterm>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md81">
<title>autotoc_md81</title>
<para>title: ArmaDragonflyClient - Handler icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md82">
<title>excerpt: Handle data from DB.</title></section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md83">
<title>dragonfly_db_fnc_handler</title><section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md84">
<title>Description</title>
<para>Handles data received from the database and routes it to the appropriate function. This function is a critical component of the callback system, receiving data from database operations and directing it to the specified function, either locally or to a remote client.</para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md85">
<title>Syntax</title>
<para><literallayout><computeroutput>[_uniqueID,&#32;_function,&#32;_call,&#32;_data,&#32;_netId]&#32;call&#32;dragonfly_db_fnc_handler
</computeroutput></literallayout></para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md86">
<title>Parameters</title>
<para><informaltable frame="all">
    <tgroup cols="4" align="left" colsep="1" rowsep="1">
      <colspec colname='c1'/>
      <colspec colname='c2'/>
      <colspec colname='c3'/>
      <colspec colname='c4'/>
<thead>
      <row  class='markdownTableHead'>
<entry>
<para>Parameter   </para>
</entry><entry>
<para>Type   </para>
</entry><entry>
<para>Description   </para>
</entry><entry>
<para>Default    </para>
</entry></row>
</thead><tbody>
      <row  class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_uniqueID</computeroutput>   </para>
</entry><entry>
<para>String   </para>
</entry><entry>
<para>Unique identifier for the data chunk   </para>
</entry><entry>
<para>&quot;&quot;    </para>
</entry></row>
      <row  class='markdownTableRowEven'>
<entry>
<para><computeroutput>_function</computeroutput>   </para>
</entry><entry>
<para>String   </para>
</entry><entry>
<para>Name of function to receive the data   </para>
</entry><entry>
<para>&quot;&quot;    </para>
</entry></row>
      <row  class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_call</computeroutput>   </para>
</entry><entry>
<para>Boolean   </para>
</entry><entry>
<para>Whether to call the function directly (true) or spawn (false)   </para>
</entry><entry>
<para>false    </para>
</entry></row>
      <row  class='markdownTableRowEven'>
<entry>
<para><computeroutput>_data</computeroutput>   </para>
</entry><entry>
<para>Array, String, Number, or Boolean   </para>
</entry><entry>
<para>The data retrieved from the database   </para>
</entry><entry>
<para>[]    </para>
</entry></row>
      <row  class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_netId</computeroutput>   </para>
</entry><entry>
<para>String   </para>
</entry><entry>
<para>(Optional) NetID of the player to receive the data   </para>
</entry><entry>
<para>nil   </para>
</entry></row>
    </tbody>
    </tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md87">
<title>Return Value</title>
<para>None. The data is passed to the specified function for processing.</para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md88">
<title>Examples</title><section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md89">
<title>Process data locally:</title>
<para><literallayout><computeroutput>[&quot;0123456789&quot;,&#32;&quot;dragonfly_db_fnc_test&quot;,&#32;false,&#32;[&quot;Hello&#32;World!&quot;]]&#32;call&#32;dragonfly_db_fnc_handler;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md90">
<title>Send data to a specific client:</title>
<para><literallayout><computeroutput>[&quot;0123456789&quot;,&#32;&quot;dragonfly_db_fnc_test&quot;,&#32;false,&#32;[&quot;Hello&#32;World!&quot;],&#32;netId&#32;player]&#32;remoteExecCall&#32;[&quot;dragonfly_db_fnc_handler&quot;,&#32;2,&#32;false];
</computeroutput></literallayout></para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md91">
<title>Process data with direct call (synchronous):</title>
<para><literallayout><computeroutput>[&quot;0123456789&quot;,&#32;&quot;dragonfly_db_fnc_processInventory&quot;,&#32;true,&#32;[[&quot;weapon1&quot;,&#32;30],&#32;[&quot;item2&quot;,&#32;5]]]&#32;call&#32;dragonfly_db_fnc_handler;
</computeroutput></literallayout></para>
</section>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md92">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>The function validates that both the function name and data are valid before proceeding</para>
</listitem><listitem>
<para>When a netId is provided, the data is sent to that specific client using remoteExec</para>
</listitem><listitem>
<para>The <computeroutput>_call</computeroutput> parameter determines whether the function is called directly (synchronous) or spawned (asynchronous)</para>
</listitem><listitem>
<para>This function is typically called by the scheduler or other core components rather than directly by user code</para>
</listitem><listitem>
<para>Each handler call is logged, which is useful for debugging data flow</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md93">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>dragonfly_db_fnc_scheduler</computeroutput>: Processes callbacks from the database extension</para>
</listitem><listitem>
<para><computeroutput>dragonfly_db_fnc_fetch</computeroutput>: Assembles data chunks for large datasets</para>
</listitem><listitem>
<para><computeroutput>dragonfly_db_fnc_addTask</computeroutput>: Adds tasks to the database operation queue</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md__g_1_2ids_2dragonfly_2docs_2core_2handler_1autotoc_md94">
<title>Links</title>
<para><link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2add_task">Add Task</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2handler">Handler</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2init">Init</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2print_addon_name">Print Addon Name</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2process_queue">Process Queue</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2scheduler">Scheduler</link> | <link linkend="_md__g_1_2ids_2dragonfly_2docs_2core_2test">Test</link> </para>
</section>
</section>
</section>
