ramdb/api/docbook/d8/d05/md_docs_2basic_2fetch.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

141 lines
5.2 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_2fetch" xml:lang="en-US">
<title>fetch</title>
<indexterm><primary>fetch</primary></indexterm>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md13">
<title>autotoc_md13</title>
<para>title: ArmaRAMDb - Fetch icon: mdi:file-text-outline </para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md14">
<title>excerpt: Handles data chunks received from the database extension when data is too large to be returned in a single callback.</title></section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md15">
<title>ramdb_db_fnc_fetch</title><section xml:id="_md_docs_2basic_2fetch_1autotoc_md16">
<title>Description</title>
<para>Handles data chunks received from the database extension when data is too large to be returned in a single callback. This function collects all chunks of data, reassembles them in the correct order, and then passes the complete data to the handler function.</para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md17">
<title>Syntax</title>
<para><literallayout><computeroutput>[_uniqueID,&#32;_function,&#32;_index,&#32;_total,&#32;_datachunk,&#32;_call,&#32;_netId]&#32;call&#32;ramdb_db_fnc_fetch
</computeroutput></literallayout></para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md18">
<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>_uniqueID</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>Unique identifier for this data fetch operation </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 after data is assembled </para>
</entry></row>
<row class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_index</computeroutput> </para>
</entry><entry>
<para>Number </para>
</entry><entry>
<para>Current chunk index (0-based) </para>
</entry></row>
<row class='markdownTableRowEven'>
<entry>
<para><computeroutput>_total</computeroutput> </para>
</entry><entry>
<para>Number </para>
</entry><entry>
<para>Total number of chunks expected </para>
</entry></row>
<row class='markdownTableRowOdd'>
<entry>
<para><computeroutput>_datachunk</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>The chunk of data being received </para>
</entry></row>
<row class='markdownTableRowEven'>
<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='markdownTableRowOdd'>
<entry>
<para><computeroutput>_netId</computeroutput> </para>
</entry><entry>
<para>String </para>
</entry><entry>
<para>(Optional) NetID of the player to whom the data belongs </para>
</entry></row>
</tbody>
</tgroup>
</informaltable>
</para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md19">
<title>Return Value</title>
<para>None. When all chunks are received, the function will:<orderedlist>
<listitem>
<para>Assemble the complete data string</para>
</listitem><listitem>
<para>Parse it as a simple array</para>
</listitem><listitem>
<para>Call the specified handler function with the parsed data</para>
</listitem></orderedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md20">
<title>Examples</title>
<para>This function is typically not called directly but is triggered by the extension&apos;s callback mechanism when large datasets are retrieved.</para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md21">
<title>Notes</title>
<para><itemizedlist>
<listitem>
<para>The function stores received chunks in the global array <computeroutput>ramdb_db_fetch_array</computeroutput></para>
</listitem><listitem>
<para>Chunks are sorted by their index to ensure correct assembly regardless of arrival order</para>
</listitem><listitem>
<para>After successful processing, the chunks for this uniqueID are removed from the array</para>
</listitem><listitem>
<para>This function is essential for handling large datasets that exceed the callback buffer limit</para>
</listitem></itemizedlist>
</para>
</section>
<section xml:id="_md_docs_2basic_2fetch_1autotoc_md22">
<title>Related Functions</title>
<para><itemizedlist>
<listitem>
<para><computeroutput>ramdb_db_fnc_handler</computeroutput>: Receives the assembled data and routes it to the appropriate function</para>
</listitem><listitem>
<para><computeroutput>ramdb_db_fnc_scheduler</computeroutput>: Manages the callback queue and triggers data fetching </para>
</listitem></itemizedlist>
</para>
</section>
</section>
</section>