From 7af88be16cb5c30f9bda6896003757c2fcbd6bf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 13 Jan 2022 10:44:39 +0100
Subject: [PATCH] Sql.Sql: Added query_db() to the API.

---
 lib/modules/Sql.pmod/Sql.pike | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/modules/Sql.pmod/Sql.pike b/lib/modules/Sql.pmod/Sql.pike
index 27cfe2660c..f28ff795fe 100644
--- a/lib/modules/Sql.pmod/Sql.pike
+++ b/lib/modules/Sql.pmod/Sql.pike
@@ -533,6 +533,12 @@ void select_db(string db)
   master_sql->select_db(db);
 }
 
+//! Get the currently selected db if possible.
+string query_db()
+{
+  return master_sql->query_db && master_sql->query_db();
+}
+
 //! Compiles the query (if possible). Otherwise returns it as is.
 //! The resulting object can be used multiple times to the query
 //! functions.
-- 
GitLab