Re-enables roundid creation again (#7754)

Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
Selis
2024-02-16 11:55:18 +01:00
committed by GitHub
parent 615004fb01
commit 2f61a0c7f8
2 changed files with 16 additions and 13 deletions

View File

@@ -14,12 +14,17 @@
*/
// Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts.
/proc/sanitizeSQL(var/t as text)
/proc/sanitizeSQL(var/t as text)
//var/sqltext = dbcon.Quote(t); //CHOMPEdit Begin
//return copytext(sqltext, 2, length(sqltext));//Quote() adds quotes around input, we already do that
return t
//CHOMPEdit End
// CHOMPEdit - Adds format_table_name
/proc/format_table_name(table as text)
//return CONFIG_GET(string/feedback_tableprefix) + table
return table // We don't implement tableprefix
/*
* Text sanitization
*/

View File

@@ -150,13 +150,14 @@ SUBSYSTEM_DEF(dbcore)
UNTIL(query.process())
queries_active -= query
/*var/datum/db_query/query_round_shutdown = SSdbcore.NewQuery(
var/datum/db_query/query_round_shutdown = SSdbcore.NewQuery(
"UPDATE [format_table_name("round")] SET shutdown_datetime = Now(), end_state = :end_state WHERE id = :round_id",
list("end_state" = SSticker.end_state, "round_id" = GLOB.round_id),
//list("end_state" = SSticker.end_state, "round_id" = GLOB.round_id),
list("end_state" = "undefined", "round_id" = GLOB.round_id), // FIXME: end_state does not exist on ticker
TRUE
)*/
//query_round_shutdown.Execute(FALSE)
//qdel(query_round_shutdown)
)
query_round_shutdown.Execute(FALSE)
qdel(query_round_shutdown)
log_debug("Done clearing DB queries standby:[length(queries_standby)] active: [length(queries_active)] all: [length(all_queries)]")
if(IsConnected())
@@ -247,20 +248,18 @@ SUBSYSTEM_DEF(dbcore)
if(!Connect())
return
var/datum/db_query/query_round_initialize = SSdbcore.NewQuery(
//"INSERT INTO [format_table_name("round")] (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
"INSERT INTO round (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
"INSERT INTO [format_table_name("round")] (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
list("internet_address" = world.internet_address || "0", "port" = "[world.port]")
)
query_round_initialize.Execute(async = FALSE)
//GLOB.round_id = "[query_round_initialize.last_insert_id]"
GLOB.round_id = "[query_round_initialize.last_insert_id]"
qdel(query_round_initialize)
/datum/controller/subsystem/dbcore/proc/SetRoundStart()
if(!Connect())
return
var/datum/db_query/query_round_start = SSdbcore.NewQuery(
//"UPDATE [format_table_name("round")] SET start_datetime = Now() WHERE id = :round_id",
"UPDATE round SET start_datetime = Now() WHERE id = :round_id",
"UPDATE [format_table_name("round")] SET start_datetime = Now() WHERE id = :round_id",
list("round_id" = GLOB.round_id)
)
query_round_start.Execute()
@@ -270,8 +269,7 @@ SUBSYSTEM_DEF(dbcore)
if(!Connect())
return
var/datum/db_query/query_round_end = SSdbcore.NewQuery(
//"UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
"UPDATE round SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
"UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
//list("game_mode_result" = SSticker.mode_result, "station_name" = station_name(), "round_id" = GLOB.round_id)
list("game_mode_result" = "extended", "station_name" = station_name(), "round_id" = GLOB.round_id) // FIXME: temporary solution as we only use extended so far
)