From: Andrea Zagli Date: Wed, 12 Feb 2014 10:55:27 +0000 (+0100) Subject: Added functions GdaEx::data_model_*_get_*_value_stringify_escaped_at. X-Git-Tag: 0.4.0~2 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=1e9008b9ecaeb1213561be5e45dcaca64297d703;p=libgdaex Added functions GdaEx::data_model_*_get_*_value_stringify_escaped_at. --- diff --git a/src/gdaex.c b/src/gdaex.c index 57e86e9..aa93dc7 100644 --- a/src/gdaex.c +++ b/src/gdaex.c @@ -761,6 +761,29 @@ gchar return value; } +/** + * gdaex_data_model_get_field_value_stringify_escaped_at: + * @data_model: a #GdaDataModel object. + * @row: + * @field_name: the field's name. + * + * Returns: the @field_name's #GValue as #gchar (stringify) escaped for sql + */ +gchar +*gdaex_data_model_get_field_value_stringify_escaped_at (GdaDataModel *data_model, + gint row, + const gchar *field_name) +{ + gchar *value; + gchar *ret; + + value = gdaex_data_model_get_field_value_stringify_at (data_model, row, field_name); + ret = gdaex_strescape (value, NULL); + g_free (value); + + return ret; +} + /** * gdaex_data_model_get_field_value_integer_at: * @data_model: a #GdaDataModel object. @@ -1045,6 +1068,27 @@ gchar return ret; } +/** + * gdaex_data_model_get_value_stringify_escaped_at: + * @data_model: a #GdaDataModel object. + * @row: row number. + * @col: col number. + * + * Returns: the #GValue as #gchar (stringify) escaped for sql. + */ +gchar +*gdaex_data_model_get_value_stringify_escaped_at (GdaDataModel *data_model, gint row, gint col) +{ + gchar *ret; + gchar *value; + + value = gdaex_data_model_get_value_stringify_at (data_model, row, col); + ret = gdaex_strescape (value, NULL); + g_free (value); + + return ret; +} + /** * gdaex_data_model_get_value_integer_at: * @data_model: a #GdaDataModel object. @@ -1517,6 +1561,27 @@ gchar return value; } +/** + * gdaex_data_model_iter_get_field_value_stringify_escaped_at: + * @iter: a #GdaDataModelIter object. + * @field_name: the field's name. + * + * Returns: the @field_name's #GValue as #gchar (stringify) escaped for sql. + */ +gchar +*gdaex_data_model_iter_get_field_value_stringify_escaped_at (GdaDataModelIter *iter, + const gchar *field_name) +{ + gchar *ret; + gchar *value; + + value = gdaex_data_model_iter_get_field_value_stringify_at (iter, field_name); + ret = gdaex_strescape (value, NULL); + g_free (value); + + return ret; +} + /** * gdaex_data_model_iter_get_field_value_integer_at: * @iter: a #GdaDataModelIter object. @@ -1809,6 +1874,26 @@ gchar return ret; } +/** + * gdaex_data_model_iter_get_value_stringify_escaped_at: + * @iter: a #GdaDataModelIter object. + * @col: col number. + * + * Returns: the #GValue as #gchar (stringify) escaped for sql. + */ +gchar +*gdaex_data_model_iter_get_value_stringify_escaped_at (GdaDataModelIter *iter, gint col) +{ + gchar *ret; + gchar *value; + + value = gdaex_data_model_iter_get_value_stringify_at (iter, col); + ret = gdaex_strescape (value, NULL); + g_free (value); + + return ret; +} + /** * gdaex_data_model_iter_get_value_integer_at: * @iter: a #GdaDataModelIter object. diff --git a/src/gdaex.h b/src/gdaex.h index fd5d420..d5174c4 100644 --- a/src/gdaex.h +++ b/src/gdaex.h @@ -1,7 +1,7 @@ /* * gdaex.h * - * Copyright (C) 2005-2013 Andrea Zagli + * Copyright (C) 2005-2014 Andrea Zagli * * This file is part of libgdaex. * @@ -84,6 +84,9 @@ 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); +gchar *gdaex_data_model_get_field_value_stringify_escaped_at (GdaDataModel *data_model, + gint row, + const gchar *field_name); gint gdaex_data_model_get_field_value_integer_at (GdaDataModel *data_model, gint row, const gchar *field_name); @@ -112,6 +115,9 @@ struct tm *gdaex_data_model_get_field_value_tm_at (GdaDataModel *data_model, gchar *gdaex_data_model_get_value_stringify_at (GdaDataModel *data_model, gint row, gint col); +gchar *gdaex_data_model_get_value_stringify_escaped_at (GdaDataModel *data_model, + gint row, + gint col); gint gdaex_data_model_get_value_integer_at (GdaDataModel *data_model, gint row, gint col); @@ -139,6 +145,8 @@ struct tm *gdaex_data_model_get_value_tm_at (GdaDataModel *data_model, gchar *gdaex_data_model_iter_get_field_value_stringify_at (GdaDataModelIter *iter, const gchar *field_name); +gchar *gdaex_data_model_iter_get_field_value_stringify_escaped_at (GdaDataModelIter *iter, + const gchar *field_name); gint gdaex_data_model_iter_get_field_value_integer_at (GdaDataModelIter *iter, const gchar *field_name); gfloat gdaex_data_model_iter_get_field_value_float_at (GdaDataModelIter *iter, @@ -158,6 +166,8 @@ struct tm *gdaex_data_model_iter_get_field_value_tm_at (GdaDataModelIter *iter, gchar *gdaex_data_model_iter_get_value_stringify_at (GdaDataModelIter *iter, gint col); +gchar *gdaex_data_model_iter_get_value_stringify_escaped_at (GdaDataModelIter *iter, + gint col); gint gdaex_data_model_iter_get_value_integer_at (GdaDataModelIter *iter, gint col); gfloat gdaex_data_model_iter_get_value_float_at (GdaDataModelIter *iter,