d210adbf1a
* Add BSQL library v1.1.1.0 * Modify dbcore to use BSQL * Add missing QDEL_NULL for connectOperation * Moves BSQL_Shutdown() call to dbcore shutdown * Fix passing the wrong argument to DBQuery/New() * Darn it @Jordie0608. Fixes db calls without Connect check No seriously please make sure I'm not breaking anything * Queries with a null connection won't runtime * Fix quoting * Fix mistake * Update BSQL to v1.1.2.0 * Update BSQL DMAPI to v1.0.1.0 * Fix connection instatiation * Does the smart thing in regards to quoting * Fix braces * Update BSQL to 1.2.0.0. DMAPI to 1.1.0.0 * Execute/NextRow/MassInsert now have async parameter * Build BSQL for tests * Add missing apt source * Def still need gcc-multilib * Wut * Revert "Wut" This reverts commit d7c98a9a6b27f6db03e9f5cc534650d59d018048. * Try this then * Could it really be that simple? * Literally running out of ideas here * Update BSQL to v1.2.1.0 DMAPI to v1.1.1.0 * Update BSQL travis version * Nothing about this makes sense tbqhwyfam * Whoo boy * No idea why this isn't working tbh * Absolute madness * Ahhhhhhhhhhhhh * *deep breath* * "though yet again i was frustrated by failure" * Add BSQL to Dockerfile * Pass through MassInsert async param * BSQL to v1.3.0.0 DMAPI to 1.2.0.0 * Add timeout support * Wait, something's fucky * Wtf is this meme? * Just get good lmao * Just stop being shit lol * Stupid verbose logging * Remove verbosity * Good god * BSQL to v1.3.0.1 DMAPI to v1.2.0.1 * BSQL to v1.3.0.2 * Update BSQL travis version * Update BSQL docker version * Didn't mean to change that * Strip connection information from debug logs and make it configgable * Move this to where CONFIG_GET is defined
66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
/datum/BSQL_Connection
|
|
var/id
|
|
var/connection_type
|
|
|
|
BSQL_PROTECT_DATUM(/datum/BSQL_Connection)
|
|
|
|
/datum/BSQL_Connection/New(connection_type, asyncTimeout, blockingTimeout)
|
|
if(asyncTimeout == null)
|
|
asyncTimeout = BSQL_DEFAULT_TIMEOUT
|
|
if(blockingTimeout == null)
|
|
blockingTimeout = asyncTimeout
|
|
|
|
src.connection_type = connection_type
|
|
|
|
world._BSQL_InitCheck(src)
|
|
|
|
var/error = world._BSQL_Internal_Call("CreateConnection", connection_type, "[asyncTimeout]", "[blockingTimeout]")
|
|
if(error)
|
|
BSQL_ERROR(error)
|
|
return
|
|
|
|
id = world._BSQL_Internal_Call("GetConnection")
|
|
if(!id)
|
|
BSQL_ERROR("BSQL library failed to provide connect operation for connection id [id]([connection_type])!")
|
|
|
|
BSQL_DEL_PROC(/datum/BSQL_Connection)
|
|
var/error
|
|
if(id)
|
|
error = world._BSQL_Internal_Call("ReleaseConnection", id)
|
|
. = ..()
|
|
if(error)
|
|
BSQL_ERROR(error)
|
|
|
|
/datum/BSQL_Connection/BeginConnect(ipaddress, port, username, password, database)
|
|
var/error = world._BSQL_Internal_Call("OpenConnection", id, ipaddress, "[port]", username, password, database)
|
|
if(error)
|
|
BSQL_ERROR(error)
|
|
return
|
|
|
|
var/op_id = world._BSQL_Internal_Call("GetOperation")
|
|
if(!op_id)
|
|
BSQL_ERROR("Library failed to provide connect operation for connection id [id]([connection_type])!")
|
|
return
|
|
|
|
return new /datum/BSQL_Operation(src, op_id)
|
|
|
|
|
|
/datum/BSQL_Connection/BeginQuery(query)
|
|
var/error = world._BSQL_Internal_Call("NewQuery", id, query)
|
|
if(error)
|
|
BSQL_ERROR(error)
|
|
return
|
|
|
|
var/op_id = world._BSQL_Internal_Call("GetOperation")
|
|
if(!op_id)
|
|
BSQL_ERROR("Library failed to provide query operation for connection id [id]([connection_type])!")
|
|
return
|
|
|
|
return new /datum/BSQL_Operation/Query(src, op_id)
|
|
|
|
/datum/BSQL_Connection/Quote(str)
|
|
if(!str)
|
|
return null;
|
|
. = world._BSQL_Internal_Call("QuoteString", id, "[str]")
|
|
if(!.)
|
|
BSQL_ERROR("Library failed to provide quote for [str]!") |