Merge pull request #220 from Petethegoat/sqlerrors

Removes some redundant variables relating to SQL. Updates the config to ...
This commit is contained in:
Cael Aislinn
2013-04-04 16:32:02 -07:00
6 changed files with 23 additions and 35 deletions

View File

@@ -373,8 +373,6 @@
sqlfdbklogin = value
if("feedback_password")
sqlfdbkpass = value
if("enable_stat_tracking")
sqllogging = 1
else
diary << "Unknown setting in configuration: '[name]'"

View File

@@ -56,7 +56,7 @@ DBConnection/New(dbi_handler,username,password_handler,cursor_handler)
_db_con = _dm_db_new_con()
DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler)
if(!sqllogging)
if(!config.sql_enabled)
return 0
if(!src) return 0
cursor_handler = src.default_cursor
@@ -66,7 +66,7 @@ DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_han
DBConnection/proc/Disconnect() return _dm_db_close(_db_con)
DBConnection/proc/IsConnected()
if(!sqllogging) return 0
if(!config.sql_enabled) return 0
var/success = _dm_db_is_connected(_db_con)
return success

View File

@@ -1,5 +1,5 @@
proc/sql_poll_players()
if(!sqllogging)
if(!config.sql_enabled)
return
var/playercount = 0
for(var/mob/M in player_list)
@@ -17,7 +17,7 @@ proc/sql_poll_players()
proc/sql_poll_admins()
if(!sqllogging)
if(!config.sql_enabled)
return
var/admincount = admins.len
establish_db_connection()
@@ -32,16 +32,16 @@ proc/sql_poll_admins()
proc/sql_report_round_start()
// TODO
if(!sqllogging)
if(!config.sql_enabled)
return
proc/sql_report_round_end()
// TODO
if(!sqllogging)
if(!config.sql_enabled)
return
proc/sql_report_death(var/mob/living/carbon/human/H)
if(!sqllogging)
if(!config.sql_enabled)
return
if(!H)
return
@@ -76,7 +76,7 @@ proc/sql_report_death(var/mob/living/carbon/human/H)
proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H)
if(!sqllogging)
if(!config.sql_enabled)
return
if(!H)
return
@@ -111,7 +111,7 @@ proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H)
proc/statistic_cycle()
if(!sqllogging)
if(!config.sql_enabled)
return
while(1)
sql_poll_players()

View File

@@ -171,22 +171,14 @@ var/list/hit_appends = list("-OOF", "-ACK", "-UGH", "-HRNK", "-HURGH", "-GLORF")
var/sqladdress = "localhost"
var/sqlport = "3306"
var/sqldb = "tgstation"
var/sqllogin = "root"
var/sqlpass = ""
// Feedback gathering sql connection
var/sqlfdbkdb = "test"
var/sqlfdbklogin = "root"
var/sqlfdbkpass = ""
var/sqllogging = 0 // Should we log deaths, population stats, etc?
// For FTP requests. (i.e. downloading runtime logs.)
// However it'd be ok to use for accessing attack logs and such too, which are even laggier.
var/fileaccess_timer = 0
//Database connections
//A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.).
var/DBConnection/dbcon = new() //Feedback database (New database)
var/DBConnection/dbcon = new() //Feedback database (New database)

View File

@@ -268,7 +268,7 @@ var/failed_db_connections = 0
proc/setup_database_connection()
if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore.
if(failed_db_connections >= FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect anymore.
return 0
if(!dbcon)
@@ -286,7 +286,8 @@ proc/setup_database_connection()
failed_db_connections = 0 //If this connection succeeded, reset the failed connections counter.
else
failed_db_connections++ //If it failed, increase the failed connections counter.
world.log << "SQL error: " + dbcon.ErrorMsg()
if(config.sql_enabled)
world.log << "SQL error: " + dbcon.ErrorMsg()
return .

View File

@@ -1,25 +1,22 @@
# MySQL Connection Configuration
# This is used for stats, feedback gathering,
# administration, and the in game library.
## MySQL Connection Configuration
## This is used for stats, feedback gathering,
## administration, and the in game library.
# Should SQL be enabled? Uncomment to enable.
## Should SQL be enabled? Uncomment to enable.
#SQL_ENABLED
# Server the MySQL database can be found at.
## Server the MySQL database can be found at.
# Examples: localhost, 200.135.5.43, www.mysqldb.com, etc.
ADDRESS localhost
# MySQL server port (default is 3306).
## MySQL server port (default is 3306).
PORT 3306
# Database for all SQL functions, not just feedback.
## Database for all SQL functions, not just feedback.
FEEDBACK_DATABASE feedback
# Username/Login used to access the database.
## Username/Login used to access the database.
FEEDBACK_LOGIN username
# Password used to access the database.
FEEDBACK_PASSWORD password
# Comment out to disable tracking of population and death statistics.
ENABLE_STAT_TRACKING
## Password used to access the database.
FEEDBACK_PASSWORD password