From: Andrea Zagli Date: Sat, 26 Nov 2011 10:33:07 +0000 (+0100) Subject: Added the function GdaEx::data_model_is_empty (closes #230). X-Git-Tag: 0.5.0~17 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=c192d651f88b2bec26a658728ff8cc0b74214be9;p=libgdaex Added the function GdaEx::data_model_is_empty (closes #230). --- diff --git a/.anjuta_sym_db.db b/.anjuta_sym_db.db index 84813a4..6526f20 100644 Binary files a/.anjuta_sym_db.db and b/.anjuta_sym_db.db differ diff --git a/src/gdaex.c b/src/gdaex.c index 39bce68..816bda5 100644 --- a/src/gdaex.c +++ b/src/gdaex.c @@ -717,6 +717,19 @@ GdaDataModel return dm; } +/** + * gdaex_data_model_is_empty: + * @data_model: a #GdaDataModel object. + * + * Returns: #TRUE if #GdaDataModel is #NULL or it doesn't have any row. + */ +gboolean +gdaex_data_model_is_empty (GdaDataModel *data_model) +{ + return (!GDA_IS_DATA_MODEL (data_model) + || gda_data_model_get_n_rows (data_model) == 0); +} + /** * gdaex_data_model_get_field_value_stringify_at: * @data_model: a #GdaDataModel object. diff --git a/src/gdaex.h b/src/gdaex.h index ce053ef..39a8b39 100644 --- a/src/gdaex.h +++ b/src/gdaex.h @@ -79,6 +79,8 @@ void gdaex_set_tables_name_prefix (GdaEx *gdaex, const gchar *tables_name_prefix GdaDataModel *gdaex_query (GdaEx *gdaex, const gchar *sql); +gboolean gdaex_data_model_is_empty (GdaDataModel *data_model); + gchar *gdaex_data_model_get_field_value_stringify_at (GdaDataModel *data_model, gint row, const gchar *field_name);