Files

39 lines
13 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../../"><link rel="stylesheet" href="dmdoc.css"><title>/datum/controller/subsystem/dbcore - Space Station 13</title></head><body><header><a href="index.html">Space Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a><a href="datum/controller/subsystem/dbcore.html#var">Var Details</a> - <a href="datum/controller/subsystem/dbcore.html#proc">Proc Details</a></header><main><h1>dbcore <aside>/<a href="datum.html">datum</a>/<a href="datum/controller.html">controller</a>/<a href="datum/controller/subsystem.html">subsystem</a>/<a href="datum/controller/subsystem/dbcore.html">dbcore</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L1"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 1"></a></h1><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/active_queries">active_queries</a></th><td>List of currenty processing queries</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/connection">connection</a></th><td>Connection handle. This is an arbitrary handle returned from rustlibs.</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/failed_connection_timeout">failed_connection_timeout</a></th><td>Timeout of failed connections</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/failed_connections">failed_connections</a></th><td>Amount of failed connections</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/last_error">last_error</a></th><td>Last error to occur</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/schema_valid">schema_valid</a></th><td>Is the DB schema valid</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#var/total_errors">total_errors</a></th><td>SQL errors that have occured mid round</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/CheckSchemaVersion">CheckSchemaVersion</a></th><td>Schema Version Checker</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/Connect">Connect</a></th><td>Connection Creator</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/Disconnect">Disconnect</a></th><td>Disconnection Handler</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/ErrorMsg">ErrorMsg</a></th><td>Error Message Helper</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/IsConnected">IsConnected</a></th><td>IsConnected Helper</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/MassExecute">MassExecute</a></th><td>Handler to allow many queries to be executed en masse</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/NewQuery">NewQuery</a></th><td>New Query Invoker</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/ReportError">ReportError</a></th><td>Error Reporting Helper</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/SetRoundEnd">SetRoundEnd</a></th><td>Round End Time Setter</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/SetRoundID">SetRoundID</a></th><td>Round ID Setter</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/SetRoundStart">SetRoundStart</a></th><td>Round End Time Setter</td></tr><tr><th><a href="datum/controller/subsystem/dbcore.html#proc/Shutdown">Shutdown</a></th><td>Shutdown Handler</td></tr></table><h2 id="var">Var Details</h2><h3 id="var/active_queries"><aside class="declaration">var </aside>active_queries <aside> /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L18"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 18"></a></h3><p>List of currenty processing queries</p><h3 id="var/connection"><aside class="declaration">var </aside>connection <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L24"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 24"></a></h3><p>Connection handle. This is an arbitrary handle returned from rustlibs.</p><h3 id="var/failed_connection_timeout"><aside class="declaration">var </aside>failed_connection_timeout <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L11"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 11"></a></h3><p>Timeout of failed connections</p><h3 id="var/failed_connections"><aside class="declaration">var </aside>failed_connections <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L13"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 13"></a></h3><p>Amount of failed connections</p><h3 id="var/last_error"><aside class="declaration">var </aside>last_error <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L16"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 16"></a></h3><p>Last error to occur</p><h3 id="var/schema_valid"><aside class="declaration">var </aside>schema_valid <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L9"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 9"></a></h3><p>Is the DB schema valid</p><h3 id="var/total_errors"><aside class="declaration">var </aside>total_errors <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L21"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 21"></a></h3><p>SQL errors that have occured mid round</p><h2 id="proc">Proc Details</h2><h3 id="proc/CheckSchemaVersion"><aside class="declaration">proc </aside>CheckSchemaVersion<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L108"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 108"></a></aside></h3><p>Schema Version Checker</p>
<p>Basically verifies that the DB schema in the config is the same as the version the game is expecting.
If it is a valid version, the DB will then connect.</p><h3 id="proc/Connect"><aside class="declaration">proc </aside>Connect<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L65"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 65"></a></aside></h3><p>Connection Creator</p>
<p>This proc basically does a few sanity checks before connecting, then attempts to make a connection
When connecting, rustlibs will initialize a thread pool for queries to use to run asynchronously</p><h3 id="proc/Disconnect"><aside class="declaration">proc </aside>Disconnect<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L133"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 133"></a></aside></h3><p>Disconnection Handler</p>
<p>Tells the DLL to clean up any open connections.
This will also reset the failed connection counter</p><h3 id="proc/ErrorMsg"><aside class="declaration">proc </aside>ErrorMsg<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L249"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 249"></a></aside></h3><p>Error Message Helper</p>
<p>Returns the last error that the subsystem encountered.
Will always report &quot;Database disabled by configuration&quot; if the DB is disabled.</p><h3 id="proc/IsConnected"><aside class="declaration">proc </aside>IsConnected<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L221"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 221"></a></aside></h3><p>IsConnected Helper</p>
<p>Short helper to check if the DB is connected or not.
Does a few sanity checks, then asks the DLL if we are properly connected</p><h3 id="proc/MassExecute"><aside class="declaration">proc </aside>MassExecute<aside>(/list/querys, warn, qdel, assoc, log) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L295"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 295"></a></aside></h3><p>Handler to allow many queries to be executed en masse</p>
<p>Feed this proc a list of queries and it will execute them all at once, by the power of async magic!</p>
<p>Arguments:</p>
<ul>
<li>querys - List of queries to execute</li>
<li>warn - Boolean to warn on query failure</li>
<li>qdel - Boolean to enable auto qdel of queries</li>
<li>assoc - Boolean to enable support for an associative list of queries</li>
<li>log - Do we want to generate logs for these queries</li>
</ul><h3 id="proc/NewQuery"><aside class="declaration">proc </aside>NewQuery<aside>(sql_query, arguments) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L275"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 275"></a></aside></h3><p>New Query Invoker</p>
<p>Checks to make sure this query isnt being invoked by admin fuckery, then returns a new <a href="datum/db_query.html" title="/datum/db_query">/datum/db_query</a></p>
<p>Arguments:</p>
<ul>
<li>sql_query - SQL query to be ran, with :parameter placeholders</li>
<li>arguments - Associative list of parameters to be inserted into the query</li>
</ul><h3 id="proc/ReportError"><aside class="declaration">proc </aside>ReportError<aside>(error) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L262"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 262"></a></aside></h3><p>Error Reporting Helper</p>
<p>Pretty much just sets <code>last_error</code> to the error argument</p>
<p>Arguments:</p>
<ul>
<li>error - Error text to set <code>last_error</code> to</li>
</ul><h3 id="proc/SetRoundEnd"><aside class="declaration">proc </aside>SetRoundEnd<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L205"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 205"></a></aside></h3><p>Round End Time Setter</p>
<p>Called during SSticker.declare_completion()
Sets the time that the round ended in the DB, as well as some other params</p><h3 id="proc/SetRoundID"><aside class="declaration">proc </aside>SetRoundID<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L172"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 172"></a></aside></h3><p>Round ID Setter</p>
<p>Called during world/New() at the earliest point
Declares a round ID in the database and assigns it to a global. Also ensures that server address and ports are set</p><h3 id="proc/SetRoundStart"><aside class="declaration">proc </aside>SetRoundStart<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L189"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 189"></a></aside></h3><p>Round End Time Setter</p>
<p>Called during SSticker.setup()
Sets the time that the round started in the DB</p><h3 id="proc/Shutdown">Shutdown<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/controllers/subsystem/SSdbcore.dm#L154"><img src="git.png" width="16" height="16" title="code/controllers/subsystem/SSdbcore.dm 154"></a></aside></h3><p>Shutdown Handler</p>
<p>Called during world/Reboot() as part of the MC shutdown
Finalises a round in the DB before disconnecting.</p></main><footer>paradise.dme <a href="https://github.com/ParadiseSS13/Paradise/tree/8a8a00a2a9bec485351e5f219982b7315d3504fa">8a8a00a</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.11.0</a></footer></body></html>