summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
committernavewindre <nw@moneybot.cc>2023-12-04 18:06:10 +0100
commitaef0d1c1268ab7d4bc18996c9c6b4da16a40aadc (patch)
tree43e766b51704f4ab8b383583bdc1871eeeb9c698 /sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp
parent38f1140c11724da05a23a10385061200b907cf6e (diff)
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp')
-rw-r--r--sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp45
1 files changed, 45 insertions, 0 deletions
diff --git a/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp b/sourcemod/scripting/gokz-localdb/db/setup_map_courses.sp
new file mode 100644
index 0000000..69bb89e
--- /dev/null
+++ b/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