dbcore
Vars | |
active_queries | List of currenty processing queries |
---|---|
connection | Connection handle. This is an arbitrary handle returned from rust_g. |
failed_connection_timeout | Timeout of failed connections |
failed_connections | Amount of failed connections |
last_error | Last error to occur |
schema_valid | Is the DB schema valid |
total_errors | SQL errors that have occured mid round |
Procs | |
CheckSchemaVersion | Schema Version Checker |
Connect | Connection Creator |
Disconnect | Disconnection Handler |
ErrorMsg | Error Message Helper |
IsConnected | IsConnected Helper |
MassExecute | Handler to allow many queries to be executed en masse |
NewQuery | New Query Invoker |
ReportError | Error Reporting Helper |
SetRoundEnd | Round End Time Setter |
SetRoundID | Round ID Setter |
SetRoundStart | Round End Time Setter |
Shutdown | Shutdown Handler |
Var Details
active_queries
List of currenty processing queries
connection
Connection handle. This is an arbitrary handle returned from rust_g.
failed_connection_timeout
Timeout of failed connections
failed_connections
Amount of failed connections
last_error
Last error to occur
schema_valid
Is the DB schema valid
total_errors
SQL errors that have occured mid round
Proc Details
CheckSchemaVersion
Schema Version Checker
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.
Connect
Connection Creator
This proc basically does a few sanity checks before connecting, then attempts to make a connection When connecting, RUST_G will initialize a thread pool for queries to use to run asynchronously
Disconnect
Disconnection Handler
Tells the DLL to clean up any open connections. This will also reset the failed connection counter
ErrorMsg
Error Message Helper
Returns the last error that the subsystem encountered. Will always report "Database disabled by configuration" if the DB is disabled.
IsConnected
IsConnected Helper
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
MassExecute
Handler to allow many queries to be executed en masse
Feed this proc a list of queries and it will execute them all at once, by the power of async magic!
Arguments:
- querys - List of queries to execute
- warn - Boolean to warn on query failure
- qdel - Boolean to enable auto qdel of queries
- assoc - Boolean to enable support for an associative list of queries
- log - Do we want to generate logs for these queries
NewQuery
New Query Invoker
Checks to make sure this query isnt being invoked by admin fuckery, then returns a new /datum/db_query
Arguments:
- sql_query - SQL query to be ran, with :parameter placeholders
- arguments - Associative list of parameters to be inserted into the query
ReportError
Error Reporting Helper
Pretty much just sets last_error
to the error argument
Arguments:
- error - Error text to set
last_error
to
SetRoundEnd
Round End Time Setter
Called during SSticker.declare_completion() Sets the time that the round ended in the DB, as well as some other params
SetRoundID
Round ID Setter
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
SetRoundStart
Round End Time Setter
Called during SSticker.setup() Sets the time that the round started in the DB
Shutdown
Shutdown Handler
Called during world/Reboot() as part of the MC shutdown Finalises a round in the DB before disconnecting.