[asterisk-addons-commits] file: trunk r318 - in /trunk: ./
app_addon_sql_mysql.c
asterisk-addons-commits at lists.digium.com
asterisk-addons-commits at lists.digium.com
Tue Nov 28 09:41:30 MST 2006
Author: file
Date: Tue Nov 28 10:41:30 2006
New Revision: 318
URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=318
Log:
Merged revisions 317 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
................
r317 | file | 2006-11-28 11:40:27 -0500 (Tue, 28 Nov 2006) | 10 lines
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:
trunk/ (props changed)
trunk/app_addon_sql_mysql.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Tue Nov 28 10:41:30 2006
@@ -1,1 +1,1 @@
-/branches/1.4:1-299,308,310
+/branches/1.4:1-299,308,310,317
Modified: trunk/app_addon_sql_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/app_addon_sql_mysql.c?view=diff&rev=318&r1=317&r2=318
==============================================================================
--- trunk/app_addon_sql_mysql.c (original)
+++ trunk/app_addon_sql_mysql.c Tue Nov 28 10:41:30 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