[libgda] DataSelect: renamed private methods for providers implementations
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] DataSelect: renamed private methods for providers implementations
- Date: Thu, 21 Feb 2019 16:24:07 +0000 (UTC)
commit 4f716d0c3e9d777d8647c3293234e8e589e717fa
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Thu Feb 21 10:16:11 2019 -0600
DataSelect: renamed private methods for providers implementations
libgda/gda-data-model-select.c | 35 ++++++++++++++++++++--
libgda/gda-data-select-private.h | 8 ++---
libgda/gda-data-select.c | 11 ++++---
libgda/sqlite/gda-sqlite-recordset.c | 24 +++++++--------
providers/mysql/gda-mysql-recordset.c | 26 ++++++++--------
providers/postgres/gda-postgres-recordset.c | 34 ++++++++++-----------
.../skel-implementation/capi/gda-capi-recordset.c | 6 ++--
providers/web/gda-web-recordset.c | 9 +++---
tests/data-models/check_pmodel.c | 2 ++
9 files changed, 94 insertions(+), 61 deletions(-)
---
diff --git a/libgda/gda-data-model-select.c b/libgda/gda-data-model-select.c
index bb23ef37d..aec233981 100644
--- a/libgda/gda-data-model-select.c
+++ b/libgda/gda-data-model-select.c
@@ -259,7 +259,7 @@ GdaSet*
gda_data_model_select_get_parameters (GdaDataModelSelect *model)
{
g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (GDA_IS_CONNECTION (model), NULL);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
if (priv->params == NULL) {
gda_statement_get_parameters (priv->stm, &priv->params, NULL);
@@ -276,7 +276,8 @@ gda_data_model_select_get_parameters (GdaDataModelSelect *model)
void
gda_data_model_select_set_parameters (GdaDataModelSelect *model, GdaSet *params)
{
- g_return_if_fail (model);
+ g_return_if_fail (model != NULL);
+ g_return_if_fail (GDA_IS_DATA_MODEL_SELECT (model));
g_return_if_fail (params != NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
if (priv->params != NULL) {
@@ -296,6 +297,8 @@ gda_data_model_select_set_parameters (GdaDataModelSelect *model, GdaSet *params
static gint
gda_data_model_select_get_n_rows (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, -1);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), -1);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, 0);
return gda_data_model_get_n_rows (priv->model);
@@ -303,6 +306,8 @@ gda_data_model_select_get_n_rows (GdaDataModel *model)
static gint
gda_data_model_select_get_n_columns (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, -1);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), -1);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, 0);
return gda_data_model_get_n_columns (priv->model);
@@ -311,6 +316,8 @@ static GdaColumn*
gda_data_model_select_describe_column (GdaDataModel *model,
gint col)
{
+ g_return_val_if_fail (model != NULL, NULL);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, NULL);
return gda_data_model_describe_column (priv->model, col);
@@ -318,6 +325,8 @@ gda_data_model_select_describe_column (GdaDataModel *model,
static GdaDataModelAccessFlags
gda_data_model_select_get_access_flags (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, 0);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), 0);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, 0);
return gda_data_model_get_access_flags (priv->model);
@@ -328,6 +337,8 @@ gda_data_model_select_get_value_at (GdaDataModel *model,
gint row,
GError **error)
{
+ g_return_val_if_fail (model != NULL, NULL);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, NULL);
return gda_data_model_get_value_at (priv->model, col, row, error);
@@ -337,6 +348,8 @@ gda_data_model_select_get_attributes_at (GdaDataModel *model,
gint col,
gint row)
{
+ g_return_val_if_fail (model != NULL, 0);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), 0);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, 0);
return gda_data_model_get_attributes_at (priv->model, col, row);
@@ -345,6 +358,8 @@ gda_data_model_select_get_attributes_at (GdaDataModel *model,
static GdaDataModelIter*
gda_data_model_select_create_iter (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, NULL);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, NULL);
return gda_data_model_create_iter (priv->model);
@@ -357,6 +372,8 @@ gda_data_model_select_set_value_at (GdaDataModel *model,
const GValue *value,
GError **error)
{
+ g_return_val_if_fail (model != NULL, FALSE);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), FALSE);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, FALSE);
return gda_data_model_set_value_at (priv->model, col, row, value, error);
@@ -368,6 +385,8 @@ gda_data_model_select_set_values (GdaDataModel *model,
GList *values,
GError **error)
{
+ g_return_val_if_fail (model != NULL, FALSE);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), FALSE);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, FALSE);
return gda_data_model_set_values (priv->model, row, values, error);
@@ -377,6 +396,8 @@ gda_data_model_select_append_values (GdaDataModel *model,
const GList *values,
GError **error)
{
+ g_return_val_if_fail (model != NULL, -1);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), -1);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, -1);
return gda_data_model_append_values (priv->model, values, error);
@@ -386,6 +407,8 @@ gda_data_model_select_remove_row (GdaDataModel *model,
gint row,
GError **error)
{
+ g_return_val_if_fail (model != NULL, FALSE);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), FALSE);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, FALSE);
return gda_data_model_remove_row (priv->model, row, error);
@@ -394,6 +417,8 @@ gda_data_model_select_remove_row (GdaDataModel *model,
static void
gda_data_model_select_freeze (GdaDataModel *model)
{
+ g_return_if_fail (model != NULL);
+ g_return_if_fail (GDA_IS_DATA_MODEL_SELECT (model));
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_if_fail (priv->model != NULL);
return gda_data_model_freeze (priv->model);
@@ -401,6 +426,8 @@ gda_data_model_select_freeze (GdaDataModel *model)
static void
gda_data_model_select_thaw (GdaDataModel *model)
{
+ g_return_if_fail (model != NULL);
+ g_return_if_fail (GDA_IS_DATA_MODEL_SELECT (model));
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_if_fail (priv->model != NULL);
return gda_data_model_thaw (priv->model);
@@ -408,6 +435,8 @@ gda_data_model_select_thaw (GdaDataModel *model)
static gboolean
gda_data_model_select_get_notify (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, FALSE);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), FALSE);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, FALSE);
return gda_data_model_get_notify (priv->model);
@@ -415,6 +444,8 @@ gda_data_model_select_get_notify (GdaDataModel *model)
static GError**
gda_data_model_select_get_exceptions (GdaDataModel *model)
{
+ g_return_val_if_fail (model != NULL, NULL);
+ g_return_val_if_fail (GDA_IS_DATA_MODEL_SELECT (model), NULL);
GdaDataModelSelectPrivate *priv = gda_data_model_select_get_instance_private (GDA_DATA_MODEL_SELECT
(model));
g_return_val_if_fail (priv->model != NULL, FALSE);
return gda_data_model_get_exceptions (priv->model);
diff --git a/libgda/gda-data-select-private.h b/libgda/gda-data-select-private.h
index 85430af81..860aff0f8 100644
--- a/libgda/gda-data-select-private.h
+++ b/libgda/gda-data-select-private.h
@@ -21,10 +21,10 @@
#define __GDA_DATA_SELECT_PRIVATE_H__
-GdaPStmt *_gda_data_select_get_prep_stmt (GdaDataSelect *model);
-gint _gda_data_select_get_nb_stored_rows (GdaDataSelect *model);
-gint _gda_data_select_get_advertized_nrows (GdaDataSelect *model);
-void _gda_data_select_set_advertized_nrows (GdaDataSelect *model, gint n);
+GdaPStmt *gda_data_select_get_prep_stmt (GdaDataSelect *model);
+gint gda_data_select_get_nb_stored_rows (GdaDataSelect *model);
+gint gda_data_select_get_advertized_nrows (GdaDataSelect *model);
+void gda_data_select_set_advertized_nrows (GdaDataSelect *model, gint n);
G_END_DECLS
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 84408124c..c0fafe9fe 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -1800,8 +1800,6 @@ gda_data_select_get_n_rows (GdaDataModel *model)
static gint
gda_data_select_get_n_columns (GdaDataModel *model)
{
- GdaDataSelect *imodel;
-
GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (GDA_DATA_SELECT (model));
if (priv->prep_stmt)
@@ -4085,27 +4083,28 @@ _gda_data_select_fetch_at (GdaDataSelect *model, GdaRow **prow, gint rownum
/* Private API for providers */
GdaPStmt*
-_gda_data_select_get_prep_stmt (GdaDataSelect *model)
+gda_data_select_get_prep_stmt (GdaDataSelect *model)
{
GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (model);
return priv->prep_stmt;
}
gint
-_gda_data_select_get_nb_stored_rows (GdaDataSelect *model)
+gda_data_select_get_nb_stored_rows (GdaDataSelect *model)
{
GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (model);
return priv->nb_stored_rows;
}
gint
-_gda_data_select_get_advertized_nrows (GdaDataSelect *model)
+gda_data_select_get_advertized_nrows (GdaDataSelect *model)
{
GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (model);
return priv->advertized_nrows;
}
+
void
-_gda_data_select_set_advertized_nrows (GdaDataSelect *model, gint n)
+gda_data_select_set_advertized_nrows (GdaDataSelect *model, gint n)
{
GdaDataSelectPrivate *priv = gda_data_select_get_instance_private (model);
priv->advertized_nrows = n;
diff --git a/libgda/sqlite/gda-sqlite-recordset.c b/libgda/sqlite/gda-sqlite-recordset.c
index fd18a2b84..aacacb111 100644
--- a/libgda/sqlite/gda-sqlite-recordset.c
+++ b/libgda/sqlite/gda-sqlite-recordset.c
@@ -113,7 +113,7 @@ gda_sqlite_recordset_dispose (GObject *object)
if (recset->priv) {
GdaSqlitePStmt *ps;
- ps = GDA_SQLITE_PSTMT (_gda_data_select_get_prep_stmt (GDA_DATA_SELECT (object)));
+ ps = GDA_SQLITE_PSTMT (gda_data_select_get_prep_stmt (GDA_DATA_SELECT (object)));
if (ps != NULL) {
ps->stmt_used = FALSE;
virt_cnc_set_working_obj (gda_data_select_get_connection ((GdaDataSelect*) recset),
recset);
@@ -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_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 [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_data_select_get_prep_stmt(pmodel)->types [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_data_select_get_prep_stmt(pmodel)->types
[missing_cols [i]]),
missing_cols [i]);
#endif
memmove (missing_cols + i, missing_cols + i + 1, sizeof (gint) * (nb_missing
- i - 1));
@@ -377,7 +377,7 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data_error (cnc, error);
if (!cdata)
return NULL;
- ps = GDA_SQLITE_PSTMT ( _gda_data_select_get_prep_stmt(GDA_DATA_SELECT (model)));
+ ps = GDA_SQLITE_PSTMT ( gda_data_select_get_prep_stmt(GDA_DATA_SELECT (model)));
virt_cnc_set_working_obj (gda_data_select_get_connection ((GdaDataSelect*) model), model);
@@ -673,7 +673,7 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
/* nothing to do */
break;
case SQLITE_DONE:
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), model->priv->next_row_num);
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), model->priv->next_row_num);
SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt);
break;
case SQLITE_READONLY:
@@ -696,7 +696,7 @@ fetch_next_sqlite_row (GdaSqliteRecordset *model, gboolean do_store, GError **er
gda_data_select_add_exception (GDA_DATA_SELECT (model), lerror);
if (rc == SQLITE_ERROR)
g_propagate_error (error, g_error_copy (lerror));
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), model->priv->next_row_num);
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), model->priv->next_row_num);
break;
}
}
@@ -717,13 +717,13 @@ gda_sqlite_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaRow *prow = NULL;
imodel = GDA_SQLITE_RECORDSET (model);
- if (_gda_data_select_get_advertized_nrows (model) >= 0)
- return _gda_data_select_get_advertized_nrows (model);
+ if (gda_data_select_get_advertized_nrows (model) >= 0)
+ return gda_data_select_get_advertized_nrows (model);
for (prow = fetch_next_sqlite_row (imodel, TRUE, NULL);
prow;
prow = fetch_next_sqlite_row (imodel, TRUE, NULL));
- return _gda_data_select_get_advertized_nrows (model);
+ return gda_data_select_get_advertized_nrows (model);
}
/*
diff --git a/providers/mysql/gda-mysql-recordset.c b/providers/mysql/gda-mysql-recordset.c
index 7d4e6bf3b..2431f694d 100644
--- a/providers/mysql/gda-mysql-recordset.c
+++ b/providers/mysql/gda-mysql-recordset.c
@@ -260,7 +260,7 @@ gda_mysql_recordset_dispose (GObject *object)
g_return_if_fail (GDA_IS_MYSQL_RECORDSET (recset));
if (recset->priv) {
- GDA_MYSQL_PSTMT (_gda_data_select_get_prep_stmt (GDA_DATA_SELECT (object)))->stmt_used =
FALSE;
+ GDA_MYSQL_PSTMT (gda_data_select_get_prep_stmt (GDA_DATA_SELECT (object)))->stmt_used = FALSE;
if (recset->priv->cnc) {
g_object_unref (G_OBJECT(recset->priv->cnc));
@@ -457,7 +457,7 @@ gda_mysql_recordset_new_direct (GdaConnection *cnc, GdaDataModelAccessFlags flag
MYSQL_FIELD *mysql_fields = mysql_fetch_fields (mysql_res);
GSList *list;
- _gda_data_select_set_advertized_nrows ((GdaDataSelect *) model, mysql_affected_rows (cdata->mysql));
+ gda_data_select_set_advertized_nrows ((GdaDataSelect *) model, mysql_affected_rows (cdata->mysql));
for (i=0, list = columns;
i < model->priv->ncols;
i++, list = list->next) {
@@ -705,7 +705,7 @@ gda_mysql_recordset_new (GdaConnection *cnc,
model->priv->mysql_stmt = ps->mysql_stmt;
- _gda_data_select_set_advertized_nrows ((GdaDataSelect *) model, mysql_stmt_affected_rows
(ps->mysql_stmt));
+ gda_data_select_set_advertized_nrows ((GdaDataSelect *) model, mysql_stmt_affected_rows
(ps->mysql_stmt));
return GDA_DATA_MODEL (model);
}
@@ -720,12 +720,12 @@ gda_mysql_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaMysqlRecordset *imodel;
imodel = GDA_MYSQL_RECORDSET (model);
- if (_gda_data_select_get_advertized_nrows (model) >= 0)
- return _gda_data_select_get_advertized_nrows (model);
+ if (gda_data_select_get_advertized_nrows (model) >= 0)
+ return gda_data_select_get_advertized_nrows (model);
- _gda_data_select_set_advertized_nrows (model, mysql_stmt_affected_rows (imodel->priv->mysql_stmt));
+ gda_data_select_set_advertized_nrows (model, mysql_stmt_affected_rows (imodel->priv->mysql_stmt));
- return _gda_data_select_get_advertized_nrows (model);
+ return gda_data_select_get_advertized_nrows (model);
}
static GdaRow *
@@ -736,7 +736,7 @@ new_row_from_mysql_stmt (GdaMysqlRecordset *imodel, G_GNUC_UNUSED gint rownum, G
MYSQL_BIND *mysql_bind_result;
g_return_val_if_fail (imodel->priv->mysql_stmt != NULL, NULL);
- mysql_bind_result = ((GdaMysqlPStmt *) _gda_data_select_get_prep_stmt ((GdaDataSelect *)
imodel))->mysql_bind_result;
+ mysql_bind_result = ((GdaMysqlPStmt *) gda_data_select_get_prep_stmt ((GdaDataSelect *)
imodel))->mysql_bind_result;
g_assert (mysql_bind_result);
res = mysql_stmt_fetch (imodel->priv->mysql_stmt);
@@ -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_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols; ++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_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols);
gint col;
- for (col = 0; col < _gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols; ++col) {
+ for (col = 0; col < gda_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->ncols; ++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_data_select_get_prep_stmt ((GdaDataSelect *) imodel)->types[i];
/*g_print ("%s: #%d : TYPE=%d, GTYPE=%s\n", __func__, i, mysql_bind_result[i].buffer_type,
g_type_name (type));*/
@@ -1062,7 +1062,7 @@ gda_mysql_recordset_fetch_random (GdaDataSelect *model,
gda_data_select_take_row (model, *row, rownum);
- if (_gda_data_select_get_nb_stored_rows (model) == _gda_data_select_get_advertized_nrows (model)) {
+ if (gda_data_select_get_nb_stored_rows (model) == gda_data_select_get_advertized_nrows (model)) {
/* All the row have been converted. We could free result now */
/* but it was done before provided no field-based API functions */
/* that process result set meta data was needed in the middle. */
diff --git a/providers/postgres/gda-postgres-recordset.c b/providers/postgres/gda-postgres-recordset.c
index 7024b565c..91f599fae 100644
--- a/providers/postgres/gda-postgres-recordset.c
+++ b/providers/postgres/gda-postgres-recordset.c
@@ -348,7 +348,7 @@ gda_postgres_recordset_new_random (GdaConnection *cnc, GdaPostgresPStmt *ps, Gda
"model-usage", GDA_DATA_MODEL_ACCESS_RANDOM,
"exec-params", exec_params, NULL);
model->priv->pg_res = pg_res;
- _gda_data_select_set_advertized_nrows ((GdaDataSelect*) model, PQntuples (model->priv->pg_res));
+ gda_data_select_set_advertized_nrows ((GdaDataSelect*) model, PQntuples (model->priv->pg_res));
return GDA_DATA_MODEL (model);
}
@@ -422,14 +422,14 @@ gda_postgres_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaPostgresRecordset *imodel;
imodel = GDA_POSTGRES_RECORDSET (model);
- if (_gda_data_select_get_advertized_nrows (model) >= 0)
- return _gda_data_select_get_advertized_nrows (model);
+ if (gda_data_select_get_advertized_nrows (model) >= 0)
+ return gda_data_select_get_advertized_nrows (model);
/* use C API to determine number of rows,if possible */
if (!imodel->priv->cursor_name)
- _gda_data_select_set_advertized_nrows (model, PQntuples (imodel->priv->pg_res));
+ gda_data_select_set_advertized_nrows (model, PQntuples (imodel->priv->pg_res));
- return _gda_data_select_get_advertized_nrows (model);
+ return gda_data_select_get_advertized_nrows (model);
}
/*
@@ -454,7 +454,7 @@ gda_postgres_recordset_fetch_random (GdaDataSelect *model, GdaRow **prow, gint r
*prow = new_row_from_pg_res (imodel, rownum, error);
gda_data_select_take_row (model, *prow, rownum);
- if (_gda_data_select_get_nb_stored_rows (model) == _gda_data_select_get_advertized_nrows (model)) {
+ if (gda_data_select_get_nb_stored_rows (model) == gda_data_select_get_advertized_nrows (model)) {
/* all the rows have been converted from PGresult to GdaRow objects => we can
* discard the PGresult */
PQclear (imodel->priv->pg_res);
@@ -479,7 +479,7 @@ gda_postgres_recordset_store_all (GdaDataSelect *model, GError **error)
return FALSE;
}
- for (i = 0; i < _gda_data_select_get_advertized_nrows (model); i++) {
+ for (i = 0; i < gda_data_select_get_advertized_nrows (model); i++) {
GdaRow *prow;
if (! gda_postgres_recordset_fetch_random (model, &prow, i, error))
return FALSE;
@@ -806,14 +806,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_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->ncols; 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_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->types [col],
thevalue,
PQgetlength (imodel->priv->pg_res, pg_res_rownum, col), error);
}
@@ -826,7 +826,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_data_select_get_prep_stmt ((GdaDataSelect*) imodel)->ncols);
set_prow_with_pg_res (imodel, prow, pg_res_rownum, error);
return prow;
}
@@ -884,9 +884,9 @@ fetch_next_chunk (GdaPostgresRecordset *model, gboolean *fetch_error, GError **e
/* GDA_DATA_SELECT (model)->advertized_nrows and model->priv->pg_pos */
if (nbtuples < model->priv->chunk_size) {
if (model->priv->pg_pos == G_MININT)
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model),
nbtuples);
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model),
nbtuples);
else
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT
(model),model->priv->pg_pos + nbtuples + 1);
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT
(model),model->priv->pg_pos + nbtuples + 1);
model->priv->pg_pos = G_MAXINT;
}
@@ -899,9 +899,9 @@ fetch_next_chunk (GdaPostgresRecordset *model, gboolean *fetch_error, GError **e
}
else {
if (model->priv->pg_pos == G_MININT)
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), 0);
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model), 0);
else
- _gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model),
model->priv->pg_pos + 1); /* total number of rows */
+ gda_data_select_set_advertized_nrows (GDA_DATA_SELECT (model),
model->priv->pg_pos + 1); /* total number of rows */
model->priv->pg_pos = G_MAXINT;
retval = FALSE;
}
@@ -927,7 +927,7 @@ fetch_prev_chunk (GdaPostgresRecordset *model, gboolean *fetch_error, GError **e
if (model->priv->pg_pos == G_MININT)
return FALSE;
else if (model->priv->pg_pos == G_MAXINT)
- g_assert (_gda_data_select_get_advertized_nrows (GDA_DATA_SELECT (model)) >= 0); /* total
number of rows MUST be known at this point */
+ g_assert (gda_data_select_get_advertized_nrows (GDA_DATA_SELECT (model)) >= 0); /* total
number of rows MUST be known at this point */
gchar *str;
gboolean retval = TRUE;
@@ -969,7 +969,7 @@ fetch_prev_chunk (GdaPostgresRecordset *model, gboolean *fetch_error, GError **e
if (nbtuples > 0) {
/* model->priv->pg_res_inf */
if (model->priv->pg_pos == G_MAXINT)
- model->priv->pg_res_inf = _gda_data_select_get_advertized_nrows
(GDA_DATA_SELECT (model)) - nbtuples;
+ model->priv->pg_res_inf = gda_data_select_get_advertized_nrows
(GDA_DATA_SELECT (model)) - nbtuples;
else
model->priv->pg_res_inf =
MAX (model->priv->pg_res_inf - (noffset - model->priv->chunk_size),
0);
@@ -980,7 +980,7 @@ fetch_prev_chunk (GdaPostgresRecordset *model, gboolean *fetch_error, GError **e
}
else {
if (model->priv->pg_pos == G_MAXINT)
- model->priv->pg_pos = _gda_data_select_get_advertized_nrows
(GDA_DATA_SELECT (model)) - 1;
+ model->priv->pg_pos = gda_data_select_get_advertized_nrows
(GDA_DATA_SELECT (model)) - 1;
else
model->priv->pg_pos = MAX (model->priv->pg_pos - noffset, -1) +
nbtuples;
}
diff --git a/providers/skel-implementation/capi/gda-capi-recordset.c
b/providers/skel-implementation/capi/gda-capi-recordset.c
index e1e05afc4..55967a55e 100644
--- a/providers/skel-implementation/capi/gda-capi-recordset.c
+++ b/providers/skel-implementation/capi/gda-capi-recordset.c
@@ -236,14 +236,14 @@ gda_capi_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaCapiRecordset *imodel;
imodel = GDA_CAPI_RECORDSET (model);
- if (_gda_data_select_get_advertized_nrows (model) >= 0)
- return _gda_data_select_get_advertized_nrows (model);
+ if (gda_data_select_get_advertized_nrows (model) >= 0)
+ return gda_data_select_get_advertized_nrows (model);
/* use C API to determine number of rows,if possible */
g_warning("imodel not used: %p", imodel); /* Avoids a compiler warning. */
TO_IMPLEMENT;
- return _gda_data_select_get_advertized_nrows (model);
+ return gda_data_select_get_advertized_nrows (model);
}
/*
diff --git a/providers/web/gda-web-recordset.c b/providers/web/gda-web-recordset.c
index f54dc6d54..796ae8f09 100644
--- a/providers/web/gda-web-recordset.c
+++ b/providers/web/gda-web-recordset.c
@@ -25,6 +25,7 @@
#include <libgda/gda-util.h>
#include <libgda/sql-parser/gda-sql-parser.h>
#include <libgda/gda-connection-private.h>
+#include <gda-data-model.h>
#include <gda-data-select-private.h>
#include "gda-web.h"
#include "gda-web-recordset.h"
@@ -325,13 +326,13 @@ gda_web_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaWebRecordset *imodel;
imodel = GDA_WEB_RECORDSET (model);
- if (_gda_data_select_get_advertized_nrows (model) >= 0)
- return _gda_data_select_get_advertized_nrows (model);
+ if (gda_data_select_get_advertized_nrows (model) >= 0)
+ return gda_data_select_get_advertized_nrows (model);
if (imodel->priv->real_model)
- _gda_data_select_set_advertized_nrows (model, gda_data_model_get_n_rows
(imodel->priv->real_model));
+ gda_data_select_set_advertized_nrows (model, gda_data_model_get_n_rows
(imodel->priv->real_model));
- return _gda_data_select_get_advertized_nrows (model);
+ return gda_data_select_get_advertized_nrows (model);
}
/*
diff --git a/tests/data-models/check_pmodel.c b/tests/data-models/check_pmodel.c
index faae30292..df57d40f1 100644
--- a/tests/data-models/check_pmodel.c
+++ b/tests/data-models/check_pmodel.c
@@ -1754,6 +1754,8 @@ test17 (GdaConnection *cnc)
model = (GdaDataModel*) gda_data_model_select_new_from_string (cnc, "SELECT * FROM customers WHERE id
<= ##theid::gint");
g_assert (model);
+ g_assert (GDA_IS_DATA_MODEL (model));
+ g_assert (GDA_IS_DATA_MODEL_SELECT (model));
g_assert (!gda_data_model_select_is_valid (GDA_DATA_MODEL_SELECT (model)));
g_print ("Get parameters\n");
params = gda_data_model_select_get_parameters (GDA_DATA_MODEL_SELECT (model));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]