]> saetta.ns0.it Git - libgdaex/commitdiff
Added functions GdaEx::data_model_*_get_*_value_stringify_escaped_at.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 12 Feb 2014 10:55:27 +0000 (11:55 +0100)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 12 Feb 2014 10:55:27 +0000 (11:55 +0100)
src/gdaex.c
src/gdaex.h

index 57e86e9608c0532a363c2a3aef9670424ad19bb8..aa93dc7fc470aa6d766a3470b071c031cf8b8570 100644 (file)
@@ -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.
index fd5d42015b0f7e43bc25b5160d42627b631701cc..d5174c465b6a49bf5c040b2c607668cf156c8665 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  gdaex.h
  *
- *  Copyright (C) 2005-2013 Andrea Zagli <azagli@libero.it>
+ *  Copyright (C) 2005-2014 Andrea Zagli <azagli@libero.it>
  *
  *  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,