summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-09-10 17:10:24 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-09-10 17:10:24 +0000
commitafb6d55cc032817d25d32a1979a2a3eea4bf93d4 (patch)
tree27e82a7a36ec1ab2be97f6e2fc9e1e81b52dbc97
parent517b4b0629c5c28a49860e14662bd10b6cfba28f (diff)
BUILD : 1.7.15 (1150) BUGS : 595 NOTES : Fixed MySQL making a new connection for each query (bit TOO enthousiastic?)
git-svn-id: svn://svn.anope.org/anope/trunk@1150 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@873 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--src/mysql.c15
-rw-r--r--version.log6
3 files changed, 19 insertions, 3 deletions
diff --git a/Changes b/Changes
index 106b58866..3aa932800 100644
--- a/Changes
+++ b/Changes
@@ -8,6 +8,7 @@ Provided by Anope Dev. <dev@anope.org> - 2006
09/10 F Issues with make strict for the src/tools dir. [#579]
09/10 F Help for NickServ SET AUTOOP was missing. [#587]
09/10 F Added HOP to the /CS ACCESS error when XOP is enabled. [#598]
+09/10 F MySQL no longer connects again on each query. [#595]
Provided by Trystan <trystan@nomadirc.net> - 2006
08/20 F Fixed several compiler warnings. [#586]
diff --git a/src/mysql.c b/src/mysql.c
index c7dfc8fbe..0dcdf95df 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -22,6 +22,8 @@ MYSQL_RES *mysql_res; /* MySQL Result */
MYSQL_FIELD *mysql_fields; /* MySQL Fields */
MYSQL_ROW mysql_row; /* MySQL Row */
+int mysql_is_connected = 0; /* Are we currently connected? */
+
/*************************************************************************/
void db_mysql_error(int severity, char *msg)
@@ -87,7 +89,11 @@ int db_mysql_open()
/* If MySQL is disabled, return 0 */
if (!do_mysql)
return 0;
-
+
+ /* If we're already connected, return 1 */
+ if (mysql_is_connected)
+ return 1;
+
mysql = mysql_init(NULL);
if (mysql == NULL)
db_mysql_error(MYSQL_WARNING, "Unable to create mysql object");
@@ -112,7 +118,9 @@ int db_mysql_open()
return 0;
}
}
-
+
+ mysql_is_connected = 1;
+
return 1;
}
@@ -190,6 +198,9 @@ int db_mysql_close()
if (mysql_res)
mysql_free_result(mysql_res);
mysql_close(mysql);
+
+ mysql_is_connected = 0;
+
return 1;
}
diff --git a/version.log b/version.log
index 4151a6460..de77abe64 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="15"
VERSION_EXTRA="-svn"
-VERSION_BUILD="1149"
+VERSION_BUILD="1150"
# $Log$
#
+# BUILD : 1.7.15 (1150)
+# BUGS : 595
+# NOTES : Fixed MySQL making a new connection for each query (bit TOO enthousiastic?)
+#
# BUILD : 1.7.15 (1149)
# BUGS : 598
# NOTES : Added HOP to the list of XOP commands in the error from ChanServ ACCESS when XOP is enabled on supported ircds (and that line is too long!)