From 5e2eb7d67ae933b7566f1944d0bb7744da03d586 Mon Sep 17 00:00:00 2001 From: aura Date: Tue, 17 Feb 2026 23:42:09 +0100 Subject: move source stuff to its own folder --- .../scripting/gokz-localdb/db/setup_map_courses.sp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 source/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp (limited to 'source/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp') diff --git a/source/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp b/source/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp new file mode 100644 index 0000000..69bb89e --- /dev/null +++ b/source/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp @@ -0,0 +1,45 @@ +/* + Inserts the map's courses into the database. +*/ + + + +void DB_SetupMapCourses() +{ + char query[512]; + + Transaction txn = SQL_CreateTransaction(); + + for (int course = 0; course < GOKZ_MAX_COURSES; course++) + { + if (!GOKZ_GetCourseRegistered(course)) + { + continue; + } + + switch (g_DBType) + { + case DatabaseType_SQLite:FormatEx(query, sizeof(query), sqlite_mapcourses_insert, gI_DBCurrentMapID, course); + case DatabaseType_MySQL:FormatEx(query, sizeof(query), mysql_mapcourses_insert, gI_DBCurrentMapID, course); + } + txn.AddQuery(query); + } + + SQL_ExecuteTransaction(gH_DB, txn, INVALID_FUNCTION, DB_TxnFailure_Generic, _, DBPrio_High); +} + +void DB_SetupMapCourse(int course) +{ + char query[512]; + + Transaction txn = SQL_CreateTransaction(); + + switch (g_DBType) + { + case DatabaseType_SQLite:FormatEx(query, sizeof(query), sqlite_mapcourses_insert, gI_DBCurrentMapID, course); + case DatabaseType_MySQL:FormatEx(query, sizeof(query), mysql_mapcourses_insert, gI_DBCurrentMapID, course); + } + txn.AddQuery(query); + + SQL_ExecuteTransaction(gH_DB, txn, INVALID_FUNCTION, DB_TxnFailure_Generic, _, DBPrio_High); +} \ No newline at end of file -- cgit v1.2.3