Creates a connection based on details in the config file </intro/config-file>
in accounts.<configName>
Note
Connection is not established until the first query.
- configName
<STRING>
- The config name of the connection
Attention
configName is case-sensitive
Returns: <DBConnection>
Creates a connection.
Note
Connection is not established until the first query.
- ip
<STRING>
- the IP Address or Domain of the database server- port
<NUMBER>
- the port of the database server (usually 3306)- user
<STRING>
- the user to log in with- pw
<STRING>
- the password (duh)- db
<STRING>
- the database to use (Equal to use <db> SQL command)
Returns: <DBConnection>
Also checks if a worker thread is connected.
- connection
<DBCONNECTION>
- A connection
Returns: <BOOL>
SELECT 1;
on the database server and returns true if it get's 1 back. Returns false on error.Suspends in scheduled, freezes in unscheduled.
(Should this return the actual error string somehow?, Should this call error handlers?)
- connection
<DBCONNECTION>
- A connection
Returns: <BOOL>
_this = [errorString, errorCode, query]
.There can be multiple error handlers, they will be executed from first to last added.
If one of the error handlers returns
true
the error will be considered handled and the other handlers won't be called.If error handlers are present, errors won't be printed to RPT.
Example _this:
["Lost connection to MySQL server at 'reading authorization packet', system error: 10061",2013,"testQuery5"]
["You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'testQuery5' at line 1",1064,"testQuery5"]
["Unknown column 'none' in 'field list'",1054,"SELECT none"]
#TODO add the query config name to _this too.
Error codes are explained on
config file </api/errors>
- connection
<DBCONNECTION>
- A connection- code
<CODE>
- Script code.
Returns: <NOTHING>
Executes a SQL file. Path is defined in config.
- connection
<DBCONNECTION>
- A connection- schemaName
<STRING>
- schema name from config.
Attention
schemaName is case-sensitive
Returns: <NOTHING>