[asterisk-commits] tilghman: branch tilghman/odbc_tx_support r165274 - /team/tilghman/odbc_tx_su...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 17 15:01:44 CST 2008


Author: tilghman
Date: Wed Dec 17 15:01:43 2008
New Revision: 165274

URL: http://svn.digium.com/view/asterisk?view=rev&rev=165274
Log:
ast_str opacity

Modified:
    team/tilghman/odbc_tx_support/res/res_odbc.c

Modified: team/tilghman/odbc_tx_support/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/odbc_tx_support/res/res_odbc.c?view=diff&rev=165274&r1=165273&r2=165274
==============================================================================
--- team/tilghman/odbc_tx_support/res/res_odbc.c (original)
+++ team/tilghman/odbc_tx_support/res/res_odbc.c Wed Dec 17 15:01:43 2008
@@ -248,6 +248,7 @@
 	if (tx->obj) {
 		/* Have to remove this link, first, or the destructors will recursively call each other */
 		tx->obj->txf = NULL;
+		/* If we have any uncommitted transactions, they are handled when we release the object */
 		ast_odbc_release_obj(tx->obj);
 		tx->obj = NULL;
 	}
@@ -974,14 +975,14 @@
 			SQLGetDiagField(SQL_HANDLE_DBC, tx->obj->con, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
 			for (i = 0; i < numfields; i++) {
 				SQLGetDiagRec(SQL_HANDLE_DBC, tx->obj->con, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
-				ast_str_append(&errors, 0, "%s%s", errors->used ? "," : "", state);
+				ast_str_append(&errors, 0, "%s%s", ast_str_strlen(errors) ? "," : "", state);
 				ast_log(LOG_WARNING, "SQLEndTran returned an error: %s: %s\n", state, diagnostic);
 				if (i > 10) {
 					ast_log(LOG_WARNING, "Oh, that was good.  There are really %d diagnostics?\n", (int)numfields);
 					break;
 				}
 			}
-			pbx_builtin_setvar_helper(chan, "COMMIT_RESULT", errors->str);
+			pbx_builtin_setvar_helper(chan, "COMMIT_RESULT", ast_str_buffer(errors));
 		}
 		tx->status = ODBC_STATUS_TXCLOSED;
 	}
@@ -1012,14 +1013,14 @@
 			SQLGetDiagField(SQL_HANDLE_DBC, tx->obj->con, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
 			for (i = 0; i < numfields; i++) {
 				SQLGetDiagRec(SQL_HANDLE_DBC, tx->obj->con, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
-				ast_str_append(&errors, 0, "%s%s", errors->used ? "," : "", state);
+				ast_str_append(&errors, 0, "%s%s", ast_str_strlen(errors) ? "," : "", state);
 				ast_log(LOG_WARNING, "SQLEndTran returned an error: %s: %s\n", state, diagnostic);
 				if (i > 10) {
 					ast_log(LOG_WARNING, "Oh, that was good.  There are really %d diagnostics?\n", (int)numfields);
 					break;
 				}
 			}
-			pbx_builtin_setvar_helper(chan, "ROLLBACK_RESULT", errors->str);
+			pbx_builtin_setvar_helper(chan, "ROLLBACK_RESULT", ast_str_buffer(errors));
 		}
 		tx->status = ODBC_STATUS_TXCLOSED;
 	}




More information about the asterisk-commits mailing list