[libgda] GdaPStmt: removed public fields from GObject struct



commit bbf5809b2f7a80b7cfbe83875a89e3ca5a8d6573
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Wed Feb 27 16:23:20 2019 -0600

    GdaPStmt: removed public fields from GObject struct

 libgda/gda-data-select.c                           |  40 ++---
 libgda/providers-support/gda-pstmt.c               | 172 ++++++++++++++++-----
 libgda/providers-support/gda-pstmt.h               |  19 ++-
 libgda/sqlite/gda-sqlite-provider.c                |  52 +++----
 libgda/sqlite/gda-sqlite-recordset.c               |  64 ++++----
 libgda/sqlite/virtual/gda-vconnection-data-model.c |   2 -
 providers/mysql/gda-mysql-provider.c               |  34 ++--
 providers/mysql/gda-mysql-pstmt.c                  |   2 +-
 providers/mysql/gda-mysql-recordset.c              |  46 +++---
 providers/postgres/gda-postgres-provider.c         |  26 ++--
 providers/postgres/gda-postgres-recordset.c        |  45 +++---
 .../skel-implementation/capi/gda-capi-provider.c   |  22 +--
 .../skel-implementation/capi/gda-capi-recordset.c  |  30 ++--
 providers/web/gda-web-provider.c                   |  30 ++--
 providers/web/gda-web-recordset.c                  |  46 +++---
 15 files changed, 365 insertions(+), 265 deletions(-)
---
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index c0fafe9fe..2513a66a1 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -672,21 +672,21 @@ create_columns (GdaDataSelect *model)
        if (!priv->prep_stmt)
                return;
 
-       if (priv->prep_stmt->ncols < 0)
+       if (gda_pstmt_get_ncols (priv->prep_stmt) < 0)
                g_error (_("INTERNAL implementation error: unknown number of columns in GdaPStmt, \nset 
number of columns before using with GdaDataSelect"));
-       if (priv->prep_stmt->tmpl_columns) {
+       if (gda_pstmt_get_tmpl_columns (priv->prep_stmt)) {
                /* copy template columns */
                GSList *list;
-               for (list = priv->prep_stmt->tmpl_columns; list; list = list->next)
+               for (list = gda_pstmt_get_tmpl_columns (priv->prep_stmt); list; list = list->next)
                        priv->sh->columns = g_slist_append (priv->sh->columns, g_object_ref (list->data));
        }
        else {
                /* create columns */
-               for (i = 0; i < priv->prep_stmt->ncols; i++) {
+               for (i = 0; i < gda_pstmt_get_ncols (priv->prep_stmt); i++) {
                        GdaColumn *gda_col;
                        gda_col = gda_column_new ();
-                       if (priv->prep_stmt->types)
-                               gda_column_set_g_type (gda_col, priv->prep_stmt->types [i]);
+                       if (gda_pstmt_get_types (priv->prep_stmt))
+                               gda_column_set_g_type (gda_col, gda_pstmt_get_types (priv->prep_stmt) [i]);
                        priv->sh->columns = g_slist_append (priv->sh->columns, gda_col);
                }
        }
@@ -1391,9 +1391,9 @@ gda_data_select_set_modification_statement (GdaDataSelect *model, GdaStatement *
                                        gda_column_set_g_type (gdacol, gda_holder_get_g_type (holder));
                                        coltypeschanged = TRUE;
                                }
-                               if (priv->prep_stmt && priv->prep_stmt->types &&
-                                   (priv->prep_stmt->types [num] == GDA_TYPE_NULL))
-                                       priv->prep_stmt->types [num] = gda_holder_get_g_type (holder);
+                               if (priv->prep_stmt && gda_pstmt_get_types (priv->prep_stmt) &&
+                                   (gda_pstmt_get_types (priv->prep_stmt) [num] == GDA_TYPE_NULL))
+                                       gda_pstmt_get_types (priv->prep_stmt) [num] = gda_holder_get_g_type 
(holder);
                        }
                }
 
@@ -1803,7 +1803,7 @@ gda_data_select_get_n_columns (GdaDataModel *model)
        GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (GDA_DATA_SELECT (model));
 
        if (priv->prep_stmt)
-               return priv->prep_stmt->ncols;
+               return gda_pstmt_get_ncols (priv->prep_stmt);
 
        return g_slist_length (priv->sh->columns);
 }
@@ -1970,11 +1970,11 @@ gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **
                                return NULL;
                        }
                        GType *types = NULL;
-                       if (priv->prep_stmt && priv->prep_stmt->types) {
-                               types = g_new (GType, priv->prep_stmt->ncols + 1);
-                               memcpy (types, priv->prep_stmt->types, /* Flawfinder: ignore */
-                                       sizeof (GType) * priv->prep_stmt->ncols);
-                               types [priv->prep_stmt->ncols] = G_TYPE_NONE;
+                       if (priv->prep_stmt && gda_pstmt_get_types (priv->prep_stmt)) {
+                               types = g_new (GType, gda_pstmt_get_ncols (priv->prep_stmt) + 1);
+                               memcpy (types, gda_pstmt_get_types (priv->prep_stmt), /* Flawfinder: ignore */
+                                       sizeof (GType) * gda_pstmt_get_ncols (priv->prep_stmt));
+                               types [gda_pstmt_get_ncols (priv->prep_stmt)] = G_TYPE_NONE;
                        }
                        /*g_print ("*** Executing DelayedSelectStmt %p\n", dstmt);*/
                        tmpmodel = gda_connection_statement_execute_select_full (priv->cnc,
@@ -3683,11 +3683,11 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
        g_assert (priv->prep_stmt);
        GType *types = NULL;
 
-       if (priv->prep_stmt->types) {
-               types = g_new (GType, priv->prep_stmt->ncols + 1);
-               memcpy (types, priv->prep_stmt->types, /* Flawfinder: ignore */
-                       sizeof (GType) * priv->prep_stmt->ncols);
-               types [priv->prep_stmt->ncols] = G_TYPE_NONE;
+       if (gda_pstmt_get_types (priv->prep_stmt)) {
+               types = g_new (GType, gda_pstmt_get_ncols (priv->prep_stmt) + 1);
+               memcpy (types, gda_pstmt_get_types (priv->prep_stmt), /* Flawfinder: ignore */
+                       sizeof (GType) * gda_pstmt_get_ncols (priv->prep_stmt));
+               types [gda_pstmt_get_ncols (priv->prep_stmt)] = G_TYPE_NONE;
        }
        new_model = (GdaDataSelect*) gda_connection_statement_execute_select_full (priv->cnc, select,
                                                                                   priv->sh->ext_params,
diff --git a/libgda/providers-support/gda-pstmt.c b/libgda/providers-support/gda-pstmt.c
index f6135da46..748b2f6ff 100644
--- a/libgda/providers-support/gda-pstmt.c
+++ b/libgda/providers-support/gda-pstmt.c
@@ -34,6 +34,13 @@ static GObjectClass *parent_class = NULL;
 struct _GdaPStmtPrivate {
        GRecMutex mutex;
        GWeakRef gda_stmt_ref; /* holds a weak reference to #GdaStatement, or %NULL */
+       gchar        *sql; /* actual SQL code used for this prepared statement, mem freed by GdaPStmt */
+       GSList       *param_ids; /* list of parameters' IDs (as gchar *), mem freed by GdaPStmt */
+
+       /* meta data */
+       gint          ncols;
+       GType        *types; /* array of ncols types */
+       GSList       *tmpl_columns; /* list of #GdaColumn objects which data models created from this prep. 
statement can copy */
 };
 
 /**
@@ -87,11 +94,11 @@ gda_pstmt_init (GdaPStmt *pstmt, G_GNUC_UNUSED GdaPStmtClass *klass)
        pstmt->priv = g_new0 (GdaPStmtPrivate, 1);
        g_rec_mutex_init (& pstmt->priv->mutex);
        g_weak_ref_init (&pstmt->priv->gda_stmt_ref, NULL);
-       pstmt->sql = NULL;
-       pstmt->param_ids = NULL;
-       pstmt->ncols = -1;
-       pstmt->types = NULL;
-       pstmt->tmpl_columns = NULL;
+       pstmt->priv->sql = NULL;
+       pstmt->priv->param_ids = NULL;
+       pstmt->priv->ncols = -1;
+       pstmt->priv->types = NULL;
+       pstmt->priv->tmpl_columns = NULL;
 }
 
 /*
@@ -139,25 +146,26 @@ gda_pstmt_finalize (GObject *object)
        /* free memory */
        g_rec_mutex_clear (& pstmt->priv->mutex);
        g_weak_ref_clear (&pstmt->priv->gda_stmt_ref);
-       g_free (pstmt->priv);
 
-       if (pstmt->sql) {
-               g_free (pstmt->sql);
-               pstmt->sql = NULL;
+       if (pstmt->priv->sql != NULL) {
+               g_free (pstmt->priv->sql);
+               pstmt->priv->sql = NULL;
        }
-       if (pstmt->param_ids) {
-               g_slist_foreach (pstmt->param_ids, (GFunc) g_free, NULL);
-               g_slist_free (pstmt->param_ids);
-               pstmt->param_ids = NULL;
+       if (pstmt->priv->param_ids != NULL) {
+               g_slist_foreach (pstmt->priv->param_ids, (GFunc) g_free, NULL);
+               g_slist_free (pstmt->priv->param_ids);
+               pstmt->priv->param_ids = NULL;
        }
-       if (pstmt->types) {
-               g_free (pstmt->types);
-               pstmt->types = NULL;
+       if (pstmt->priv->types != NULL) {
+               g_free (pstmt->priv->types);
+               pstmt->priv->types = NULL;
        }
-       if (pstmt->tmpl_columns) {
-               g_slist_foreach (pstmt->tmpl_columns, (GFunc) g_object_unref, NULL);
-               g_slist_free (pstmt->tmpl_columns);
+       if (pstmt->priv->tmpl_columns != NULL) {
+               g_slist_foreach (pstmt->priv->tmpl_columns, (GFunc) g_object_unref, NULL);
+               g_slist_free (pstmt->priv->tmpl_columns);
+               pstmt->priv->tmpl_columns = NULL;
        }
+       g_free (pstmt->priv);
 
        /* chain to parent class */
        parent_class->finalize (object);
@@ -213,29 +221,30 @@ gda_pstmt_copy_contents (GdaPStmt *src, GdaPStmt *dest)
        g_rec_mutex_lock (& src->priv->mutex);
        g_rec_mutex_lock (& dest->priv->mutex);
 
-       g_free (dest->sql);
-       dest->sql = NULL;
-       if (src->sql)
-               dest->sql = g_strdup (src->sql);
-       if (dest->param_ids) {
-               g_slist_foreach (dest->param_ids, (GFunc) g_free, NULL);
-               g_slist_free (dest->param_ids);
-               dest->param_ids = NULL;
+       g_free (dest->priv->sql);
+       dest->priv->sql = NULL;
+       if (src->priv->sql)
+               dest->priv->sql = g_strdup (src->priv->sql);
+       if (dest->priv->param_ids) {
+               g_slist_foreach (dest->priv->param_ids, (GFunc) g_free, NULL);
+               g_slist_free (dest->priv->param_ids);
+               dest->priv->param_ids = NULL;
        }
-       for (list = src->param_ids; list; list = list->next) 
-               dest->param_ids = g_slist_append (dest->param_ids, g_strdup ((gchar *) list->data));
-       dest->ncols = src->ncols;
-
-       g_free (dest->types);
-       dest->types = NULL;
-       if (src->types) {
-               dest->types = g_new (GType, dest->ncols);
-               memcpy (dest->types, src->types, sizeof (GType) * dest->ncols); /* Flawfinder: ignore */
+       for (list = src->priv->param_ids; list; list = list->next)
+               dest->priv->param_ids = g_slist_append (dest->priv->param_ids, g_strdup ((gchar *) 
list->data));
+       dest->priv->ncols = src->priv->ncols;
+       if (dest->priv->types != NULL) {
+               g_free (dest->priv->types);
        }
-       if (src->tmpl_columns) {
+       dest->priv->types = NULL;
+       if (src->priv->types) {
+               dest->priv->types = g_new (GType, dest->priv->ncols);
+               memcpy (dest->priv->types, src->priv->types, sizeof (GType) * dest->priv->ncols); /* 
Flawfinder: ignore */
+       }
+       if (src->priv->tmpl_columns) {
                GSList *list;
-               for (list = src->tmpl_columns; list; list = list->next) 
-                       dest->tmpl_columns = g_slist_append (dest->tmpl_columns, 
+               for (list = src->priv->tmpl_columns; list; list = list->next)
+                       dest->priv->tmpl_columns = g_slist_append (dest->priv->tmpl_columns,
                                                             gda_column_copy (GDA_COLUMN (list->data)));
        }
        GdaStatement *stmt;
@@ -271,3 +280,88 @@ gda_pstmt_get_gda_statement (GdaPStmt *pstmt)
        g_rec_mutex_unlock (& pstmt->priv->mutex);
        return stmt;
 }
+/**
+ * gda_pstmt_get_sql:
+ * Actual SQL code used for this prepared statement, mem freed by GdaPStmt
+ */
+gchar*
+gda_pstmt_get_sql (GdaPStmt *ps) {
+       return ps->priv->sql;
+}
+/**
+ * gda_pstmt_set_sql:
+ *
+ * Set SQL code used for this prepared statement, mem freed by GdaPStmt
+ */
+void
+gda_pstmt_set_sql (GdaPStmt *ps, const gchar *sql) {
+       ps->priv->sql = g_strdup (sql);
+}
+/**
+ *gda_pstmt_get_param_ids:
+ *
+ * List of parameters' IDs (as gchar *)
+ */
+GSList*
+gda_pstmt_get_param_ids (GdaPStmt *ps) {
+       return ps->priv->param_ids;
+}
+
+/**
+ *gda_pstmt_set_param_ids:
+ *
+ * List of parameters' IDs (as gchar *), list is stolen
+ */
+void
+gda_pstmt_set_param_ids    (GdaPStmt *ps, GSList* params) {
+       ps->priv->param_ids = params;
+}
+/**
+ * gda_pstmt_get_ncols:
+ */
+gint
+gda_pstmt_get_ncols (GdaPStmt *ps) {
+       return ps->priv->ncols;
+}
+/**
+ * gda_pstmt_get_types:
+ *
+ * Set column's types for statement. @types is stalen and should
+ * no be modified
+ */
+GType*
+gda_pstmt_get_types (GdaPStmt *ps) {
+       return ps->priv->types;
+}
+/**
+ * gda_pstmt_set_cols:
+ *
+ * Set column's types for statement. @types is stalen and should
+ * no be modified
+ */
+void
+gda_pstmt_set_cols (GdaPStmt *ps, gint ncols, GType *types) {
+       ps->priv->ncols = ncols;
+       ps->priv->types = types;
+}
+/**
+ *gda_pstmt_get_tmpl_columns:
+ *
+ * List of #GdaColumn objects which data models created from this
+ * prepared statement can copy
+ */
+GSList*
+gda_pstmt_get_tmpl_columns (GdaPStmt *ps) {
+       return ps->priv->tmpl_columns;
+}
+/**
+ *gda_pstmt_set_tmpl_columns:
+ *
+ * Set the list of #GdaColumn objects which data models created from this
+ * prepared statement can copy. The list is stolen, so you should not
+ * free it.
+ */
+void
+gda_pstmt_set_tmpl_columns (GdaPStmt *ps, GSList* columns) {
+       ps->priv->tmpl_columns = columns;
+}
diff --git a/libgda/providers-support/gda-pstmt.h b/libgda/providers-support/gda-pstmt.h
index 9bcefbebf..ba66c7171 100644
--- a/libgda/providers-support/gda-pstmt.h
+++ b/libgda/providers-support/gda-pstmt.h
@@ -49,14 +49,6 @@ struct _GdaPStmt {
        GObject       object;
 
        GdaPStmtPrivate *priv;
-       gchar        *sql; /* actual SQL code used for this prepared statement, mem freed by GdaPStmt */
-        GSList       *param_ids; /* list of parameters' IDs (as gchar *), mem freed by GdaPStmt */
-
-       /* meta data */
-        gint          ncols;
-        GType        *types; /* array of ncols types */
-       GSList       *tmpl_columns; /* list of #GdaColumn objects which data models created from this prep. 
statement
-                                    * can copy */
 
        /*< private >*/
        /* Padding for future expansion */
@@ -108,6 +100,17 @@ void          gda_pstmt_set_gda_statement (GdaPStmt *pstmt, GdaStatement *stmt);
 void          gda_pstmt_copy_contents     (GdaPStmt *src, GdaPStmt *dest);
 GdaStatement *gda_pstmt_get_gda_statement (GdaPStmt *pstmt);
 
+
+gchar         *gda_pstmt_get_sql          (GdaPStmt *ps);
+void           gda_pstmt_set_sql          (GdaPStmt *ps, const gchar *sql);
+GSList        *gda_pstmt_get_param_ids    (GdaPStmt *ps);
+void           gda_pstmt_set_param_ids    (GdaPStmt *ps, GSList* params);
+gint           gda_pstmt_get_ncols        (GdaPStmt *ps);
+void           gda_pstmt_set_cols         (GdaPStmt *ps, gint ncols, GType *types);
+GSList        *gda_pstmt_get_tmpl_columns (GdaPStmt *ps);
+void           gda_pstmt_set_tmpl_columns (GdaPStmt *ps, GSList* columns);
+GType         *gda_pstmt_get_types        (GdaPStmt *ps);
+
 G_END_DECLS
 
 #endif
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index c8e6d2bec..d7335209b 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -2928,8 +2928,8 @@ real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stm
        /* create a prepared statement object */
        ps = _gda_sqlite_pstmt_new (sqlite_stmt);
        gda_pstmt_set_gda_statement (_GDA_PSTMT (ps), stmt);
-       _GDA_PSTMT (ps)->param_ids = param_ids;
-       _GDA_PSTMT (ps)->sql = sql;
+       gda_pstmt_set_param_ids (_GDA_PSTMT (ps), param_ids);
+       gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
        ps->rowid_hash = hash;
        ps->nb_rowid_columns = nb_rows_added;
        g_object_unref (real_stmt);
@@ -3319,7 +3319,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
 
                        /* create a SQLitePreparedStatement */
                        ps = _gda_sqlite_pstmt_new (sqlite_stmt);
-                       _GDA_PSTMT (ps)->sql = sql;
+                       gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
 
                        new_ps = TRUE;
                }
@@ -3378,7 +3378,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
        int i;
        GSList *blobs_list = NULL; /* list of PendingBlob structures */
 
-       for (i = 1, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+       for (i = 1, list = gda_pstmt_get_param_ids (_GDA_PSTMT (ps)); list; list = list->next, i++) {
                const gchar *pname = (gchar *) list->data;
                GdaHolder *h = NULL;
 
@@ -3492,15 +3492,15 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                                gtps = (GdaPStmt *) tps;
 
                                /* keep @param_ids to avoid being cleared by gda_pstmt_copy_contents() */
-                               prep_param_ids = gtps->param_ids;
-                               gtps->param_ids = NULL;
+                               prep_param_ids = gda_pstmt_get_param_ids (gtps);
+                               gda_pstmt_set_param_ids (gtps, NULL);
                                
                                /* actual copy */
                                gda_pstmt_copy_contents ((GdaPStmt *) ps, (GdaPStmt *) tps);
 
                                /* restore previous @param_ids */
-                               copied_param_ids = gtps->param_ids;
-                               gtps->param_ids = prep_param_ids;
+                               copied_param_ids = gda_pstmt_get_param_ids (gtps);
+                               gda_pstmt_set_param_ids (gtps, prep_param_ids);
 
                                /* execute */
                                obj = gda_sqlite_provider_statement_execute (provider, cnc,
@@ -3511,7 +3511,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                                /* clear original @param_ids and restore copied one */
                                g_slist_free_full (prep_param_ids, (GDestroyNotify) g_free);
 
-                               gtps->param_ids = copied_param_ids;
+                               gda_pstmt_set_param_ids (gtps, copied_param_ids);
 
                                /*if (GDA_IS_DATA_MODEL (obj))
                                  gda_data_model_dump ((GdaDataModel*) obj, NULL);*/
@@ -3694,13 +3694,13 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
 
        /* add a connection event */
        event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_COMMAND);
-        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
-        gda_connection_add_event (cnc, event);
+       gda_connection_event_set_description (event, gda_pstmt_get_sql (_GDA_PSTMT (ps)));
+       gda_connection_add_event (cnc, event);
 
        /* treat prepared and bound statement */
-       if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SELECT", 6) ||
-            ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "PRAGMA", 6) ||
-            ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "EXPLAIN", 7)) {
+       if (! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "SELECT", 6) ||
+               ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "PRAGMA", 6) ||
+               ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "EXPLAIN", 7)) {
                GObject *data_model;
                GdaDataModelAccessFlags flags;
 
@@ -3826,12 +3826,12 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                        gchar *str = NULL;
                        gboolean count_changes = FALSE;
 
-                        if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "DELETE", 6)) {
+                       if (! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "DELETE", 6)) {
                                count_changes = TRUE;
-                                str = g_strdup_printf ("DELETE %d (see SQLite documentation for a \"DELETE * 
FROM table\" query)",
-                                                       changes);
+                               str = g_strdup_printf ("DELETE %d (see SQLite documentation for a \"DELETE * 
FROM table\" query)",
+                                                     changes);
                        }
-                        else if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "INSERT", 6)) {
+                       else if (! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "INSERT", 6)) {
                                sqlite3_int64 last_id;
                                count_changes = TRUE;
                                last_id = SQLITE3_CALL (sqlite3_last_insert_rowid) (handle);
@@ -3839,12 +3839,12 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                                if (last_inserted_row)
                                        *last_inserted_row = make_last_inserted_set (cnc, stmt, last_id);
                        }
-                       else if (!g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "UPDATE", 6)) {
+                       else if (!g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "UPDATE", 6)) {
                                count_changes = TRUE;
                                str = g_strdup_printf ("UPDATE %d", changes);
                        }
-                       else if (*(_GDA_PSTMT (ps)->sql)) {
-                               gchar *tmp = g_ascii_strup (_GDA_PSTMT (ps)->sql, -1);
+                       else if (*(gda_pstmt_get_sql (_GDA_PSTMT (ps)))) {
+                               gchar *tmp = g_ascii_strup (gda_pstmt_get_sql (_GDA_PSTMT (ps)), -1);
                                for (str = tmp; *str && (*str != ' ') && (*str != '\t') &&
                                             (*str != '\n'); str++);
                                *str = 0;
@@ -3858,11 +3858,11 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
                        }
 
                        if (str) {
-                                event = gda_connection_point_available_event (cnc, 
GDA_CONNECTION_EVENT_NOTICE);
-                                gda_connection_event_set_description (event, str);
-                                g_free (str);
-                                gda_connection_add_event (cnc, event);
-                        }
+                               event = gda_connection_point_available_event (cnc, 
GDA_CONNECTION_EVENT_NOTICE);
+                                                                            
gda_connection_event_set_description (event, str);
+                                                                            g_free (str);
+                                                                            gda_connection_add_event (cnc, 
event);
+                       }
                        gda_connection_internal_statement_executed (cnc, stmt, params, event);
                        SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt);
                        if (new_ps)
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index aacacb111..816425eeb 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -184,9 +184,9 @@ read_rows_to_init_col_types (GdaSqliteRecordset *model)
        gint *missing_cols, nb_missing;
        GdaDataSelect *pmodel = (GdaDataSelect*) model;
 
-       missing_cols = g_new (gint, gda_data_select_get_prep_stmt(pmodel)->ncols);
-       for (nb_missing = 0, i = 0; i <  gda_data_select_get_prep_stmt(pmodel)->ncols; i++) {
-               if ( gda_data_select_get_prep_stmt(pmodel)->types[i] == GDA_TYPE_NULL)
+       missing_cols = g_new (gint, gda_pstmt_get_ncols (gda_data_select_get_prep_stmt(pmodel)));
+       for (nb_missing = 0, i = 0; i <  gda_pstmt_get_ncols (gda_data_select_get_prep_stmt(pmodel)); i++) {
+               if ( gda_pstmt_get_types (gda_data_select_get_prep_stmt(pmodel))[i] == GDA_TYPE_NULL)
                        missing_cols [nb_missing++] = i;
        }
 
@@ -204,10 +204,10 @@ read_rows_to_init_col_types (GdaSqliteRecordset *model)
                g_print ("Prefetched row %d of model %p\n", model->priv->next_row_num - 1, pmodel);
 #endif
                for (i = nb_missing - 1; i >= 0; i--) {
-                       if ( gda_data_select_get_prep_stmt(pmodel)->types [missing_cols [i]] != 
GDA_TYPE_NULL) {
+                       if ( gda_pstmt_get_types (gda_data_select_get_prep_stmt(pmodel)) [missing_cols [i]] 
!= GDA_TYPE_NULL) {
 #ifdef GDA_DEBUG_NO
                                g_print ("Found type '%s' for col %d\n", 
-                                        g_type_name ( gda_data_select_get_prep_stmt(pmodel)->types 
[missing_cols [i]]),
+                                        g_type_name ( gda_pstmt_get_types 
(gda_data_select_get_prep_stmt(pmodel)) [missing_cols [i]]),
                                         missing_cols [i]);
 #endif
                                memmove (missing_cols + i, missing_cols + i + 1, sizeof (gint) * (nb_missing 
- i - 1));
@@ -248,43 +248,43 @@ _gda_sqlite_recordset_new (GdaConnection *cnc, GdaSqlitePStmt *ps, GdaSet *exec_
                 _gda_sqlite_compute_types_hash (cdata);
 
         /* make sure @ps reports the correct number of columns */
-       if (_GDA_PSTMT (ps)->ncols < 0)
-               _GDA_PSTMT (ps)->ncols = SQLITE3_CALL (sqlite3_column_count) (ps->sqlite_stmt) -
-                       ps->nb_rowid_columns;
+       if (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) < 0)
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), SQLITE3_CALL (sqlite3_column_count) (ps->sqlite_stmt) -
+                       ps->nb_rowid_columns, gda_pstmt_get_types (_GDA_PSTMT (ps)));
 
         /* completing ps */
        g_assert (! ps->stmt_used);
-        ps->stmt_used = TRUE;
-        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+       ps->stmt_used = TRUE;
+       if (!gda_pstmt_get_types (_GDA_PSTMT (ps)) && (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) > 0)) {
                /* create prepared statement's columns */
                GSList *list;
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
-                                                                        gda_column_new ());
-               _GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_prepend 
(gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps)),
+                  gda_column_new ()));
+               gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_reverse (gda_pstmt_get_tmpl_columns 
(_GDA_PSTMT (ps))));
 
                /* create prepared statement's types, all types are initialized to GDA_TYPE_NULL */
-               _GDA_PSTMT (ps)->types = g_new (GType, _GDA_PSTMT (ps)->ncols);
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->types [i] = GDA_TYPE_NULL;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)), g_new (GType, 
gda_pstmt_get_ncols (_GDA_PSTMT (ps))));
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = GDA_TYPE_NULL;
 
                if (col_types) {
                        for (i = 0; ; i++) {
                                if (col_types [i] > 0) {
                                        if (col_types [i] == G_TYPE_NONE)
                                                break;
-                                       if (i >= _GDA_PSTMT (ps)->ncols)
+                                       if (i >= gda_pstmt_get_ncols (_GDA_PSTMT (ps)))
                                                g_warning (_("Column %d out of range (0-%d), ignoring its 
specified type"), i,
-                                                          _GDA_PSTMT (ps)->ncols - 1);
+                                                          gda_pstmt_get_ncols (_GDA_PSTMT (ps)) - 1);
                                        else 
-                                               _GDA_PSTMT (ps)->types [i] = col_types [i];
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = col_types [i];
                                }
                        }
                }
                
                /* fill GdaColumn's data */
-               for (i=0, list = _GDA_PSTMT (ps)->tmpl_columns; 
-                    i < GDA_PSTMT (ps)->ncols; 
+               for (i=0, list = gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps));
+                    i < gda_pstmt_get_ncols (_GDA_PSTMT (ps));
                     i++, list = list->next) {
                        GdaColumn *column;
                        gint real_col = i + ps->nb_rowid_columns;
@@ -293,8 +293,8 @@ _gda_sqlite_recordset_new (GdaConnection *cnc, GdaSqlitePStmt *ps, GdaSet *exec_
                        gda_column_set_description (column, SQLITE3_CALL (sqlite3_column_name) 
(ps->sqlite_stmt, real_col));
                        gda_column_set_name (column, SQLITE3_CALL (sqlite3_column_name) (ps->sqlite_stmt, 
real_col));
                        gda_column_set_dbms_type (column, SQLITE3_CALL (sqlite3_column_decltype) 
(ps->sqlite_stmt, real_col));
-                       if (_GDA_PSTMT (ps)->types [i] != GDA_TYPE_NULL)
-                               gda_column_set_g_type (column, _GDA_PSTMT (ps)->types [i]);
+                       if (gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] != GDA_TYPE_NULL)
+                               gda_column_set_g_type (column, gda_pstmt_get_types (_GDA_PSTMT (ps)) [i]);
                }
         }
 
@@ -333,8 +333,8 @@ fuzzy_get_gtype (SqliteConnectionData *cdata, GdaSqlitePStmt *ps, gint colnum)
        GType gtype = GDA_TYPE_NULL;
        gint real_col = colnum + ps->nb_rowid_columns;
 
-       if (_GDA_PSTMT (ps)->types [colnum] != GDA_TYPE_NULL)
-               return _GDA_PSTMT (ps)->types [colnum];
+       if (gda_pstmt_get_types (_GDA_PSTMT (ps)) [colnum] != GDA_TYPE_NULL)
+               return gda_pstmt_get_types (_GDA_PSTMT (ps)) [colnum];
        
        ctype = SQLITE3_CALL (sqlite3_column_origin_name) (ps->sqlite_stmt, real_col);
        if (ctype && !strcmp (ctype, "rowid"))
@@ -388,10 +388,10 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
        switch (rc) {
        case  SQLITE_ROW: {
                gint col, real_col;
-               prow = gda_row_new (_GDA_PSTMT (ps)->ncols);
-               for (col = 0; col < _GDA_PSTMT (ps)->ncols; col++) {
+               prow = gda_row_new (gda_pstmt_get_ncols (_GDA_PSTMT (ps)));
+               for (col = 0; col < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); col++) {
                        GValue *value;
-                       GType type = _GDA_PSTMT (ps)->types [col];
+                       GType type = gda_pstmt_get_types (_GDA_PSTMT (ps)) [col];
                        
                        real_col = col + ps->nb_rowid_columns;
 
@@ -421,10 +421,10 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
                                if (type != GDA_TYPE_NULL) {
                                        GdaColumn *column;
                                        
-                                       _GDA_PSTMT (ps)->types [col] = type;
+                                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [col] = type;
                                        column = gda_data_model_describe_column (GDA_DATA_MODEL (model), col);
                                        gda_column_set_g_type (column, type);
-                                       column = (GdaColumn *) g_slist_nth_data (_GDA_PSTMT 
(ps)->tmpl_columns, col);
+                                       column = (GdaColumn *) g_slist_nth_data (gda_pstmt_get_tmpl_columns 
(_GDA_PSTMT (ps)), col);
                                        gda_column_set_g_type (column, type);
                                }
                        }
@@ -656,7 +656,7 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
                                        g_set_error (&lerror, GDA_SERVER_PROVIDER_ERROR,
                                                     GDA_SERVER_PROVIDER_DATA_ERROR,
                                                     "Unhandled type '%s' in SQLite recordset",
-                                                    gda_g_type_to_string (_GDA_PSTMT (ps)->types [col]));
+                                                    gda_g_type_to_string (gda_pstmt_get_types (_GDA_PSTMT 
(ps)) [col]));
                                        gda_row_invalidate_value_e (prow, value, lerror);
                                }
                        }
diff --git a/libgda/sqlite/virtual/gda-vconnection-data-model.c 
b/libgda/sqlite/virtual/gda-vconnection-data-model.c
index 8dd7a7e1c..095c20d70 100644
--- a/libgda/sqlite/virtual/gda-vconnection-data-model.c
+++ b/libgda/sqlite/virtual/gda-vconnection-data-model.c
@@ -432,7 +432,6 @@ gda_vconnection_data_model_get_model (GdaVconnectionDataModel *cnc, const gchar
 {
        GdaVConnectionTableData *td;
        g_return_val_if_fail (GDA_IS_VCONNECTION_DATA_MODEL (cnc), NULL);
-       GdaVconnectionDataModelPrivate *priv = gda_vconnection_data_model_get_instance_private (cnc);
        if (!table_name || !(*table_name))
                return NULL;
 
@@ -457,7 +456,6 @@ gda_vconnection_data_model_get_table_name (GdaVconnectionDataModel *cnc, GdaData
 {
        GdaVConnectionTableData *td;
        g_return_val_if_fail (GDA_IS_VCONNECTION_DATA_MODEL (cnc), NULL);
-       GdaVconnectionDataModelPrivate *priv = gda_vconnection_data_model_get_instance_private (cnc);
        if (!model)
                return NULL;
        g_return_val_if_fail (GDA_IS_DATA_MODEL (model), NULL);
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 9e9c477e0..1355ef91a 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -1809,8 +1809,8 @@ real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stm
                return NULL;
        else {
                gda_pstmt_set_gda_statement (_GDA_PSTMT(ps), stmt);
-               _GDA_PSTMT(ps)->param_ids = param_ids;
-               _GDA_PSTMT(ps)->sql = sql;
+               gda_pstmt_set_param_ids (_GDA_PSTMT(ps), param_ids);
+               gda_pstmt_set_sql (_GDA_PSTMT(ps), sql);
                return ps;
        }
        
@@ -1892,8 +1892,8 @@ prepare_stmt_simple (MysqlConnectionData  *cdata,
        }
        else {
                ps = gda_mysql_pstmt_new (cdata->cnc, cdata->mysql, mysql_stmt);
-               _GDA_PSTMT(ps)->param_ids = NULL;
-               _GDA_PSTMT(ps)->sql = g_strdup (sql);
+               gda_pstmt_set_param_ids (_GDA_PSTMT (ps), NULL);
+               gda_pstmt_set_sql (_GDA_PSTMT(ps), sql);
        }
        
        return ps;
@@ -2217,7 +2217,7 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
        GdaConnectionEvent *event = NULL;
        int i;
        
-       gint nb_params = g_slist_length (_GDA_PSTMT (ps)->param_ids);
+       gint nb_params = g_slist_length (gda_pstmt_get_param_ids (_GDA_PSTMT (ps)));
        /*g_print ("NB=%d, SQL=%s\n", nb_params, _GDA_PSTMT(ps)->sql);*/
 
        MYSQL_BIND *mysql_bind_param = NULL;
@@ -2228,7 +2228,7 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
                mem_to_free = g_slist_prepend (mem_to_free, mysql_bind_param);
        }
 
-       for (i = 0, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+       for (i = 0, list = gda_pstmt_get_param_ids (_GDA_PSTMT (ps)); list; list = list->next, i++) {
                const gchar *pname = (gchar *) list->data;
 
                /* find requested parameter */
@@ -2346,15 +2346,15 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
                                gtps = (GdaPStmt *) tps;
 
                                /* keep @param_ids to avoid being cleared by gda_pstmt_copy_contents() */
-                               prep_param_ids = gtps->param_ids;
-                               gtps->param_ids = NULL;
+                               prep_param_ids =gda_pstmt_get_param_ids (_GDA_PSTMT (gtps));
+                               gda_pstmt_set_param_ids (_GDA_PSTMT (gtps), NULL);
                                
                                /* actual copy */
                                gda_pstmt_copy_contents ((GdaPStmt *) ps, (GdaPStmt *) tps);
 
                                /* restore previous @param_ids */
-                               copied_param_ids = gtps->param_ids;
-                               gtps->param_ids = prep_param_ids;
+                               copied_param_ids = gda_pstmt_get_param_ids (_GDA_PSTMT (gtps));
+                               gda_pstmt_set_param_ids (_GDA_PSTMT (gtps), prep_param_ids);
 
                                /* execute */
                                obj = gda_mysql_provider_statement_execute (provider, cnc,
@@ -2366,7 +2366,7 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
                                g_slist_foreach (prep_param_ids, (GFunc) g_free, NULL);
                                g_slist_free (prep_param_ids);
 
-                               gtps->param_ids = copied_param_ids;
+                               gda_pstmt_set_param_ids (_GDA_PSTMT (gtps), copied_param_ids);
 
                                /*if (GDA_IS_DATA_MODEL (obj))
                                  gda_data_model_dump ((GdaDataModel*) obj, NULL);*/
@@ -2657,7 +2657,7 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
 
        /* add a connection event for the execution */
        event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_COMMAND);
-        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
+        gda_connection_event_set_description (event, gda_pstmt_get_sql (_GDA_PSTMT (ps)));
         gda_connection_add_event (cnc, event);
 
        if (empty_rs) {
@@ -2706,11 +2706,11 @@ gda_mysql_provider_statement_execute (GdaServerProvider               *provider,
                my_ulonglong affected_rows;
                affected_rows = mysql_stmt_affected_rows (ps->mysql_stmt);
                if ((affected_rows == (my_ulonglong)~0) ||
-                   !g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SELECT", 6) ||
-                   !g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SHOW", 4) ||
-                   !g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "DESCRIBE", 8) ||
-                   !g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "EXECUTE", 7) ||
-                   !g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "EXPLAIN", 7)) {
+                   !g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "SELECT", 6) ||
+                   !g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "SHOW", 4) ||
+                   !g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "DESCRIBE", 8) ||
+                   !g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "EXECUTE", 7) ||
+                   !g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "EXPLAIN", 7)) {
                        if (mysql_stmt_store_result (ps->mysql_stmt)) {
                                _gda_mysql_make_error (cnc, NULL, ps->mysql_stmt, error);
                        }
diff --git a/providers/mysql/gda-mysql-pstmt.c b/providers/mysql/gda-mysql-pstmt.c
index 5989ffe53..a6e1de643 100644
--- a/providers/mysql/gda-mysql-pstmt.c
+++ b/providers/mysql/gda-mysql-pstmt.c
@@ -98,7 +98,7 @@ gda_mysql_pstmt_finalize (GObject  *object)
                mysql_stmt_close (pstmt->mysql_stmt);
 
        gint i;
-       for (i = 0; i < ((GdaPStmt *) pstmt)->ncols; ++i) {
+       for (i = 0; i < gda_pstmt_get_ncols ((GdaPStmt *) pstmt); ++i) {
                g_free (pstmt->mysql_bind_result[i].buffer);
                g_free (pstmt->mysql_bind_result[i].is_null);
                g_free (pstmt->mysql_bind_result[i].length);
diff --git a/providers/mysql/gda-mysql-recordset.c b/providers/mysql/gda-mysql-recordset.c
index 2431f694d..f9d33d56e 100644
--- a/providers/mysql/gda-mysql-recordset.c
+++ b/providers/mysql/gda-mysql-recordset.c
@@ -554,36 +554,36 @@ gda_mysql_recordset_new (GdaConnection            *cnc,
        g_assert (ps->mysql_stmt);
 
        /* make sure @ps reports the correct number of columns using the API*/
-        if (_GDA_PSTMT (ps)->ncols < 0)
-               _GDA_PSTMT(ps)->ncols = mysql_stmt_field_count (ps->mysql_stmt);
+       if (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) < 0)
+               gda_pstmt_set_cols (_GDA_PSTMT(ps), mysql_stmt_field_count (ps->mysql_stmt), 
gda_pstmt_get_types (_GDA_PSTMT(ps)));
 
         /* completing @ps if not yet done */
        g_assert (! ps->stmt_used);
         ps->stmt_used = TRUE;
-        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+        if (!gda_pstmt_get_types (_GDA_PSTMT (ps)) && (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) > 0)) {
                /* create prepared statement's columns */
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
-                                                                        gda_column_new ());
-               _GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_prepend 
(gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps)),
+                                                                        gda_column_new ()));
+               gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_reverse (gda_pstmt_get_tmpl_columns 
(_GDA_PSTMT (ps))));
 
                /* create prepared statement's types, all types are initialized to GDA_TYPE_NULL */
-               _GDA_PSTMT (ps)->types = g_new (GType, _GDA_PSTMT (ps)->ncols);
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->types [i] = GDA_TYPE_NULL;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)), g_new 
(GType,gda_pstmt_get_ncols (_GDA_PSTMT (ps))));
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = GDA_TYPE_NULL;
 
                if (col_types) {
                        for (i = 0; ; i++) {
                                if (col_types [i] > 0) {
                                        if (col_types [i] == G_TYPE_NONE)
                                                break;
-                                       if (i >= _GDA_PSTMT (ps)->ncols) {
+                                       if (i >= gda_pstmt_get_ncols (_GDA_PSTMT (ps))) {
                                                g_warning (_("Column %d out of range (0-%d), ignoring its 
specified type"), i,
-                                                          _GDA_PSTMT (ps)->ncols - 1);
+                                                          gda_pstmt_get_ncols (_GDA_PSTMT (ps)) - 1);
                                                break;
                                        }
                                        else
-                                               _GDA_PSTMT (ps)->types [i] = col_types [i];
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = col_types [i];
                                }
                        }
                }
@@ -592,7 +592,7 @@ gda_mysql_recordset_new (GdaConnection            *cnc,
        /* get rid of old bound result if any */
        if (ps->mysql_bind_result) {
                gint i;
-               for (i = 0; i < ((GdaPStmt *) ps)->ncols; ++i) {
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); ++i) {
                        g_free (ps->mysql_bind_result[i].buffer);
                        g_free (ps->mysql_bind_result[i].is_null);
                        g_free (ps->mysql_bind_result[i].length);
@@ -605,21 +605,21 @@ gda_mysql_recordset_new (GdaConnection            *cnc,
        MYSQL_RES *mysql_res = mysql_stmt_result_metadata (ps->mysql_stmt);
        MYSQL_FIELD *mysql_fields = mysql_fetch_fields (mysql_res);
        
-       MYSQL_BIND *mysql_bind_result = g_new0 (MYSQL_BIND, GDA_PSTMT (ps)->ncols);
+       MYSQL_BIND *mysql_bind_result = g_new0 (MYSQL_BIND, gda_pstmt_get_ncols (_GDA_PSTMT (ps)));
        GSList *list;
 
-       for (i=0, list = _GDA_PSTMT (ps)->tmpl_columns; 
-            i < GDA_PSTMT (ps)->ncols; 
+       for (i=0, list = gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps));
+            i < gda_pstmt_get_ncols (_GDA_PSTMT (ps));
             i++, list = list->next) {
                GdaColumn *column = GDA_COLUMN (list->data);
                
                /* use C API to set columns' information using gda_column_set_*() */
                MYSQL_FIELD *field = &mysql_fields[i];
                
-               GType gtype = _GDA_PSTMT(ps)->types[i];
+               GType gtype = gda_pstmt_get_types (_GDA_PSTMT (ps))[i];
                if (gtype == GDA_TYPE_NULL) {
                        gtype = _gda_mysql_type_to_gda (cdata, field->type, field->charsetnr);
-                       _GDA_PSTMT(ps)->types[i] = gtype;
+                       gda_pstmt_get_types (_GDA_PSTMT (ps))[i] = gtype;
                }
                gda_column_set_g_type (column, gtype);
                gda_column_set_name (column, field->name);
@@ -753,7 +753,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
                                       "http://gitlab.gnome.org/GNOME/libgda/issues";);
 
                gint col;
-               for (col = 0; col < gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols; ++col) {
+               for (col = 0; col < gda_pstmt_get_ncols (gda_data_select_get_prep_stmt ((GdaDataSelect *) 
imodel)); ++col) {
                        my_bool truncated;
                        mysql_bind_result[col].error = &truncated;
                        mysql_stmt_fetch_column (imodel->priv->mysql_stmt, &(mysql_bind_result[col]),
@@ -775,13 +775,13 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
        /* g_print ("%s: SQL=%s\n", __func__, ((GdaDataSelect *) imodel)->prep_stmt->sql); */
 
        
-       GdaRow *row = gda_row_new (gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols);
+       GdaRow *row = gda_row_new (gda_pstmt_get_ncols (gda_data_select_get_prep_stmt ((GdaDataSelect *) 
imodel)));
        gint col;
-       for (col = 0; col < gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols; ++col) {
+       for (col = 0; col < gda_pstmt_get_ncols (gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)); 
++col) {
                gint i = col;
                
                GValue *value = gda_row_get_value (row, i);
-               GType type = gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->types[i];
+               GType type = gda_pstmt_get_types (gda_data_select_get_prep_stmt ((GdaDataSelect *) 
imodel))[i];
                
                /*g_print ("%s: #%d : TYPE=%d, GTYPE=%s\n", __func__, i, mysql_bind_result[i].buffer_type, 
g_type_name (type));*/
 
diff --git a/providers/postgres/gda-postgres-provider.c b/providers/postgres/gda-postgres-provider.c
index 5cb73d3e0..675d53414 100644
--- a/providers/postgres/gda-postgres-provider.c
+++ b/providers/postgres/gda-postgres-provider.c
@@ -1664,8 +1664,8 @@ gda_postgres_provider_statement_prepare (GdaServerProvider *provider, GdaConnect
         ps = gda_postgres_pstmt_new (cnc, cdata->pconn, prep_stm_name);
        g_free (prep_stm_name);
        gda_pstmt_set_gda_statement (_GDA_PSTMT (ps), stmt);
-        _GDA_PSTMT (ps)->param_ids = param_ids;
-        _GDA_PSTMT (ps)->sql = sql;
+        gda_pstmt_set_param_ids (_GDA_PSTMT (ps), param_ids);
+        gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
        if (sql_can_cause_date_format_change (sql))
                ps->date_format_change = TRUE;
 
@@ -1723,8 +1723,8 @@ prepare_stmt_simple (PostgresConnectionData *cdata, const gchar *sql, GError **e
                GdaPostgresPStmt *ps;
                PQclear (pg_res);
                ps = gda_postgres_pstmt_new (cdata->cnc, cdata->pconn, prep_stm_name);
-               _GDA_PSTMT (ps)->param_ids = NULL;
-               _GDA_PSTMT (ps)->sql = g_strdup (sql);
+               gda_pstmt_set_param_ids (_GDA_PSTMT (ps), NULL);
+               gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
                if (sql_can_cause_date_format_change (sql))
                        ps->date_format_change = TRUE;
 
@@ -2020,13 +2020,13 @@ gda_postgres_provider_statement_execute (GdaServerProvider *provider, GdaConnect
        gint nb_params;
        gboolean transaction_started = FALSE;
 
-       nb_params = g_slist_length (_GDA_PSTMT (ps)->param_ids);
+       nb_params = g_slist_length (gda_pstmt_get_param_ids (_GDA_PSTMT (ps)));
        param_values = g_new0 (char *, nb_params);
        param_lengths = g_new0 (int, nb_params);
        param_formats = g_new0 (int, nb_params);
        param_mem = g_new0 (gboolean, nb_params);
 
-       for (i = 0, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+       for (i = 0, list = gda_pstmt_get_param_ids (_GDA_PSTMT (ps)); list; list = list->next, i++) {
                const gchar *pname = (gchar *) list->data;
                GdaHolder *h = NULL;
 
@@ -2148,15 +2148,15 @@ gda_postgres_provider_statement_execute (GdaServerProvider *provider, GdaConnect
                                gtps = (GdaPStmt *) tps;
 
                                /* keep @param_ids to avoid being cleared by gda_pstmt_copy_contents() */
-                               prep_param_ids = gtps->param_ids;
-                               gtps->param_ids = NULL;
+                               prep_param_ids = gda_pstmt_get_param_ids (_GDA_PSTMT (gtps));
+                               gda_pstmt_set_param_ids (gtps, NULL);
                                
                                /* actual copy */
                                gda_pstmt_copy_contents ((GdaPStmt *) ps, (GdaPStmt *) tps);
 
                                /* restore previous @param_ids */
-                               copied_param_ids = gtps->param_ids;
-                               gtps->param_ids = prep_param_ids;
+                               copied_param_ids =  gda_pstmt_get_param_ids (gtps);
+                               gda_pstmt_set_param_ids (gtps, prep_param_ids);
 
                                /* execute */
                                obj = gda_postgres_provider_statement_execute (provider, cnc,
@@ -2168,7 +2168,7 @@ gda_postgres_provider_statement_execute (GdaServerProvider *provider, GdaConnect
                                g_slist_foreach (prep_param_ids, (GFunc) g_free, NULL);
                                g_slist_free (prep_param_ids);
 
-                               gtps->param_ids = copied_param_ids;
+                               gda_pstmt_set_param_ids (gtps, copied_param_ids);
 
                                /*if (GDA_IS_DATA_MODEL (obj))
                                  gda_data_model_dump ((GdaDataModel*) obj, NULL);*/
@@ -2285,8 +2285,8 @@ gda_postgres_provider_statement_execute (GdaServerProvider *provider, GdaConnect
 
        /* add a connection event for the execution */
        event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_COMMAND);
-        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
-        gda_connection_add_event (cnc, event);
+       gda_connection_event_set_description (event,  gda_pstmt_get_sql (_GDA_PSTMT (ps)));
+       gda_connection_add_event (cnc, event);
 
        /* execute prepared statement using C API: random access based */
        PGresult *pg_res;
diff --git a/providers/postgres/gda-postgres-recordset.c b/providers/postgres/gda-postgres-recordset.c
index 91f599fae..a22e4e5ba 100644
--- a/providers/postgres/gda-postgres-recordset.c
+++ b/providers/postgres/gda-postgres-recordset.c
@@ -265,59 +265,60 @@ static void
 finish_prep_stmt_init (PostgresConnectionData *cdata, GdaPostgresPStmt *ps, PGresult *pg_res, GType 
*col_types)
 {
        /* make sure @ps reports the correct number of columns */
-        if (_GDA_PSTMT (ps)->ncols < 0) {
+        if ( gda_pstmt_get_ncols (_GDA_PSTMT (ps)) < 0) {
                if (pg_res)
-                       _GDA_PSTMT (ps)->ncols = PQnfields (pg_res);
+                       gda_pstmt_set_cols (_GDA_PSTMT (ps), PQnfields (pg_res), gda_pstmt_get_types 
(_GDA_PSTMT (ps)));
                else
-                       _GDA_PSTMT (ps)->ncols = 0;
+                       gda_pstmt_set_cols (_GDA_PSTMT (ps), 0, gda_pstmt_get_types (_GDA_PSTMT (ps)));
        }
 
         /* completing @ps if not yet done */
-        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+        if (!gda_pstmt_get_types (_GDA_PSTMT (ps)) && (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) > 0)) {
                /* create prepared statement's columns */
                GSList *list;
                gint i;
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
-                                                                        gda_column_new ());
-               _GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps),
+                                                   g_slist_prepend (gda_pstmt_get_tmpl_columns (_GDA_PSTMT 
(ps)),
+                                                   gda_column_new ()));
+               gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_reverse (gda_pstmt_get_tmpl_columns 
(_GDA_PSTMT (ps))));
 
                /* create prepared statement's types, all types are initialized to GDA_TYPE_NULL */
-               _GDA_PSTMT (ps)->types = g_new (GType, _GDA_PSTMT (ps)->ncols);
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->types [i] = GDA_TYPE_NULL;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)), g_new (GType, 
gda_pstmt_get_ncols (_GDA_PSTMT (ps))));
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = GDA_TYPE_NULL;
 
                if (col_types) {
                        for (i = 0; ; i++) {
                                if (col_types [i] > 0) {
                                        if (col_types [i] == G_TYPE_NONE)
                                                break;
-                                       if (i >= _GDA_PSTMT (ps)->ncols) {
+                                       if (i >= gda_pstmt_get_ncols (_GDA_PSTMT (ps))) {
                                                g_warning (_("Column %d out of range (0-%d), ignoring its 
specified type"), i,
-                                                          _GDA_PSTMT (ps)->ncols - 1);
+                                                          gda_pstmt_get_ncols (_GDA_PSTMT (ps)) - 1);
                                                break;
                                        }
                                        else
-                                               _GDA_PSTMT (ps)->types [i] = col_types [i];
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = col_types [i];
                                }
                        }
                }
                
                /* fill GdaColumn's data */
-               for (i=0, list = _GDA_PSTMT (ps)->tmpl_columns; 
-                    i < GDA_PSTMT (ps)->ncols; 
+               for (i=0, list = gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps));
+                    i <gda_pstmt_get_ncols ( GDA_PSTMT (ps));
                     i++, list = list->next) {
                        GdaColumn *column;
                        Oid postgres_type;
                        GType gtype;
                        column = GDA_COLUMN (list->data);
                        postgres_type = PQftype (pg_res, i);
-                       gtype = _GDA_PSTMT (ps)->types [i];
+                       gtype = gda_pstmt_get_types (_GDA_PSTMT (ps)) [i];
                        if (gtype == GDA_TYPE_NULL) {
                                gtype = _gda_postgres_type_oid_to_gda (cdata->cnc, cdata->reuseable, 
postgres_type);
-                               _GDA_PSTMT (ps)->types [i] = gtype;
+                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = gtype;
                        }
-                       _GDA_PSTMT (ps)->types [i] = gtype;
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = gtype;
                        gda_column_set_g_type (column, gtype);
                        gda_column_set_name (column, PQfname (pg_res, i));
                        gda_column_set_description (column, PQfname (pg_res, i));
@@ -806,14 +807,14 @@ set_prow_with_pg_res (GdaPostgresRecordset *imodel, GdaRow *prow, gint pg_res_ro
        gchar *thevalue;
        gint col;
 
-       for (col = 0; col < gda_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->ncols; col++) {
+       for (col = 0; col < gda_pstmt_get_ncols (gda_data_select_get_prep_stmt ((GdaDataSelect*) imodel)); 
col++) {
                thevalue = PQgetvalue (imodel->priv->pg_res, pg_res_rownum, col);
                if (thevalue && (*thevalue != '\0' ? FALSE : PQgetisnull (imodel->priv->pg_res, 
pg_res_rownum, col)))
                        gda_value_set_null (gda_row_get_value (prow, col));
                else
                        set_value (gda_data_select_get_connection ((GdaDataSelect*) imodel),
                                   prow, gda_row_get_value (prow, col), 
-                                  gda_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->types [col],
+                                  gda_pstmt_get_types (gda_data_select_get_prep_stmt ((GdaDataSelect*) 
imodel)) [col],
                                   thevalue, 
                                   PQgetlength (imodel->priv->pg_res, pg_res_rownum, col), error);
        }
@@ -826,7 +827,7 @@ new_row_from_pg_res (GdaPostgresRecordset *imodel, gint pg_res_rownum, GError **
        g_return_val_if_fail (GDA_IS_DATA_SELECT (imodel), NULL);
        GdaRow *prow;
 
-       prow = gda_row_new (gda_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->ncols);
+       prow = gda_row_new (gda_pstmt_get_ncols (gda_data_select_get_prep_stmt ((GdaDataSelect*) imodel)));
        set_prow_with_pg_res (imodel, prow, pg_res_rownum, error);
        return prow;
 }
diff --git a/providers/skel-implementation/capi/gda-capi-provider.c 
b/providers/skel-implementation/capi/gda-capi-provider.c
index bc12f4981..c7bb6acc6 100644
--- a/providers/skel-implementation/capi/gda-capi-provider.c
+++ b/providers/skel-implementation/capi/gda-capi-provider.c
@@ -1071,8 +1071,8 @@ gda_capi_provider_statement_prepare (GdaServerProvider *provider, GdaConnection
        /* create a prepared statement object */
        /*ps = gda_capi_pstmt_new (...);*/
        gda_pstmt_set_gda_statement (_GDA_PSTMT (ps), stmt);
-        _GDA_PSTMT (ps)->param_ids = param_ids;
-        _GDA_PSTMT (ps)->sql = sql;
+       gda_pstmt_set_param_ids ( _GDA_PSTMT (ps), param_ids);
+        gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
 
        gda_connection_add_prepared_statement (cnc, stmt, (GdaPStmt *) ps);
        g_object_unref (ps);
@@ -1159,7 +1159,7 @@ gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection
        GSList *list;
        GdaConnectionEvent *event = NULL;
        int i;
-       for (i = 1, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+       for (i = 1, list = gda_pstmt_get_param_ids (_GDA_PSTMT (ps)); list; list = list->next, i++) {
                const gchar *pname = (gchar *) list->data;
                GdaHolder *h;
                
@@ -1277,15 +1277,15 @@ gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection
                                gtps = (GdaPStmt *) tps;
 
                                /* keep @param_ids to avoid being cleared by gda_pstmt_copy_contents() */
-                               prep_param_ids = gtps->param_ids;
-                               gtps->param_ids = NULL;
+                               gda_pstmt_set_param_ids (prep_param_ids, gda_pstmt_get_param_ids (gtps));
+                               gda_pstmt_set_param_ids (gtps, NULL);
                                
                                /* actual copy */
                                gda_pstmt_copy_contents ((GdaPStmt *) ps, (GdaPStmt *) tps);
 
                                /* restore previous @param_ids */
-                               copied_param_ids = gtps->param_ids;
-                               gtps->param_ids = prep_param_ids;
+                               copied_param_ids = gda_pstmt_get_param_ids (gtps);
+                               gda_pstmt_set_param_ids (gtps, prep_param_ids);
 
                                /* execute */
                                obj = gda_capi_provider_statement_execute (provider, cnc,
@@ -1298,7 +1298,7 @@ gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection
                                g_slist_foreach (prep_param_ids, (GFunc) g_free, NULL);
                                g_slist_free (prep_param_ids);
 
-                               gtps->param_ids = copied_param_ids;
+                               gda_pstmt_set_param_ids (gtps, copied_param_ids);
 
                                /*if (GDA_IS_DATA_MODEL (obj))
                                  gda_data_model_dump ((GdaDataModel*) obj, NULL);*/
@@ -1325,7 +1325,7 @@ gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection
        
        /* add a connection event for the execution */
        event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_COMMAND);
-        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
+        gda_connection_event_set_description (event, gda_pstmt_get_sql (_GDA_PSTMT (ps)));
         gda_connection_add_event (cnc, event);
 
        if (empty_rs) {
@@ -1359,8 +1359,8 @@ gda_capi_provider_statement_execute (GdaServerProvider *provider, GdaConnection
        }
        
        /* execute prepared statement using C API depending on its kind */
-       if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SELECT", 6) ||
-            ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "EXPLAIN", 7)) {
+       if (! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "SELECT", 6) ||
+            ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "EXPLAIN", 7)) {
                GObject *data_model;
                GdaDataModelAccessFlags flags;
 
diff --git a/providers/skel-implementation/capi/gda-capi-recordset.c 
b/providers/skel-implementation/capi/gda-capi-recordset.c
index 55967a55e..104749a91 100644
--- a/providers/skel-implementation/capi/gda-capi-recordset.c
+++ b/providers/skel-implementation/capi/gda-capi-recordset.c
@@ -158,43 +158,43 @@ gda_capi_recordset_new (GdaConnection *cnc, GdaCapiPStmt *ps, GdaSet *exec_param
                return NULL;
 
        /* make sure @ps reports the correct number of columns using the API*/
-        if (_GDA_PSTMT (ps)->ncols < 0)
-                /*_GDA_PSTMT (ps)->ncols = ...;*/
+        if (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) < 0)
+                /*gda_pstmt_set_ncols (_GDA_PSTMT (ps),  ...);*/
                TO_IMPLEMENT;
 
         /* completing @ps if not yet done */
-        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+        if (!gda_pstmt_get_types (_GDA_PSTMT (ps)) && (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) > 0)) {
                /* create prepared statement's columns */
                GSList *list;
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
-                                                                        gda_column_new ());
-               _GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_prepend 
(gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps)),
+                                                                        gda_column_new ()));
+               gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps), g_slist_reverse (gda_pstmt_get_tmpl_columns 
(_GDA_PSTMT (ps))));
 
                /* create prepared statement's types, all types are initialized to GDA_TYPE_NULL */
-               _GDA_PSTMT (ps)->types = g_new (GType, _GDA_PSTMT (ps)->ncols);
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->types [i] = GDA_TYPE_NULL;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)), g_new (GType, 
gda_pstmt_get_ncols (_GDA_PSTMT (ps))));
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = GDA_TYPE_NULL;
 
                if (col_types) {
                        for (i = 0; ; i++) {
                                if (col_types [i] > 0) {
                                        if (col_types [i] == G_TYPE_NONE)
                                                break;
-                                       if (i >= _GDA_PSTMT (ps)->ncols) {
+                                       if (i >= gda_pstmt_get_ncols (_GDA_PSTMT (ps))) {
                                                g_warning (_("Column %d out of range (0-%d), ignoring its 
specified type"), i,
-                                                          _GDA_PSTMT (ps)->ncols - 1);
+                                                          gda_pstmt_get_ncols (_GDA_PSTMT (ps)) - 1);
                                                break;
                                        }
                                        else
-                                               _GDA_PSTMT (ps)->types [i] = col_types [i];
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = col_types [i];
                                }
                        }
                }
                
                /* fill GdaColumn's data */
-               for (i=0, list = _GDA_PSTMT (ps)->tmpl_columns; 
-                    i < GDA_PSTMT (ps)->ncols; 
+               for (i=0, list = gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps));
+                    i < gda_pstmt_get_ncols (_GDA_PSTMT (ps));
                     i++, list = list->next) {
                        GdaColumn *column;
                        
diff --git a/providers/web/gda-web-provider.c b/providers/web/gda-web-provider.c
index 41154f09e..a7891f24d 100644
--- a/providers/web/gda-web-provider.c
+++ b/providers/web/gda-web-provider.c
@@ -1331,8 +1331,8 @@ gda_web_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *
                goto out;
 
        gda_pstmt_set_gda_statement (_GDA_PSTMT (ps), stmt);
-       _GDA_PSTMT (ps)->param_ids = param_ids;
-       _GDA_PSTMT (ps)->sql = sql;
+       gda_pstmt_set_param_ids (_GDA_PSTMT (ps), param_ids);
+       gda_pstmt_set_sql (_GDA_PSTMT (ps), sql);
 
        gda_connection_add_prepared_statement (cnc, stmt, (GdaPStmt *) ps);
        g_object_unref (ps);
@@ -1422,15 +1422,15 @@ gda_web_provider_statement_execute (GdaServerProvider *provider, GdaConnection *
        xmlNewChild (root, NULL, BAD_CAST "token", BAD_CAST token);
        g_free (token);
        cmdnode = xmlNewChild (root, NULL, BAD_CAST "cmd", BAD_CAST "EXEC");
-       node = xmlNewTextChild (cmdnode, NULL, BAD_CAST "sql", BAD_CAST _GDA_PSTMT (ps)->sql);
+       node = xmlNewTextChild (cmdnode, NULL, BAD_CAST "sql", BAD_CAST gda_pstmt_get_sql (_GDA_PSTMT (ps)));
        if ((gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_SELECT) ||
            (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_COMPOUND))
                xmlSetProp (node, BAD_CAST "type", BAD_CAST "SELECT");
        else if (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_UNKNOWN) {
-               if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "select", 6) ||
-                   ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "pragma", 6) ||
-                   ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "show", 4) ||
-                   ! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "describe", 8))
+               if (! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "select", 6) ||
+                   ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "pragma", 6) ||
+                   ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "show", 4) ||
+                   ! g_ascii_strncasecmp (gda_pstmt_get_sql (_GDA_PSTMT (ps)), "describe", 8))
                        xmlSetProp (node, BAD_CAST "type", BAD_CAST "SELECT");
        }
        xmlNewChild (cmdnode, NULL, BAD_CAST "preparehash", BAD_CAST (ps->pstmt_hash));
@@ -1440,10 +1440,10 @@ gda_web_provider_statement_execute (GdaServerProvider *provider, GdaConnection *
        GdaConnectionEvent *event = NULL;
        int i;
        xmlNodePtr argsnode;
-       if (_GDA_PSTMT (ps)->param_ids)
+       if (gda_pstmt_get_param_ids (_GDA_PSTMT (ps)))
                argsnode = xmlNewChild (cmdnode, NULL, BAD_CAST "arguments", NULL);
 
-       for (i = 1, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
+       for (i = 1, list = gda_pstmt_get_param_ids (_GDA_PSTMT (ps)); list; list = list->next, i++) {
                const gchar *pname = (gchar *) list->data;
                GdaHolder *h;
                
@@ -1569,15 +1569,15 @@ gda_web_provider_statement_execute (GdaServerProvider *provider, GdaConnection *
                                gtps = (GdaPStmt *) tps;
 
                                /* keep @param_ids to avoid being cleared by gda_pstmt_copy_contents() */
-                               prep_param_ids = gtps->param_ids;
-                               gtps->param_ids = NULL;
+                               prep_param_ids = gda_pstmt_get_param_ids (_GDA_PSTMT (gtps));
+                               gda_pstmt_set_param_ids (_GDA_PSTMT (gtps), NULL);
                                
                                /* actual copy */
                                gda_pstmt_copy_contents ((GdaPStmt *) ps, (GdaPStmt *) tps);
 
                                /* restore previous @param_ids */
-                               copied_param_ids = gtps->param_ids;
-                               gtps->param_ids = prep_param_ids;
+                               copied_param_ids = gda_pstmt_get_param_ids (_GDA_PSTMT (gtps));
+                               gda_pstmt_set_param_ids (_GDA_PSTMT (gtps), prep_param_ids);
 
                                /* execute */
                                obj = gda_web_provider_statement_execute (provider, cnc,
@@ -1589,7 +1589,7 @@ gda_web_provider_statement_execute (GdaServerProvider *provider, GdaConnection *
                                g_slist_foreach (prep_param_ids, (GFunc) g_free, NULL);
                                g_slist_free (prep_param_ids);
 
-                               gtps->param_ids = copied_param_ids;
+                               gda_pstmt_set_param_ids (gtps, copied_param_ids);
 
                                /*if (GDA_IS_DATA_MODEL (obj))
                                  gda_data_model_dump ((GdaDataModel*) obj, NULL);*/
@@ -1618,7 +1618,7 @@ gda_web_provider_statement_execute (GdaServerProvider *provider, GdaConnection *
        
        /* add a connection event for the execution */
        event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_COMMAND);
-        gda_connection_event_set_description (event, _GDA_PSTMT (ps)->sql);
+        gda_connection_event_set_description (event, gda_pstmt_get_sql (_GDA_PSTMT (ps)));
         gda_connection_add_event (cnc, event);
 
        if (empty_rs) {
diff --git a/providers/web/gda-web-recordset.c b/providers/web/gda-web-recordset.c
index 796ae8f09..67e62f769 100644
--- a/providers/web/gda-web-recordset.c
+++ b/providers/web/gda-web-recordset.c
@@ -155,41 +155,45 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
                return FALSE;
 
        /* make sure @ps reports the correct number of columns using the API*/
-        if (_GDA_PSTMT (ps)->ncols < 0) {
+       if (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) < 0) {
                xmlNodePtr child;
-               _GDA_PSTMT (ps)->ncols = 0;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), 0,
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)));
                for (child = data_node->children; child; child = child->next) {
                        if (!strcmp ((gchar*) child->name, "gda_array_field"))
-                               _GDA_PSTMT (ps)->ncols ++;
+                               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)) + 
1,
+                                                   gda_pstmt_get_types (_GDA_PSTMT (ps)));
                }
        }
 
         /* completing @ps if not yet done */
-        if (!_GDA_PSTMT (ps)->types && (_GDA_PSTMT (ps)->ncols > 0)) {
+        if (!gda_pstmt_get_types (_GDA_PSTMT (ps)) && (gda_pstmt_get_ncols (_GDA_PSTMT (ps)) > 0)) {
                /* create prepared statement's columns */
                GSList *list;
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->tmpl_columns = g_slist_prepend (_GDA_PSTMT (ps)->tmpl_columns, 
-                                                                        gda_column_new ());
-               _GDA_PSTMT (ps)->tmpl_columns = g_slist_reverse (_GDA_PSTMT (ps)->tmpl_columns);
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps),
+                                                  g_slist_prepend (gda_pstmt_get_tmpl_columns (_GDA_PSTMT 
(ps)),
+                                                                   gda_column_new ()));
+               gda_pstmt_set_tmpl_columns (_GDA_PSTMT (ps),
+                                           g_slist_reverse (gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps))));
 
                /* create prepared statement's types, all types are initialized to GDA_TYPE_NULL */
-               _GDA_PSTMT (ps)->types = g_new (GType, _GDA_PSTMT (ps)->ncols);
-               for (i = 0; i < _GDA_PSTMT (ps)->ncols; i++)
-                       _GDA_PSTMT (ps)->types [i] = GDA_TYPE_NULL;
+               gda_pstmt_set_cols (_GDA_PSTMT (ps), gda_pstmt_get_ncols (_GDA_PSTMT (ps)), g_new (GType, 
gda_pstmt_get_ncols (_GDA_PSTMT (ps))));
+               for (i = 0; i < gda_pstmt_get_ncols (_GDA_PSTMT (ps)); i++)
+                       gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = GDA_TYPE_NULL;
 
                if (col_types) {
                        for (i = 0; ; i++) {
                                if (col_types [i] > 0) {
                                        if (col_types [i] == G_TYPE_NONE)
                                                break;
-                                       if (i >= _GDA_PSTMT (ps)->ncols) {
+                                       if (i >= gda_pstmt_get_ncols (_GDA_PSTMT (ps))) {
                                                g_warning (_("Column %d out of range (0-%d), ignoring its 
specified type"), i,
-                                                          _GDA_PSTMT (ps)->ncols - 1);
+                                                          gda_pstmt_get_ncols (_GDA_PSTMT (ps)) - 1);
                                                break;
                                        }
                                        else
-                                               _GDA_PSTMT (ps)->types [i] = col_types [i];
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = col_types [i];
                                }
                        }
                }
@@ -197,8 +201,8 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
                /* fill GdaColumn's data */
                xmlNodePtr child;
 
-               for (child = data_node->children, i = 0, list = _GDA_PSTMT (ps)->tmpl_columns; 
-                    child && (i < GDA_PSTMT (ps)->ncols);
+               for (child = data_node->children, i = 0, list = gda_pstmt_get_tmpl_columns (_GDA_PSTMT (ps));
+                    child && (i < gda_pstmt_get_ncols (GDA_PSTMT (ps)));
                     child = child->next, i++, list = list->next) {
                        GdaColumn *column;
                        xmlChar *prop;
@@ -208,7 +212,7 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
                                child = child->next;
                        column = GDA_COLUMN (list->data);
 
-                       if (_GDA_PSTMT (ps)->types [i] == GDA_TYPE_NULL) {
+                       if (gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] == GDA_TYPE_NULL) {
                                if (cdata && cdata->reuseable && cdata->reuseable->operations->re_get_type) {
                                        prop = xmlGetProp (child, BAD_CAST "dbtype");
                                        if (prop) {
@@ -216,7 +220,7 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
                                                type = cdata->reuseable->operations->re_get_type (cnc, 
cdata->reuseable,
                                                                                                  (gchar*) 
prop);
                                                if (type != GDA_TYPE_NULL) {
-                                                       _GDA_PSTMT (ps)->types [i] = type;
+                                                       gda_pstmt_get_types (GDA_PSTMT (ps)) [i] = type;
                                                        gda_column_set_g_type (column, type);
                                                        typeset = TRUE;
                                                }
@@ -231,18 +235,18 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
                                                type = gda_g_type_from_string ((gchar*) prop);
                                                if (type == G_TYPE_INVALID)
                                                        type = GDA_TYPE_NULL;
-                                               _GDA_PSTMT (ps)->types [i] = type;
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = type;
                                                gda_column_set_g_type (column, type);
                                                xmlFree (prop);
                                        }
                                        else {
-                                               _GDA_PSTMT (ps)->types [i] = G_TYPE_STRING;
+                                               gda_pstmt_get_types (_GDA_PSTMT (ps)) [i] = G_TYPE_STRING;
                                                gda_column_set_g_type (column, G_TYPE_STRING);
                                        }
                                }
                        }
                        else
-                               gda_column_set_g_type (column, _GDA_PSTMT (ps)->types [i]);
+                               gda_column_set_g_type (column, gda_pstmt_get_types (_GDA_PSTMT (ps)) [i]);
                        prop = xmlGetProp (child, BAD_CAST "name");
                        if (prop && *prop) {
                                gda_column_set_name (column, (gchar*) prop);


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