[asterisk-addons-commits] file: branch 1.4 r317 - in /branches/1.4: ./ app_addon_sql_mysql.c

asterisk-addons-commits at lists.digium.com asterisk-addons-commits at lists.digium.com
Tue Nov 28 09:40:27 MST 2006


Author: file
Date: Tue Nov 28 10:40:27 2006
New Revision: 317

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=317
Log:
Merged revisions 316 via svnmerge from 
https://origsvn.digium.com/svn/asterisk-addons/branches/1.2

........
r316 | file | 2006-11-28 11:39:25 -0500 (Tue, 28 Nov 2006) | 2 lines

Print out an error message with the reason if the MySQL query fails. (issue #7837 reported by lupino3)

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/app_addon_sql_mysql.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
--- branch-1.2-merged (original)
+++ branch-1.2-merged Tue Nov 28 10:40:27 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-183,209,211,257-258,264,268-273
+/branches/1.2:1-183,209,211,257-258,264,268-273,316

Modified: branches/1.4/app_addon_sql_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/branches/1.4/app_addon_sql_mysql.c?view=diff&rev=317&r1=316&r2=317
==============================================================================
--- branches/1.4/app_addon_sql_mysql.c (original)
+++ branches/1.4/app_addon_sql_mysql.c Tue Nov 28 10:40:27 2006
@@ -253,6 +253,7 @@
 	char *resultid_var;
 	int connid;
 	char *querystring;
+	int mysql_query_res;
 
 	strsep(&data," "); // eat the first token, we already know it :P 
 
@@ -262,16 +263,21 @@
 
 	if (resultid_var && (connid>=0) && querystring) {
 		if ((mysql=find_identifier(connid,AST_MYSQL_ID_CONNID))!=NULL) {
-			mysql_query(mysql,querystring);
-			if ((mysqlres=mysql_use_result(mysql))!=NULL) {
-				add_identifier_and_set_asterisk_int(chan,resultid_var,AST_MYSQL_ID_RESID,mysqlres);
-				return 0;
-			}
-			else if( mysql_field_count(mysql)==0 ) {
-				return 0;  // See http://dev.mysql.com/doc/mysql/en/mysql_field_count.html
+			mysql_query_res = mysql_query(mysql,querystring);
+			if (mysql_query_res != 0) {
+				ast_log(LOG_WARNING, "aMYSQL_query: mysql_query failed. Error: %s\n", mysql_error(mysql));
 			}
 			else {
-				ast_log(LOG_WARNING,"aMYSQL_query: mysql_store_result() failed on query %s\n",querystring);
+				if ((mysqlres=mysql_use_result(mysql))!=NULL) {
+					add_identifier_and_set_asterisk_int(chan,resultid_var,AST_MYSQL_ID_RESID,mysqlres);
+					return 0;
+				}
+				else if (mysql_field_count(mysql)==0) {
+					return 0;  // See http://dev.mysql.com/doc/mysql/en/mysql_field_count.html
+				}
+				else {
+					ast_log(LOG_WARNING,"aMYSQL_query: mysql_store_result() failed on query %s\n",querystring);
+				}
 			}
 		}
 		else {



More information about the asterisk-addons-commits mailing list