[svn-commits] tilghman: trunk r212883 - /trunk/addons/res_config_mysql.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 18 14:49:56 CDT 2009


Author: tilghman
Date: Tue Aug 18 14:49:52 2009
New Revision: 212883

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212883
Log:
Clarify some of the error messages, to help upgraders.

Modified:
    trunk/addons/res_config_mysql.c

Modified: trunk/addons/res_config_mysql.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/addons/res_config_mysql.c?view=diff&rev=212883&r1=212882&r2=212883
==============================================================================
--- trunk/addons/res_config_mysql.c (original)
+++ trunk/addons/res_config_mysql.c Tue Aug 18 14:49:52 2009
@@ -207,7 +207,7 @@
 	}
 
 	if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-		ast_log(LOG_ERROR, "Failed to query database columns: %s\n", mysql_error(&dbh->handle));
+		ast_log(LOG_ERROR, "Failed to query database '%s', table '%s' columns: %s\n", database, tablename, mysql_error(&dbh->handle));
 		release_database(dbh);
 		AST_LIST_UNLOCK(&mysql_tables);
 		return NULL;
@@ -237,7 +237,7 @@
 			}
 
 			if (!(column = ast_calloc(1, sizeof(*column) + strlen(fname) + strlen(ftype) + strlen(fdflt) + 3))) {
-				ast_log(LOG_ERROR, "Unable to allocate column element for %s, %s\n", tablename, fname);
+				ast_log(LOG_ERROR, "Unable to allocate column element %s for %s\n", fname, tablename);
 				destroy_table(table);
 				release_database(dbh);
 				AST_LIST_UNLOCK(&mysql_tables);
@@ -306,7 +306,7 @@
 	struct ast_variable *var=NULL, *prev=NULL;
 
 	if (!(dbh = find_database(database, 0))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: %s\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: %s (check res_mysql.conf)\n", database);
 		return NULL;
 	}
 
@@ -412,7 +412,7 @@
 	struct ast_category *cat = NULL;
 
 	if (!(dbh = find_database(database, 0))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s'\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
 		return NULL;
 	}
 
@@ -531,7 +531,7 @@
 	struct columns *column = NULL;
 
 	if (!(dbh = find_database(database, 1))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s'.\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
 		return -1;
 	}
 		
@@ -548,7 +548,7 @@
 	}
 
 	if (!(column = find_column(table, keyfield))) {
-		ast_log(LOG_ERROR, "MySQL RealTime: Updating on column '%s', but that column does not exist within the table '%s'!\n", keyfield, tablename);
+		ast_log(LOG_ERROR, "MySQL RealTime: Updating on column '%s', but that column does not exist within the table '%s' (db '%s')!\n", keyfield, tablename, database);
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -558,7 +558,7 @@
 	newparam = va_arg(ap, const char *);
 	newval = va_arg(ap, const char *);
 	if (!newparam || !newval)  {
-		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
+		ast_log(LOG_WARNING, "MySQL RealTime: Realtime update requires at least 1 parameter and 1 value to update.\n");
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -566,7 +566,7 @@
 
 	/* Check that the column exists in the table */
 	if (!(column = find_column(table, newparam))) {
-		ast_log(LOG_ERROR, "MySQL RealTime: Updating on column '%s', but that column does not exist within the table '%s'!\n", newparam, tablename);
+		ast_log(LOG_ERROR, "MySQL RealTime: Updating column '%s', but that column does not exist within the table '%s' (first pair MUST exist)!\n", newparam, tablename);
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -616,7 +616,7 @@
 
 	/* Execution. */
 	if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database: %s\n", mysql_error(&dbh->handle));
+		ast_log(LOG_WARNING, "MySQL RealTime: Failed to update database: %s\n", mysql_error(&dbh->handle));
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -736,7 +736,7 @@
 
 	/* Execution. */
 	if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database: %s\n", mysql_error(&dbh->handle));
+		ast_log(LOG_WARNING, "MySQL RealTime: Failed to update database: %s\n", mysql_error(&dbh->handle));
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -767,7 +767,7 @@
 	const char *newparam, *newval;
 
 	if (!(dbh = find_database(database, 1))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s'.\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
 		return -1;
 	}
 
@@ -815,7 +815,7 @@
 
 	/* Execution. */
 	if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database: %s\n", mysql_error(&dbh->handle));
+		ast_log(LOG_WARNING, "MySQL RealTime: Failed to insert into database: %s\n", mysql_error(&dbh->handle));
 		release_database(dbh);
 		return -1;
 	}
@@ -844,7 +844,7 @@
 	const char *newparam, *newval;
 
 	if (!(dbh = find_database(database, 1))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s'.\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
 		return -1;
 	}
 
@@ -884,7 +884,7 @@
 
 	/* Execution. */
 	if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database: %s\n", mysql_error(&dbh->handle));
+		ast_log(LOG_WARNING, "MySQL RealTime: Failed to delete from database: %s\n", mysql_error(&dbh->handle));
 		release_database(dbh);
 		return -1;
 	}
@@ -923,7 +923,7 @@
 	}
 
 	if (!(dbh = find_database(database, 0))) {
-		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s'\n", database);
+		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
 		return NULL;
 	}
 
@@ -1071,7 +1071,7 @@
 
 		/* Execution. */
 		if (mysql_real_query(&dbh->handle, ast_str_buffer(sql), ast_str_strlen(sql))) {
-			ast_log(LOG_WARNING, "MySQL RealTime: Failed to query database: %s\n", mysql_error(&dbh->handle));
+			ast_log(LOG_WARNING, "MySQL RealTime: Failed to modify database: %s\n", mysql_error(&dbh->handle));
 			ast_debug(1, "MySQL RealTime: Query: %s\n", ast_str_buffer(sql));
 			res = -1;
 		}




More information about the svn-commits mailing list