[evolution-mapi] Do not QueryRows when there is no row available



commit 1609b6516f2ff1d73f59d5ac23c8281511cd5a03
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 6 10:13:08 2011 +0200

    Do not QueryRows when there is no row available
    
    Suggested by Michael Braun

 src/libexchangemapi/exchange-mapi-connection.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 6550573..ffbdf44 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -948,6 +948,9 @@ exchange_mapi_util_delete_attachments (mapi_object_t *obj_message, GError **perr
 		goto cleanup;
 	}
 
+	if (!attach_count)
+		goto cleanup;
+
 	/* foreach attachment, delete by PR_ATTACH_NUM */
 	for (i_row_attach = 0; i_row_attach < rows_attach.cRows; i_row_attach++) {
 		const uint32_t	*num_attach;
@@ -1229,6 +1232,9 @@ exchange_mapi_util_get_attachments (ExchangeMapiConnection *conn, mapi_id_t fid,
 		goto cleanup;
 	}
 
+	if (!attach_count)
+		goto cleanup;
+
 	/* foreach attachment, open by PR_ATTACH_NUM */
 	for (i_row_attach = 0; i_row_attach < rows_attach.cRows; i_row_attach++) {
 		ExchangeMAPIAttachment	*attachment;
@@ -1620,6 +1626,9 @@ exchange_mapi_connection_check_restriction (ExchangeMapiConnection *conn, mapi_i
 		goto cleanup;
 	}
 
+	if (!count)
+		goto cleanup;
+
 	/* Fill the table columns with data from the rows */
 	ms = QueryRows (&obj_table, count, TBL_ADVANCE, &SRowSet);
 	if (ms != MAPI_E_SUCCESS) {
@@ -1733,6 +1742,9 @@ exchange_mapi_connection_fetch_items   (ExchangeMapiConnection *conn, mapi_id_t
 			goto cleanup;
 		}
 
+		if (!count)
+			break;
+
 		/* Fill the table columns with data from the rows */
 		ms = QueryRows (&obj_table, count, TBL_ADVANCE, &SRowSet);
 		if (ms != MAPI_E_SUCCESS) {
@@ -3135,6 +3147,9 @@ get_child_folders (TALLOC_CTX *mem_ctx, ExchangeMAPIFolderCategory folder_hier,
 			goto cleanup;
 		}
 
+		if (!count)
+			break;
+
 		/* Fill the table columns with data from the rows */
 		ms = QueryRows (&obj_table, 100, TBL_ADVANCE, &rowset);
 		if (ms != MAPI_E_SUCCESS) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]