mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 01:57:01 +00:00
BSQL to v1.4.0.0 DMAPI to v1.3.0.0
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
//BSQL - DMAPI v1.2.0.1
|
//BSQL - DMAPI
|
||||||
|
#define BSQL_VERSION "v1.3.0.0"
|
||||||
|
|
||||||
//types of connections
|
//types of connections
|
||||||
#define BSQL_CONNECTION_TYPE_MARIADB "MySql"
|
#define BSQL_CONNECTION_TYPE_MARIADB "MySql"
|
||||||
#define BSQL_CONNECTION_TYPE_SQLSERVER "SqlServer"
|
#define BSQL_CONNECTION_TYPE_SQLSERVER "SqlServer"
|
||||||
|
|
||||||
#define BSQL_DEFAULT_TIMEOUT 5
|
#define BSQL_DEFAULT_TIMEOUT 5
|
||||||
|
#define BSQL_DEFAULT_THREAD_LIMIT 50
|
||||||
|
|
||||||
//Call this before rebooting or shutting down your world to clean up gracefully. This invalidates all active connection and operation datums
|
//Call this before rebooting or shutting down your world to clean up gracefully. This invalidates all active connection and operation datums
|
||||||
/world/proc/BSQL_Shutdown()
|
/world/proc/BSQL_Shutdown()
|
||||||
@@ -22,8 +24,9 @@ Create a new database connection, does not perform the actual connect
|
|||||||
connection_type: The BSQL connection_type to use
|
connection_type: The BSQL connection_type to use
|
||||||
asyncTimeout: The timeout to use for normal operations, 0 for infinite, defaults to BSQL_DEFAULT_TIMEOUT
|
asyncTimeout: The timeout to use for normal operations, 0 for infinite, defaults to BSQL_DEFAULT_TIMEOUT
|
||||||
blockingTimeout: The timeout to use for blocking operations, must be less than or equal to asyncTimeout, 0 for infinite, defaults to asyncTimeout
|
blockingTimeout: The timeout to use for blocking operations, must be less than or equal to asyncTimeout, 0 for infinite, defaults to asyncTimeout
|
||||||
|
threadLimit: The limit of additional threads BSQL will run simultaneously, defaults to BSQL_DEFAULT_THREAD_LIMIT
|
||||||
*/
|
*/
|
||||||
/datum/BSQL_Connection/New(connection_type, asyncTimeout, blockingTimeout)
|
/datum/BSQL_Connection/New(connection_type, asyncTimeout, blockingTimeout, threadLimit)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,17 +4,19 @@
|
|||||||
|
|
||||||
BSQL_PROTECT_DATUM(/datum/BSQL_Connection)
|
BSQL_PROTECT_DATUM(/datum/BSQL_Connection)
|
||||||
|
|
||||||
/datum/BSQL_Connection/New(connection_type, asyncTimeout, blockingTimeout)
|
/datum/BSQL_Connection/New(connection_type, asyncTimeout, blockingTimeout, threadLimit)
|
||||||
if(asyncTimeout == null)
|
if(asyncTimeout == null)
|
||||||
asyncTimeout = BSQL_DEFAULT_TIMEOUT
|
asyncTimeout = BSQL_DEFAULT_TIMEOUT
|
||||||
if(blockingTimeout == null)
|
if(blockingTimeout == null)
|
||||||
blockingTimeout = asyncTimeout
|
blockingTimeout = asyncTimeout
|
||||||
|
if(threadLimit == null)
|
||||||
|
threadLimit = BSQL_DEFAULT_THREAD_LIMIT
|
||||||
|
|
||||||
src.connection_type = connection_type
|
src.connection_type = connection_type
|
||||||
|
|
||||||
world._BSQL_InitCheck(src)
|
world._BSQL_InitCheck(src)
|
||||||
|
|
||||||
var/error = world._BSQL_Internal_Call("CreateConnection", connection_type, "[asyncTimeout]", "[blockingTimeout]")
|
var/error = world._BSQL_Internal_Call("CreateConnection", connection_type, "[asyncTimeout]", "[blockingTimeout]", "[threadLimit]")
|
||||||
if(error)
|
if(error)
|
||||||
BSQL_ERROR(error)
|
BSQL_ERROR(error)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -17,6 +17,12 @@
|
|||||||
BSQL_ERROR("Could not find [libPath]!")
|
BSQL_ERROR("Could not find [libPath]!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
var/version = _BSQL_Internal_Call("Version")
|
||||||
|
if(version != BSQL_VERSION)
|
||||||
|
BSQL_DEL_CALL(caller)
|
||||||
|
BSQL_ERROR("BSQL DMAPI version mismatch! Expected [BSQL_VERSION], got [version == null ? "NULL" : version]!")
|
||||||
|
return
|
||||||
|
|
||||||
var/result = _BSQL_Internal_Call("Initialize")
|
var/result = _BSQL_Internal_Call("Initialize")
|
||||||
if(result)
|
if(result)
|
||||||
BSQL_DEL_CALL(caller)
|
BSQL_DEL_CALL(caller)
|
||||||
|
|||||||
Reference in New Issue
Block a user