ramdb/api/docbook/d1/d9f/md_docs_2basic_2get.xml
Jacob Schmidt ee1dd91b7f
All checks were successful
Build / Build (push) Successful in 40s
feat: Add documentation for fetch function
This commit adds documentation for the `ramdb_db_fnc_fetch` function. The documentation explains the function's purpose, which is to handle data chunks received from the database extension when data is too large to be returned in a single callback. The documentation includes a title, icon, and excerpt for better readability and understanding.
2025-03-30 17:16:31 -05:00

125 lines
5.1 KiB
XML

<?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_docs_2basic_2get" xml:lang="en-US">
<title>get</title>
<indexterm><primary>get</primary></indexterm>
<section xml:id="_md_docs_2basic_2get_1autotoc_md23">
<title>autotoc_md23</title>
<para>title: ArmaRAMDb - Get Key icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md24">
<title>excerpt: Get the value of stored key from RAMDb.</title></section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md25">
<title>ramdb_db_fnc_get</title><section xml:id="_md_docs_2basic_2get_1autotoc_md26">
<title>Description</title>
<para>Retrieves the value of a stored key from the database. This function performs an asynchronous request to the database and passes the retrieved data to the specified callback function.</para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md27">
<title>Syntax</title>
<para><literallayout><computeroutput>[_key,&#32;_function,&#32;_call,&#32;_netId]&#32;call&#32;ramdb_db_fnc_get
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md28">
<title>Parameters</title>
<para><informaltable frame="all">
<tgroup cols="3" align="left" colsep="1" rowsep="1">
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<thead>
<row class='markdownTableHead'>
<entry>
<para>Parameter </para>
</entry><entry>
<para>Type </para>
</entry><entry>
<para>Description </para>
</entry></row>
</thead><tbody>
<row class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_key</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>Name of the stored key to retrieve from the database </para>
</entry></row>
<row class='markdownTableRowEven'>
<entry>
<para><computeroutput>_function</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>Name of the function to call when data is retrieved </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></row>
<row class='markdownTableRowEven'>
<entry>
<para><computeroutput>_netId</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>(Optional) NetID of the player to whom the data should be returned </para>
</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md29">
<title>Return Value</title>
<para>None. When data is retrieved, it will be passed to the specified function. The operation runs asynchronously.</para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md30">
<title>Examples</title><section xml:id="_md_docs_2basic_2get_1autotoc_md31">
<title>Retrieve data in singleplayer or on the server:</title>
<para><literallayout><computeroutput>[getPlayerUID&#32;player,&#32;&quot;ramdb_db_fnc_test&quot;]&#32;call&#32;ramdb_db_fnc_get;
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md32">
<title>Retrieve data on the server and send to a specific client:</title>
<para><literallayout><computeroutput>[getPlayerUID&#32;player,&#32;&quot;ramdb_db_fnc_test&quot;,&#32;false,&#32;netId&#32;player]&#32;remoteExecCall&#32;[&quot;ramdb_db_fnc_get&quot;,&#32;2,&#32;false];
</computeroutput></literallayout></para>
</section>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md33">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>The function exit with an error if the key or function parameters are empty</para>
</listitem><listitem>
<para>Data is processed through the scheduler system, which manages callback responses</para>
</listitem><listitem>
<para>For large data that exceeds buffer limits, it will be automatically chunked and reassembled</para>
</listitem><listitem>
<para>The callback function must be defined to accept the retrieved data</para>
</listitem><listitem>
<para>The <computeroutput>_call</computeroutput> parameter determines whether the callback is executed directly or spawned in a separate thread</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md34">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>ramdb_db_fnc_set</computeroutput>: Stores a value by key</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_delete</computeroutput>: Removes a value by key</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_scheduler</computeroutput>: Processes the callback response</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2get_1autotoc_md35">
<title>Links</title>
<para><link linkend="_md_docs_2basic_2delete">Delete Key</link> | <link linkend="_md_docs_2basic_2get">Get Key</link> | <link linkend="_md_docs_2basic_2set">Set Key</link> </para>
</section>
</section>
</section>