mirror of
https://github.com/anope/anope.git
synced 2026-07-07 21:23:13 +02:00
BUILD : 1.7.15 (1138) BUGS : 585 NOTES : Another attempt at fixing db_mysql_query()
git-svn-id: svn://svn.anope.org/anope/trunk@1138 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@861 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
fee55f4516
commit
d222e75a6d
@@ -2,7 +2,7 @@ Anope Version S V N
|
||||
--------------------
|
||||
Provided by Anope Dev. <dev@anope.org> - 2006
|
||||
08/09 F Fixed port checking when using command line switches. [#575]
|
||||
08/14 F Fixed db_mysql_query for better robustness. [ #00]
|
||||
08/14 F Fixed db_mysql_query for better robustness. [#585]
|
||||
|
||||
Provided by Trystan <trystan@nomadirc.net> - 2006
|
||||
08/20 F Fixed several compiler warnings. [#586]
|
||||
|
||||
+14
-30
@@ -121,11 +121,12 @@ int db_mysql_open()
|
||||
|
||||
int db_mysql_query(char *sql)
|
||||
{
|
||||
int result, lcv;
|
||||
int lcv;
|
||||
char *s;
|
||||
|
||||
if (!do_mysql) {
|
||||
return -1;
|
||||
/* Error is 1 */
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
@@ -138,43 +139,26 @@ int db_mysql_query(char *sql)
|
||||
/* Try as many times as configured in MysqlRetries */
|
||||
for (lcv = 0; lcv < MysqlRetries; lcv++) {
|
||||
|
||||
if (db_mysql_open()) {
|
||||
if (db_mysql_open() && (!mysql_query(mysql, sql))) {
|
||||
|
||||
/* Success is 0 */
|
||||
return 0;
|
||||
|
||||
/* Attempt to run query */
|
||||
result = mysql_query(mysql, sql);
|
||||
if (result) {
|
||||
switch (mysql_errno(mysql)) {
|
||||
case CR_COMMANDS_OUT_OF_SYNC:
|
||||
case CR_SERVER_GONE_ERROR:
|
||||
case CR_UNKNOWN_ERROR:
|
||||
case CR_SERVER_LOST:
|
||||
|
||||
/* If we get here, we could not run the query */
|
||||
log_perror("Unable to run query: %s\n",
|
||||
mysql_error(mysql));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Success... return result */
|
||||
return (result);
|
||||
|
||||
}
|
||||
} else {
|
||||
/* Non-error */
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we get here, we could not run the query */
|
||||
log_perror("Unable to run query: %s\n", mysql_error(mysql));
|
||||
|
||||
/* Wait for MysqlRetryGap seconds and try again */
|
||||
sleep(MysqlRetryGap);
|
||||
|
||||
}
|
||||
|
||||
/* Unable to run the query */
|
||||
db_mysql_error(MYSQL_ERROR, "query");
|
||||
|
||||
return (0);
|
||||
/* Error is 1 */
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
@@ -255,7 +239,7 @@ char *db_mysql_secure(char *pass)
|
||||
}
|
||||
#else
|
||||
|
||||
if (!pass) {
|
||||
if (pass) {
|
||||
snprintf(epass, sizeof(epass), "''");
|
||||
} else if ((!MysqlSecure) || (strcmp(MysqlSecure, "") == 0)) {
|
||||
snprintf(epass, sizeof(epass), "'%s'", pass);
|
||||
|
||||
+5
-1
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
|
||||
VERSION_MINOR="7"
|
||||
VERSION_PATCH="15"
|
||||
VERSION_EXTRA="-svn"
|
||||
VERSION_BUILD="1137"
|
||||
VERSION_BUILD="1138"
|
||||
|
||||
# $Log$
|
||||
#
|
||||
# BUILD : 1.7.15 (1138)
|
||||
# BUGS : 585
|
||||
# NOTES : Another attempt at fixing db_mysql_query()
|
||||
#
|
||||
# BUILD : 1.7.15 (1137)
|
||||
# BUGS : n/a
|
||||
# NOTES : Another try at better mysql query.
|
||||
|
||||
Reference in New Issue
Block a user