summaryrefslogtreecommitdiffstats
path: root/libmsi/libmsi-query.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-17 20:16:15 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-17 20:16:19 +0100
commit6556c61586d79ee0ae599248f25d591d99da8a97 (patch)
tree5392d273386dbf868e7ca2cb9b680c700bb7a4e0 /libmsi/libmsi-query.c
parente9cf5c17fe55779628503718139f3048b6eab5d2 (diff)
downloadmsitools-6556c61586d79ee0ae599248f25d591d99da8a97.tar.gz
msitools-6556c61586d79ee0ae599248f25d591d99da8a97.tar.xz
msitools-6556c61586d79ee0ae599248f25d591d99da8a97.zip
Remove LIBMSI_RESULT_NO_MORE_ITEMS from API
Raising an error for indicating the end of the results is really inconvenient, it's like throwing an exception for something quite normal... The user can still make a distinction when there is an error if the GError is set.
Diffstat (limited to 'libmsi/libmsi-query.c')
-rw-r--r--libmsi/libmsi-query.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libmsi/libmsi-query.c b/libmsi/libmsi-query.c
index eacbb8c..c61c23c 100644
--- a/libmsi/libmsi-query.c
+++ b/libmsi/libmsi-query.c
@@ -251,7 +251,7 @@ unsigned _libmsi_query_iterate_records( LibmsiQuery *view, unsigned *count,
if( count )
*count = n;
- if( r == LIBMSI_RESULT_NO_MORE_ITEMS )
+ if( r == NO_MORE_ITEMS )
r = LIBMSI_RESULT_SUCCESS;
return r;
@@ -315,7 +315,7 @@ unsigned msi_view_get_row(LibmsiDatabase *db, LibmsiView *view, unsigned row, Li
return LIBMSI_RESULT_INVALID_PARAMETER;
if (row >= row_count)
- return LIBMSI_RESULT_NO_MORE_ITEMS;
+ return NO_MORE_ITEMS;
*rec = libmsi_record_new (col_count);
if (!*rec)
@@ -402,11 +402,11 @@ LibmsiResult _libmsi_query_fetch(LibmsiQuery *query, LibmsiRecord **prec)
* @query: a #LibmsiQuery
* @error: (allow-none): return location for the error
*
- * Return the next query result. A %LIBMSI_RESULT_NO_MORE_ITEMS error
- * is returned when the query result set has reached the end.
+ * Return the next query result. %NULL is returned when there
+ * is no more results.
*
- * Returns: (transfer full): a newly allocated #LibmsiRecord
- * or %NULL when no results or failure.
+ * Returns: (transfer full) (allow-none): a newly allocated
+ * #LibmsiRecord or %NULL when no results or failure.
**/
LibmsiRecord *
libmsi_query_fetch (LibmsiQuery *query, GError **error)
@@ -424,7 +424,8 @@ libmsi_query_fetch (LibmsiQuery *query, GError **error)
g_object_unref(query);
/* FIXME: raise error when it happens */
- if (ret != LIBMSI_RESULT_SUCCESS)
+ if (ret != LIBMSI_RESULT_SUCCESS &&
+ ret != NO_MORE_ITEMS)
g_set_error_literal (error, LIBMSI_RESULT_ERROR, ret, G_STRFUNC);
return record;