[libgda] Fix several compiler warnings, though far from all of them.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Fix several compiler warnings, though far from all of them.
- Date: Wed, 15 Jun 2011 07:31:59 +0000 (UTC)
commit 7721eafff59e0dc0846806db40a0002c053ed185
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Jun 15 09:29:07 2011 +0200
Fix several compiler warnings, though far from all of them.
* libgda/gda-data-model-import.c:
(gda_data_model_import_get_access_flags): This probably fixes a
logic error, introduced since a line after the if() was commented
out. There was no comment about why it was commented out.
libgda/gda-data-model-dir.c | 88 +++---
libgda/gda-data-model-import.c | 237 ++++++------
libgda/gda-data-proxy.c | 344 +++++++++---------
libgda/gda-data-select.c | 262 +++++++-------
libgda/gda-meta-store.c | 526 +++++++++++++-------------
libgda/gda-value.c | 354 +++++++++---------
libgda/handlers/gda-handler-numerical.c | 10 +-
libgda/sqlite/gda-sqlite-provider.c | 301 ++++++++--------
libgda/sqlite/virtual/gda-vconnection-hub.c | 36 +-
libgda/sqlite/virtual/gda-virtual-provider.c | 4 +-
tests/providers/prov-test-common.h | 6 +-
11 files changed, 1085 insertions(+), 1083 deletions(-)
---
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index f628a2c..b3e553a 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -101,7 +101,7 @@ enum
COL_MIME,
COL_MD5SUM,
COL_DATA,
-
+
COL_LAST
};
@@ -312,7 +312,7 @@ gda_data_model_dir_set_property (GObject *object,
model->priv->basedir = NULL;
}
string = g_value_get_string (value);
- if (string)
+ if (string)
model->priv->basedir = g_strdup (string);
break;
default:
@@ -324,7 +324,7 @@ gda_data_model_dir_set_property (GObject *object,
/* create columns */
model->priv->columns = NULL;
GdaColumn *column;
-
+
/* COL_DIRNAME */
column = gda_column_new ();
model->priv->columns = g_slist_append (model->priv->columns , column);
@@ -400,7 +400,7 @@ update_data_model_real (GdaDataModelDir *model, const gchar *rel_path)
/* ignore hidden directories */
if (*raw_filename != '.') {
gchar *path;
-
+
path = g_build_path (G_DIR_SEPARATOR_S, rel_path, raw_filename, NULL);
update_data_model_real (model, path);
g_free (path);
@@ -418,8 +418,8 @@ update_data_model_real (GdaDataModelDir *model, const gchar *rel_path)
#endif
FileRow *row;
model->priv->upd_row ++;
-
- if (model->priv->upd_row < model->priv->rows->len) {
+
+ if (model->priv->upd_row < (int)model->priv->rows->len) {
row = g_ptr_array_index (model->priv->rows, model->priv->upd_row);
file_row_clean (row);
}
@@ -431,23 +431,23 @@ update_data_model_real (GdaDataModelDir *model, const gchar *rel_path)
#else
row->raw_filename_value = NULL; /* no need top copy on Windows */
#endif
- g_value_take_string (row->filename_value = gda_value_new (G_TYPE_STRING),
+ g_value_take_string (row->filename_value = gda_value_new (G_TYPE_STRING),
utf8_filename);
-
+
/* file size */
update_file_size (row, complete_filename);
-
+
/* other attributes, computed only when needed */
row->mime_value = NULL;
row->md5sum_value = NULL;
row->data_value = NULL;
-
+
/* add row */
- if (model->priv->upd_row < model->priv->rows->len)
+ if (model->priv->upd_row < (int)model->priv->rows->len)
gda_data_model_row_updated ((GdaDataModel *) model, model->priv->upd_row);
else {
g_ptr_array_add (model->priv->rows, row);
- gda_data_model_row_inserted ((GdaDataModel *) model,
+ gda_data_model_row_inserted ((GdaDataModel *) model,
model->priv->rows->len - 1);
}
}
@@ -470,7 +470,7 @@ update_file_size (FileRow *row, const gchar *complete_filename)
if (! g_stat (complete_filename, &filestat)) {
if (row->size_value && (G_VALUE_TYPE (row->size_value) == G_TYPE_UINT)
- && (g_value_get_uint (row->size_value) == filestat.st_size))
+ && (g_value_get_uint (row->size_value) == (guint)filestat.st_size))
changed = FALSE;
else {
if (row->size_value)
@@ -537,14 +537,14 @@ update_file_md5sum (FileRow *row, const gchar *complete_filename)
MD5Init (&context);
MD5Update (&context, map, length);
MD5Final (digest, &context);
-
+
md5str = g_string_new ("");
for (i = 0; i < 16; i++)
g_string_append_printf (md5str, "%02x", digest[i]);
value = gda_value_new (G_TYPE_STRING);
g_value_take_string (value, md5str->str);
g_string_free (md5str, FALSE);
-
+
#ifndef G_OS_WIN32
munmap (map, length);
#else
@@ -572,7 +572,7 @@ update_file_md5sum (FileRow *row, const gchar *complete_filename)
row->md5sum_value = gda_value_new_null ();
}
}
-
+
return changed;
}
@@ -676,7 +676,7 @@ gda_data_model_dir_new (const gchar *basedir)
g_return_val_if_fail (basedir && *basedir, NULL);
- model = (GdaDataModel *) g_object_new (GDA_TYPE_DATA_MODEL_DIR, "basedir", basedir, NULL);
+ model = (GdaDataModel *) g_object_new (GDA_TYPE_DATA_MODEL_DIR, "basedir", basedir, NULL);
return model;
}
@@ -760,7 +760,7 @@ gda_data_model_dir_get_access_flags (GdaDataModel *model)
imodel = GDA_DATA_MODEL_DIR (model);
g_return_val_if_fail (imodel->priv, 0);
- flags = GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD |
+ flags = GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD |
GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD |
GDA_DATA_MODEL_ACCESS_RANDOM |
GDA_DATA_MODEL_ACCESS_WRITE;
@@ -838,7 +838,7 @@ gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row, GError
}
value = frow->md5sum_value;
break;
- case COL_DATA:
+ case COL_DATA:
value = frow->data_value;
if (! value) {
value = gda_value_new (GDA_TYPE_BLOB);
@@ -854,7 +854,7 @@ gda_data_model_dir_get_value_at (GdaDataModel *model, gint col, gint row, GError
g_free (filename);
gda_blob_set_op (blob, op);
g_object_unref (op);
-
+
gda_value_take_blob (value, blob);
frow->data_value = value;
}
@@ -983,7 +983,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
const GValue *cvalue = gda_data_model_get_value_at (model, col, row, error);
if (!cvalue)
return FALSE;
- if (!value || !gda_value_compare (value, cvalue))
+ if (!value || !gda_value_compare (value, cvalue))
continue;
switch (col) {
@@ -992,7 +992,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
case COL_MD5SUM:
default:
add_error (imodel, _("Column cannot be modified"));
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Column cannot be modified"));
return FALSE;
case COL_DIRNAME: {
@@ -1007,11 +1007,11 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
if ((len < base_len) ||
(strncmp (new_path, imodel->priv->basedir, base_len))) {
add_error (imodel, _("New path must be a subpath of the base directory"));
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("New path must be a subpath of the base directory"));
return FALSE;
}
-
+
old_path = compute_dirname (imodel, frow);
if (dir_equal (new_path, old_path)) {
g_free (old_path);
@@ -1025,7 +1025,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
gboolean allok = FALSE;
gchar *filename;
- new_filename = g_build_filename (new_path,
+ new_filename = g_build_filename (new_path,
frow->raw_filename_value ? frow->raw_filename_value :
g_value_get_string (frow->filename_value), NULL);
filename = compute_filename (imodel, frow);
@@ -1048,7 +1048,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
}
if (!allok) {
gchar *str;
- str = g_strdup_printf (_("Could not rename file '%s' to '%s'"),
+ str = g_strdup_printf (_("Could not rename file '%s' to '%s'"),
filename, new_filename);
add_error (imodel, str);
g_set_error (error, 0, 0, "%s", str);
@@ -1133,7 +1133,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
/* create a new empty blob */
blob = g_new0 (GdaBlob, 1);
}
-
+
if (blob) {
GdaBlobOp *op;
gchar *filename;
@@ -1168,7 +1168,7 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
}
}
- if (has_changed)
+ if (has_changed)
/* signal changes to data model */
gda_data_model_row_updated ((GdaDataModel *) model, row);
@@ -1181,7 +1181,7 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
GdaDataModelDir *imodel;
const gchar *dirname = NULL, *filename = NULL;
GdaBinary *bin_data = NULL;
-
+
g_return_val_if_fail (GDA_IS_DATA_MODEL_DIR (model), -1);
imodel = (GdaDataModelDir *) model;
g_return_val_if_fail (imodel->priv, -1);
@@ -1202,7 +1202,7 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
case COL_MD5SUM:
default:
add_error (imodel, _("Column cannot be set"));
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Column cannot be set"));
return -1;
case COL_DIRNAME:
@@ -1214,13 +1214,13 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
if ((len < base_len) ||
(strncmp (dirname, imodel->priv->basedir, base_len))) {
add_error (imodel, _("New path must be a subpath of the base directory"));
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("New path must be a subpath of the base directory"));
return -1;
}
}
break;
- case COL_FILENAME:
+ case COL_FILENAME:
if (G_VALUE_TYPE (value) == G_TYPE_STRING)
filename = g_value_get_string (value);
break;
@@ -1232,7 +1232,7 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
break;
}
}
-
+
if (dirname && filename && *filename) {
if (!g_mkdir_with_parents (dirname, 0755)) {
gchar *complete_filename;
@@ -1242,10 +1242,10 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
bin_data = g_new0 (GdaBinary, 1);
bin_to_free = TRUE;
}
- if (g_file_set_contents (complete_filename, (gchar *) bin_data->data,
+ if (g_file_set_contents (complete_filename, (gchar *) bin_data->data,
bin_data->binary_length, NULL)) {
FileRow *row;
-
+
row = file_row_new ();
row->reldir = g_strdup (dirname + strlen (imodel->priv->basedir));
#ifndef G_OS_WIN32
@@ -1253,12 +1253,12 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
#else
row->raw_filename_value = NULL; /* no need top copy on Windows */
#endif
- g_value_set_string (row->filename_value = gda_value_new (G_TYPE_STRING),
+ g_value_set_string (row->filename_value = gda_value_new (G_TYPE_STRING),
filename);
-
+
/* file size */
update_file_size (row, complete_filename);
-
+
/* other attributes, computed only when needed */
row->mime_value = NULL;
row->md5sum_value = NULL;
@@ -1294,7 +1294,7 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
}
else {
add_error (imodel, _("Cannot add row: filename missing"));
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Cannot add row: filename missing"));
return -1;
}
@@ -1328,7 +1328,7 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
}
frow = g_ptr_array_index (imodel->priv->rows, row);
-
+
/* remove filename */
filename = g_build_filename (imodel->priv->basedir,
frow->reldir,
@@ -1348,7 +1348,7 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
/* remove dir */
#ifndef G_OS_WIN32
gchar *path;
-
+
path = g_build_path (G_DIR_SEPARATOR_S, imodel->priv->basedir,
frow->reldir, NULL);
g_rmdir (path);
@@ -1359,7 +1359,7 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
file_row_free (frow);
g_ptr_array_remove_index (imodel->priv->rows, row);
gda_data_model_row_removed (model, row);
-
+
return TRUE;
}
@@ -1367,7 +1367,7 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
* Returns: TRUE if @path1 and @path2 relate in fact to the same dir
*/
static gboolean
-dir_equal (const gchar *path1, const gchar *path2)
+dir_equal (const gchar *path1, const gchar *path2)
{
g_assert (path1);
g_assert (path2);
@@ -1383,7 +1383,7 @@ dir_equal (const gchar *path1, const gchar *path2)
p2++;
}
else {
- p1++;
+ p1++;
p2++;
}
}
diff --git a/libgda/gda-data-model-import.c b/libgda/gda-data-model-import.c
index 91deffe..4ca4ed6 100644
--- a/libgda/gda-data-model-import.c
+++ b/libgda/gda-data-model-import.c
@@ -83,7 +83,7 @@ struct _GdaDataModelImportPrivate {
gpointer start;
size_t length;
} mapped;
-
+
/* data as a string */
gchar *string;
} src;
@@ -115,7 +115,7 @@ struct _GdaDataModelImportPrivate {
xmlNodePtr node;
} node;
} extract;
- GSList *cursor_values; /* list of GValues for the current row
+ GSList *cursor_values; /* list of GValues for the current row
* (might be shorter than the number of columns in the data model)*/
/* general data */
@@ -169,7 +169,7 @@ static GdaDataModelAccessFlags gda_data_model_import_get_access_flags(GdaDataMod
static const GValue *gda_data_model_import_get_value_at (GdaDataModel *model, gint col, gint row, GError **error);
static GdaValueAttribute gda_data_model_import_get_attributes_at (GdaDataModel *model, gint col, gint row);
static GdaDataModelIter *gda_data_model_import_create_iter (GdaDataModel *model);
-static gboolean gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter);
+static gboolean gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter);
static gboolean gda_data_model_import_iter_prev (GdaDataModel *model, GdaDataModelIter *iter);
static const gchar *find_option_as_string (GdaDataModelImport *model, const gchar *pname);
@@ -219,7 +219,7 @@ gda_data_model_import_get_type (void)
return type;
}
-static void
+static void
gda_data_model_import_class_init (GdaDataModelImportClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -320,7 +320,7 @@ gda_data_model_import_data_model_init (GdaDataModelIface *iface)
iface->i_append_row = NULL;
iface->i_remove_row = NULL;
iface->i_find_row = NULL;
-
+
iface->i_set_notify = NULL;
iface->i_get_notify = NULL;
iface->i_send_hint = NULL;
@@ -430,7 +430,7 @@ gda_data_model_import_dispose (GObject *object)
csv_fini (model->priv->extract.csv.parser, NULL, NULL, NULL);
model->priv->extract.csv.parser = NULL;
}
- if (model->priv->extract.csv.rows_read)
+ if (model->priv->extract.csv.rows_read)
csv_free_stored_rows (model);
if (model->priv->extract.csv.encoding) {
g_free (model->priv->extract.csv.encoding);
@@ -491,11 +491,11 @@ find_option_as_string (GdaDataModelImport *model, const gchar *pname)
value = gda_set_get_holder_value (model->priv->options, pname);
if (value && !gda_value_is_null ((GValue *) value)) {
- if (!gda_value_isa ((GValue *) value, G_TYPE_STRING))
+ if (!gda_value_isa ((GValue *) value, G_TYPE_STRING))
g_warning (_("The '%s' option must hold a "
"string value, ignored."), pname);
else
- return g_value_get_string ((GValue *) value);
+ return g_value_get_string ((GValue *) value);
}
return NULL;
}
@@ -507,11 +507,11 @@ find_option_as_boolean (GdaDataModelImport *model, const gchar *pname, gboolean
value = gda_set_get_holder_value (model->priv->options, pname);
if (value && !gda_value_is_null ((GValue *) value)) {
- if (!gda_value_isa ((GValue *) value, G_TYPE_BOOLEAN))
+ if (!gda_value_isa ((GValue *) value, G_TYPE_BOOLEAN))
g_warning (_("The '%s' option must hold a "
"boolean value, ignored."), pname);
else
- return g_value_get_boolean ((GValue *) value);
+ return g_value_get_boolean ((GValue *) value);
}
return defaults;
@@ -565,7 +565,7 @@ gda_data_model_import_set_property (GObject *object,
model->priv->src.mapped.length = _stat.st_size;
#ifndef G_OS_WIN32
model->priv->src.mapped.start = mmap (NULL, model->priv->src.mapped.length,
- PROT_READ, MAP_PRIVATE,
+ PROT_READ, MAP_PRIVATE,
model->priv->src.mapped.fd, 0);
if (model->priv->src.mapped.start == MAP_FAILED) {
/* error */
@@ -595,7 +595,7 @@ gda_data_model_import_set_property (GObject *object,
add_error (model, (gchar *)lpMsgBuf);
return;
}
- HANDLE view = CreateFileMapping(hFile,
+ HANDLE view = CreateFileMapping(hFile,
NULL, PAGE_READONLY|SEC_COMMIT, 0,0 , NULL);
if (!view) {
/* error */
@@ -612,7 +612,7 @@ gda_data_model_import_set_property (GObject *object,
add_error (model, (gchar *)lpMsgBuf);
return;
}
- model->priv->src.mapped.start = MapViewOfFile(view, FILE_MAP_READ, 0, 0,
+ model->priv->src.mapped.start = MapViewOfFile(view, FILE_MAP_READ, 0, 0,
model->priv->src.mapped.length);
if (!model->priv->src.mapped.start) {
/* error */
@@ -674,13 +674,13 @@ gda_data_model_import_set_property (GObject *object,
}
}
- /* here we now have a valid data to analyze, try to determine the real kind of data
+ /* here we now have a valid data to analyze, try to determine the real kind of data
* (CVS text of XML) */
if (model->priv->format != FORMAT_XML_NODE
&& model->priv->data_start) {
- if (!strncmp (model->priv->data_start, "<?xml", 5))
+ if (!strncmp (model->priv->data_start, "<?xml", 5))
model->priv->format = FORMAT_XML_DATA;
- else
+ else
model->priv->format = FORMAT_CSV;
}
@@ -692,13 +692,13 @@ gda_data_model_import_set_property (GObject *object,
case FORMAT_XML_DATA:
init_xml_import (model);
break;
-
+
case FORMAT_CSV:
model->priv->extract.csv.quote = '"';
if (model->priv->options) {
const gchar *option;
option = find_option_as_string (model, "ENCODING");
- if (option)
+ if (option)
model->priv->extract.csv.encoding = g_strdup (option);
option = find_option_as_string (model, "SEPARATOR");
if (option)
@@ -710,7 +710,7 @@ gda_data_model_import_set_property (GObject *object,
}
init_csv_import (model);
break;
-
+
case FORMAT_XML_NODE:
model->priv->random_access = TRUE;
init_node_import (model);
@@ -718,13 +718,13 @@ gda_data_model_import_set_property (GObject *object,
default:
g_assert_not_reached ();
}
-
+
/* for random access, create a new GdaDataModelArray model and copy the contents
from this model */
if (model->priv->random_access && model->priv->columns && !model->priv->random_access_model) {
GdaDataModel *ramodel;
-
- ramodel = gda_data_access_wrapper_new ((GdaDataModel *) model);
+
+ ramodel = gda_data_access_wrapper_new ((GdaDataModel *) model);
model->priv->random_access_model = ramodel;
}
}
@@ -798,7 +798,7 @@ gda_data_model_import_new_file (const gchar *filename, gboolean random_access,
GdaDataModelImport *model;
g_return_val_if_fail (filename, NULL);
-
+
model = g_object_new (GDA_TYPE_DATA_MODEL_IMPORT,
"random-access", random_access,
"options", options,
@@ -813,7 +813,7 @@ gda_data_model_import_new_file (const gchar *filename, gboolean random_access,
* @random_access: TRUE if random access will be required
* @options: (transfer none) (allow-none): importing options, see gda_data_model_import_new_file() for more information
*
- * Creates a new #GdaDataModel object which contains the data stored in the @data string.
+ * Creates a new #GdaDataModel object which contains the data stored in the @data string.
*
* Important note: the @data string is not copied for memory efficiency reasons and should not
* therefore be altered in any way as long as the returned data model exists.
@@ -869,12 +869,12 @@ init_csv_import (GdaDataModelImport *model)
gboolean title_first_line = FALSE;
gint nbcols;
- if (model->priv->options)
+ if (model->priv->options)
title_first_line = find_option_as_boolean (model, "TITLE_AS_FIRST_LINE", FALSE);
g_assert (model->priv->format == FORMAT_CSV);
- if (!model->priv->extract.csv.delimiter)
+ if (!model->priv->extract.csv.delimiter)
model->priv->extract.csv.delimiter = ',';
model->priv->extract.csv.ignore_first_line = FALSE;
@@ -896,40 +896,40 @@ init_csv_import (GdaDataModelImport *model)
model->priv->extract.csv.initializing = FALSE;
/* computing columns */
- if (model->priv->extract.csv.rows_read->len == 0)
+ if (model->priv->extract.csv.rows_read->len == 0)
return;
GSList *row;
gint col;
const GValue *cvalue;
-
+
row = g_array_index (model->priv->extract.csv.rows_read, GSList *, 0);
g_assert (row);
nbcols = g_slist_length (row);
-
+
for (col = 0; col < nbcols; col++) {
GdaColumn *column;
gchar *str = NULL;
-
+
column = gda_column_new ();
- model->priv->columns = g_slist_append (model->priv->columns,
+ model->priv->columns = g_slist_append (model->priv->columns,
column);
if (title_first_line) {
cvalue = g_slist_nth_data (row, col);
- if (cvalue && !gda_value_is_null (cvalue))
+ if (cvalue && !gda_value_is_null (cvalue))
str = gda_value_stringify (cvalue);
}
- if (!str)
+ if (!str)
str = g_strdup_printf ("column_%d", col);
gda_column_set_name (column, str);
gda_column_set_description (column, str);
- g_free (str);
-
+ g_free (str);
+
gda_column_set_g_type (column, G_TYPE_STRING);
if (model->priv->options) {
gchar *pname;
const GValue *value;
-
+
pname = g_strdup_printf ("G_TYPE_%d", col);
value = gda_set_get_holder_value (model->priv->options, pname);
if (value && !gda_value_is_null ((GValue *) value)) {
@@ -938,7 +938,7 @@ init_csv_import (GdaDataModelImport *model)
"GType value, ignored."), pname);
else {
GType gtype;
-
+
gtype = g_value_get_gtype ((GValue *) value);
gda_column_set_g_type (column, gtype);
}
@@ -952,11 +952,11 @@ init_csv_import (GdaDataModelImport *model)
csv_free_stored_rows (model);
csv_fini (model->priv->extract.csv.parser, NULL, NULL, NULL);
csv_init_csv_parser (model);
-
+
model->priv->extract.csv.start_pos = model->priv->data_start;
model->priv->extract.csv.text_line = 1; /* start line numbering at 1 */
model->priv->extract.csv.rows_read = g_array_new (FALSE, TRUE, sizeof (GSList *));
- if (title_first_line)
+ if (title_first_line)
model->priv->extract.csv.ignore_first_line = TRUE;
csv_fetch_some_lines (model);
}
@@ -980,8 +980,8 @@ csv_init_csv_parser (GdaDataModelImport *model)
return TRUE;
}
-static void
-csv_parser_field_read_cb (char *s, size_t len, void *data)
+static void
+csv_parser_field_read_cb (char *s, size_t len, void *data)
{
CsvParserData *pdata = (CsvParserData* ) data;
GdaDataModelImport *model = pdata->model;
@@ -990,7 +990,7 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
GType type = GDA_TYPE_NULL;
gchar *copy;
- if (pdata->model->priv->extract.csv.ignore_first_line)
+ if (pdata->model->priv->extract.csv.ignore_first_line)
return;
/* convert to correct encoding */
@@ -1000,7 +1000,7 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
NULL, NULL, &error);
if (!copy) {
gchar *str;
- str = g_strdup_printf (_("Character conversion at line %d, error: %s"),
+ str = g_strdup_printf (_("Character conversion at line %d, error: %s"),
model->priv->extract.csv.text_line,
error && error->message ? error->message:
_("no detail"));
@@ -1009,7 +1009,7 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
g_error_free (error);
}
}
- else
+ else
copy = g_locale_to_utf8 (s, len, NULL, NULL, NULL);
if (!copy)
copy = g_strndup (s, len);
@@ -1020,7 +1020,7 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
if (pdata->field_next_col >= pdata->nb_cols)
/* ignore extra fields */
return;
- column = gda_data_model_describe_column ((GdaDataModel *) model,
+ column = gda_data_model_describe_column ((GdaDataModel *) model,
pdata->field_next_col);
pdata->field_next_col++;
@@ -1041,14 +1041,14 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
value = gda_value_new_from_string (copy, type);
if (!value) {
gchar *str;
- str = g_strdup_printf (_("Could not convert string '%s' to a '%s' value"), copy,
+ str = g_strdup_printf (_("Could not convert string '%s' to a '%s' value"), copy,
g_type_name (type));
add_error (model, str);
g_free (str);
}
}
}
- else
+ else
value = gda_value_new_binary ((guchar*) s, len);
g_free (copy);
pdata->fields = g_slist_prepend (pdata->fields, value);
@@ -1056,48 +1056,48 @@ csv_parser_field_read_cb (char *s, size_t len, void *data)
/*g_print ("=> %p (cols so far: %d)\n", value, g_slist_length (pdata->fields));*/
}
-static void
+static void
csv_parser_row_read_cb (G_GNUC_UNUSED char c, void *data)
{
CsvParserData *pdata = (CsvParserData* ) data;
GSList *row;
gint size;
- if (pdata->model->priv->extract.csv.ignore_first_line)
+ if (pdata->model->priv->extract.csv.ignore_first_line)
pdata->model->priv->extract.csv.ignore_first_line = FALSE;
else {
row = g_slist_reverse (pdata->fields);
pdata->fields = NULL;
pdata->field_next_col = 0;
-
+
size = g_slist_length (row);
g_assert (size <= pdata->nb_cols);
/*g_print ("===========ROW %d (%d cols)===========\n", pdata->model->priv->extract.csv.text_line, size);*/
-
+
g_array_append_val (pdata->model->priv->extract.csv.rows_read, row);
pdata->model->priv->extract.csv.text_line ++;
}
}
static gboolean
-csv_fetch_some_lines (GdaDataModelImport *model)
+csv_fetch_some_lines (GdaDataModelImport *model)
{
size_t size;
if (!model->priv->extract.csv.initializing)
size = MIN (CSV_TITLE_BUFFER_SIZE,
- model->priv->data_start + model->priv->data_length -
+ model->priv->data_start + model->priv->data_length -
model->priv->extract.csv.start_pos);
else
size = MIN (CSV_DATA_BUFFER_SIZE,
- model->priv->data_start + model->priv->data_length -
+ model->priv->data_start + model->priv->data_length -
model->priv->extract.csv.start_pos);
-
- if (csv_parse (model->priv->extract.csv.parser,
- model->priv->extract.csv.start_pos, size,
- csv_parser_field_read_cb,
+
+ if (csv_parse (model->priv->extract.csv.parser,
+ model->priv->extract.csv.start_pos, size,
+ csv_parser_field_read_cb,
csv_parser_row_read_cb, model->priv->extract.csv.pdata) != size) {
- gchar *str = g_strdup_printf (_("Error while parsing CSV file: %s"),
+ gchar *str = g_strdup_printf (_("Error while parsing CSV file: %s"),
csv_strerror (csv_error (model->priv->extract.csv.parser)));
add_error (model, str);
g_free (str);
@@ -1109,13 +1109,13 @@ csv_fetch_some_lines (GdaDataModelImport *model)
/* try to finish the line if it has not been read entirely */
if (model->priv->extract.csv.rows_read->len == 0) {
- if ((model->priv->extract.csv.start_pos !=
+ if ((model->priv->extract.csv.start_pos !=
model->priv->data_start + model->priv->data_length))
return csv_fetch_some_lines (model);
else {
/* end of data */
- csv_fini (model->priv->extract.csv.parser,
- csv_parser_field_read_cb,
+ csv_fini (model->priv->extract.csv.parser,
+ csv_parser_field_read_cb,
csv_parser_row_read_cb, model->priv->extract.csv.pdata);
return TRUE;
}
@@ -1184,7 +1184,7 @@ init_xml_import (GdaDataModelImport *model)
g_assert (model->priv->format == FORMAT_XML_DATA);
/* init extraction specific variables */
- reader = xmlReaderForMemory (model->priv->data_start,
+ reader = xmlReaderForMemory (model->priv->data_start,
model->priv->data_length,
NULL, NULL, 0);
model->priv->extract.xml.reader = reader;
@@ -1227,18 +1227,18 @@ init_xml_import (GdaDataModelImport *model)
return;
}
node = xmlTextReaderCurrentNode (reader);
-
+
prop = (gchar*)xmlGetProp (node, (xmlChar*)"id");
- if (prop)
+ if (prop)
g_object_set_data_full (G_OBJECT (model), "id", prop, xmlFree);
prop = (gchar*)xmlGetProp (node, (xmlChar*)"name");
- if (prop)
+ if (prop)
g_object_set_data_full (G_OBJECT (model), "name", prop, xmlFree);
prop = (gchar*)xmlGetProp (node, (xmlChar*)"descr");
- if (prop)
+ if (prop)
g_object_set_data_full (G_OBJECT (model), "descr", prop, xmlFree);
-
+
/* compute fields */
ret = xml_fetch_next_xml_node (reader);
name = (ret > 0) ? xmlTextReaderConstName (reader) : NULL;
@@ -1248,13 +1248,13 @@ init_xml_import (GdaDataModelImport *model)
spec = g_new0 (XmlColumnSpec, 1);
fields = g_slist_append (fields, spec);
-
+
spec->id = xmlTextReaderGetAttribute (reader, (xmlChar*)"id");
spec->name = xmlTextReaderGetAttribute (reader, (xmlChar*)"name");
spec->title = xmlTextReaderGetAttribute (reader, (xmlChar*)"title");
if (!spec->title && spec->name)
spec->title = xmlStrdup (spec->name);
-
+
spec->caption = xmlTextReaderGetAttribute (reader, (xmlChar*)"caption");
spec->dbms_type = xmlTextReaderGetAttribute (reader, (xmlChar*)"dbms_type");
str = (gchar*)xmlTextReaderGetAttribute (reader, (xmlChar*)"gdatype");
@@ -1306,7 +1306,7 @@ init_xml_import (GdaDataModelImport *model)
}
spec->table = xmlTextReaderGetAttribute (reader, (xmlChar*)"table");
spec->ref = xmlTextReaderGetAttribute (reader, (xmlChar*)"ref");
-
+
nbfields ++;
ret = xml_fetch_next_xml_node (reader);
@@ -1320,13 +1320,13 @@ init_xml_import (GdaDataModelImport *model)
model->priv->extract.xml.reader = NULL;
return;
}
-
+
list = fields;
pos = 0;
while (list) {
GdaColumn *column;
XmlColumnSpec *spec;
-
+
spec = (XmlColumnSpec *)(list->data);
column = gda_column_new ();
model->priv->columns = g_slist_append (model->priv->columns, column);
@@ -1336,7 +1336,7 @@ init_xml_import (GdaDataModelImport *model)
gda_column_set_dbms_type (column, (gchar*)spec->dbms_type);
gda_column_set_g_type (column, spec->gdatype);
gda_column_set_allow_null (column, spec->nullok);
-
+
list = g_slist_next (list);
pos++;
}
@@ -1374,7 +1374,7 @@ static gint
xml_fetch_next_xml_node (xmlTextReaderPtr reader)
{
gint ret;
-
+
ret = xmlTextReaderRead (reader);
while ((ret > 0) && (xmlTextReaderNodeType (reader) != XML_ELEMENT_NODE)) {
ret = xmlTextReaderRead (reader);
@@ -1434,7 +1434,7 @@ xml_fetch_next_row (GdaDataModelImport *model)
}
/* use this <gda_value> */
- if (!columns)
+ if (!columns)
add_error (model, _("Row has too many values (which are ignored)"));
else {
gboolean value_is_null = FALSE;
@@ -1447,7 +1447,7 @@ xml_fetch_next_row (GdaDataModelImport *model)
value_is_null = TRUE;
xmlFree (isnull);
}
-
+
if (this_lang)
column = last_column;
else {
@@ -1465,24 +1465,24 @@ xml_fetch_next_row (GdaDataModelImport *model)
if (ret > 0) {
GValue *value;
GType gtype;
-
+
ret = -1;
-
+
gtype = gda_column_get_g_type (column);
/*g_print ("TYPE: %s\n", xmlTextReaderConstName (reader));*/
if (xmlTextReaderNodeType (reader) == XML_TEXT_NODE) {
const xmlChar *xmlstr;
-
+
xmlstr = xmlTextReaderConstValue (reader);
value = gda_value_new_from_string ((gchar *) xmlstr, gtype);
- /*g_print ("Convert #%s# (type:%s) => %s (type:%s)\n", (gchar *) xmlstr,
- gda_g_type_to_string (gtype),
- gda_value_stringify (value),
+ /*g_print ("Convert #%s# (type:%s) => %s (type:%s)\n", (gchar *) xmlstr,
+ gda_g_type_to_string (gtype),
+ gda_value_stringify (value),
value ? gda_g_type_to_string (G_VALUE_TYPE (value)) : "no type");*/
if (!value) {
gchar *str;
-
- str = g_strdup_printf (_("Could not convert '%s' to a value of type %s"),
+
+ str = g_strdup_printf (_("Could not convert '%s' to a value of type %s"),
(gchar *) xmlstr, gda_g_type_to_string (gtype));
add_error (model, str);
g_free (str);
@@ -1491,21 +1491,21 @@ xml_fetch_next_row (GdaDataModelImport *model)
}
else {
if (xmlTextReaderNodeType (reader) == XML_ELEMENT_NODE)
- ret = 1; /* don't read another node in the next loop,
+ ret = 1; /* don't read another node in the next loop,
use the current one */
if (value_is_null)
value = gda_value_new_null ();
else
value = gda_value_new_from_string ("", gtype);
}
-
+
if (this_lang) {
/* replace the last value (which did not have any "lang" attribute */
gda_value_free ((GValue *) values->data);
values->data = value;
xmlFree (this_lang);
}
- else
+ else
values = g_slist_prepend (values, value);
}
}
@@ -1520,7 +1520,7 @@ xml_fetch_next_row (GdaDataModelImport *model)
#ifdef GDA_DEBUG_NO
GSList *l;
gint c;
-
+
g_print ("======== GdaDataModelImport => next XML row ========\n");
for (c = 0, l = model->priv->cursor_values; l; l = l->next, c++) {
GValue *val = (GValue*)(l->data);
@@ -1562,7 +1562,7 @@ init_node_import (GdaDataModelImport *model)
node = model->priv->extract.node.node = NULL;
return;
}
-
+
for (cur = node->children; cur; cur=cur->next) {
if (xmlNodeIsText (cur))
continue;
@@ -1571,7 +1571,7 @@ init_node_import (GdaDataModelImport *model)
spec = g_new0 (XmlColumnSpec, 1);
fields = g_slist_append (fields, spec);
-
+
spec->id = xmlGetProp (cur, (xmlChar*)"id");
spec->name = xmlGetProp (cur, (xmlChar*)"name");
spec->title = xmlGetProp (cur, (xmlChar*)"title");
@@ -1647,14 +1647,14 @@ init_node_import (GdaDataModelImport *model)
ramodel = gda_data_model_array_new (nbfields);
model->priv->random_access_model = ramodel;
str = (gchar*)xmlGetProp (node, (xmlChar*)"id");
- if (str)
+ if (str)
g_object_set_data_full (G_OBJECT (model), "id", str, xmlFree);
str = (gchar*)xmlGetProp (node, (xmlChar*)"name");
- if (str)
+ if (str)
g_object_set_data_full (G_OBJECT (model), "name", str, xmlFree);
str = (gchar*)xmlGetProp (node, (xmlChar*)"descr");
- if (str)
+ if (str)
g_object_set_data_full (G_OBJECT (model), "descr", str, xmlFree);
list = fields;
@@ -1680,7 +1680,7 @@ init_node_import (GdaDataModelImport *model)
clean_field_specs (fields);
model->priv->columns = g_slist_reverse (model->priv->columns);
- if (cur && ! gda_data_model_add_data_from_xml_node (ramodel, cur, &error))
+ if (cur && ! gda_data_model_add_data_from_xml_node (ramodel, cur, &error))
add_error (model, error && error->message ? error->message : _("No detail"));
}
@@ -1743,12 +1743,12 @@ gda_data_model_import_get_n_rows (GdaDataModel *model)
imodel = GDA_DATA_MODEL_IMPORT (model);
g_return_val_if_fail (imodel->priv, 0);
- if (!imodel->priv->random_access)
+ if (!imodel->priv->random_access)
return -1;
else {
- if (imodel->priv->random_access_model)
+ if (imodel->priv->random_access_model)
return gda_data_model_get_n_rows (imodel->priv->random_access_model);
- else
+ else
/* number of rows is not known */
return -1;
}
@@ -1761,7 +1761,7 @@ gda_data_model_import_get_n_columns (GdaDataModel *model)
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), 0);
imodel = GDA_DATA_MODEL_IMPORT (model);
g_return_val_if_fail (imodel->priv, 0);
-
+
if (imodel->priv->columns)
return g_slist_length (imodel->priv->columns);
else
@@ -1791,9 +1791,10 @@ gda_data_model_import_get_access_flags (GdaDataModel *model)
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), 0);
imodel = GDA_DATA_MODEL_IMPORT (model);
g_return_val_if_fail (imodel->priv, 0);
-
- if (imodel->priv->format == FORMAT_CSV)
+
+ if (imodel->priv->format == FORMAT_CSV) {
/*flags |= GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD*/;
+ }
if (imodel->priv->random_access && imodel->priv->random_access_model)
flags |= GDA_DATA_MODEL_ACCESS_RANDOM;
@@ -1830,12 +1831,12 @@ gda_data_model_import_get_attributes_at (GdaDataModel *model, gint col, G_GNUC_U
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), 0);
imodel = (GdaDataModelImport *) model;
g_return_val_if_fail (imodel->priv, 0);
-
+
flags = GDA_VALUE_ATTR_NO_MODIF;
column = gda_data_model_describe_column (model, col);
if (gda_column_get_allow_null (column))
flags |= GDA_VALUE_ATTR_CAN_BE_NULL;
-
+
return flags;
}
@@ -1848,7 +1849,7 @@ gda_data_model_import_create_iter (GdaDataModel *model)
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), NULL);
imodel = (GdaDataModelImport *) model;
g_return_val_if_fail (imodel->priv, NULL);
-
+
if (imodel->priv->random_access_model) {
iter = gda_data_model_create_iter (imodel->priv->random_access_model);
/* REM: don't do:
@@ -1859,12 +1860,12 @@ gda_data_model_import_create_iter (GdaDataModel *model)
*/
}
else
- iter = (GdaDataModelIter *) g_object_new (GDA_TYPE_DATA_MODEL_ITER,
+ iter = (GdaDataModelIter *) g_object_new (GDA_TYPE_DATA_MODEL_ITER,
"data-model", model, NULL);
return iter;
}
-static void
+static void
add_error_too_few_values (GdaDataModelImport *model)
{
gchar *str;
@@ -1895,7 +1896,7 @@ add_error_too_few_values (GdaDataModelImport *model)
}
}
-static void
+static void
add_error_too_many_values (GdaDataModelImport *model)
{
gchar *str;
@@ -1919,7 +1920,7 @@ gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
{
GdaDataModelImport *imodel;
GSList *next_values = NULL;
-
+
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), FALSE);
imodel = (GdaDataModelImport *) model;
g_return_val_if_fail (imodel->priv, FALSE);
@@ -1951,9 +1952,9 @@ gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
}
/* fetch some more rows if necessary */
- if (imodel->priv->extract.csv.rows_read->len == 0)
+ if (imodel->priv->extract.csv.rows_read->len == 0)
csv_fetch_some_lines (imodel);
- if (imodel->priv->extract.csv.rows_read->len != 0)
+ if (imodel->priv->extract.csv.rows_read->len != 0)
next_values = g_array_index (imodel->priv->extract.csv.rows_read,
GSList *, 0);
break;
@@ -1967,14 +1968,14 @@ gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
GSList *vlist;
gboolean update_model;
gboolean allok = TRUE;
-
+
g_object_get (G_OBJECT (iter), "update-model", &update_model, NULL);
g_object_set (G_OBJECT (iter), "update-model", FALSE, NULL);
for (plist = ((GdaSet *) iter)->holders, vlist = next_values;
plist && vlist;
plist = plist->next, vlist = vlist->next) {
GError *lerror = NULL;
- if (! gda_holder_set_value (GDA_HOLDER (plist->data),
+ if (! gda_holder_set_value (GDA_HOLDER (plist->data),
(GValue *) vlist->data, &lerror)) {
gchar *tmp;
tmp = g_strdup_printf (_("Could not set iterator's value: %s"),
@@ -2004,7 +2005,7 @@ gda_data_model_import_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
else
imodel->priv->iter_row = 0;
- g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row,
+ g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row,
"update-model", update_model, NULL);
return allok;
@@ -2020,7 +2021,7 @@ static gboolean
gda_data_model_import_iter_prev (GdaDataModel *model, GdaDataModelIter *iter)
{
GdaDataModelImport *imodel;
-
+
g_return_val_if_fail (GDA_IS_DATA_MODEL_IMPORT (model), FALSE);
imodel = (GdaDataModelImport *) model;
g_return_val_if_fail (imodel->priv, FALSE);
@@ -2052,7 +2053,7 @@ gda_data_model_import_iter_prev (GdaDataModel *model, GdaDataModelIter *iter)
plist && vlist;
plist = plist->next, vlist = vlist->next) {
GError *lerror = NULL;
- if (! gda_holder_set_value (GDA_HOLDER (plist->data),
+ if (! gda_holder_set_value (GDA_HOLDER (plist->data),
(GValue *) vlist->data, &lerror)) {
gchar *tmp;
tmp = g_strdup_printf (_("Could not set iterator's value: %s"),
@@ -2074,15 +2075,15 @@ gda_data_model_import_iter_prev (GdaDataModel *model, GdaDataModelIter *iter)
gda_holder_set_value (GDA_HOLDER (plist->data), NULL, NULL);
}
}
- else
+ else
add_error_too_many_values (imodel);
}
-
+
if (gda_data_model_iter_is_valid (iter))
imodel->priv->iter_row --;
g_assert (imodel->priv->iter_row >= 0);
- g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row,
+ g_object_set (G_OBJECT (iter), "current-row", imodel->priv->iter_row,
"update-model", update_model, NULL);
return allok;
}
diff --git a/libgda/gda-data-proxy.c b/libgda/gda-data-proxy.c
index 834ad14..acf5dac 100644
--- a/libgda/gda-data-proxy.c
+++ b/libgda/gda-data-proxy.c
@@ -47,8 +47,8 @@
#include <libgda/gda-types.h>
#include <gda-mutex.h>
-/*
- * Main static functions
+/*
+ * Main static functions
*/
static void gda_data_proxy_class_init (GdaDataProxyClass * class);
static void gda_data_proxy_init (GdaDataProxy *srv);
@@ -76,11 +76,11 @@ static GdaDataModelIter *gda_data_proxy_create_iter (GdaDataModel *model)
static GdaDataModelAccessFlags gda_data_proxy_get_access_flags(GdaDataModel *model);
-static gboolean gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint row,
+static gboolean gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint row,
const GValue *value, GError **error);
-static gboolean gda_data_proxy_set_values (GdaDataModel *model, gint row,
+static gboolean gda_data_proxy_set_values (GdaDataModel *model, gint row,
GList *values, GError **error);
-static gint gda_data_proxy_find_row_from_values (GdaDataModel *model, GSList *values,
+static gint gda_data_proxy_find_row_from_values (GdaDataModel *model, GSList *values,
gint *cols_index);
static gint gda_data_proxy_append_values (GdaDataModel *model, const GList *values, GError **error);
@@ -89,7 +89,7 @@ static gboolean gda_data_proxy_remove_row (GdaDataModel *model,
static void gda_data_proxy_set_notify (GdaDataModel *model, gboolean do_notify_changes);
static gboolean gda_data_proxy_get_notify (GdaDataModel *model);
-static void gda_data_proxy_send_hint (GdaDataModel *model, GdaDataModelHint hint,
+static void gda_data_proxy_send_hint (GdaDataModel *model, GdaDataModelHint hint,
const GValue *hint_value);
#define DEBUG_SYNC
#undef DEBUG_SYNC
@@ -172,13 +172,13 @@ static void display_chunk_free (DisplayChunk *chunk);
/*
* NOTE about the row numbers:
- *
+ *
* There may be more rows in the GdaDataProxy than in the GdaDataModel if:
* - some rows have been added in the proxy
* and are not yet in the GdaDataModel (RowModif->model_row = -1 in this case); or
* - there is a NULL row at the beginning
- *
- * There are 3 kinds of row numbers:
+ *
+ * There are 3 kinds of row numbers:
* - the absolute row numbers which unify under a single numbering scheme all the possible proxy's rows
* which can either be new rows, or data model rows (which may or may not have been modified),
* absolute row numbers are strictly private to the proxy object
@@ -231,7 +231,7 @@ struct _GdaDataProxyPrivate
DisplayChunk *chunk_to; /* NULL if nothing to do */
gint chunk_sep;
gint chunk_proxy_nb_rows;
-
+
/* for ALL the columns of proxy */
GdaColumn **columns;
};
@@ -332,9 +332,9 @@ proxy_row_to_absolute_row (GdaDataProxy *proxy, gint proxy_row)
return -1;
}
else {
- if (proxy->priv->chunk_to &&
+ if (proxy->priv->chunk_to &&
proxy->priv->chunk_to->mapping &&
- (proxy_row < proxy->priv->chunk_sep) &&
+ (proxy_row < proxy->priv->chunk_sep) &&
((guint)proxy_row < proxy->priv->chunk_to->mapping->len))
return g_array_index (proxy->priv->chunk_to->mapping, gint, proxy_row);
else
@@ -359,7 +359,7 @@ proxy_row_to_row_modif (GdaDataProxy *proxy, gint proxy_row)
/*
* May return -1 if:
- * - @abs_row is not a proxy row
+ * - @abs_row is not a proxy row
* - @abs_row is out of bounds (only checked if @proxy's number of rows is known)
*/
static gint
@@ -393,7 +393,7 @@ absolute_row_to_proxy_row (GdaDataProxy *proxy, gint abs_row)
if (proxy->priv->chunk_to && proxy->priv->chunk_to->mapping) {
/* search in the proxy->priv->chunk_sep first rows of proxy->priv->chunk_to */
gint i;
- for (i = 0; i < MIN (proxy->priv->chunk->mapping->len, proxy->priv->chunk_sep); i++) {
+ for (i = 0; i < MIN ((gint)proxy->priv->chunk->mapping->len, proxy->priv->chunk_sep); i++) {
if (g_array_index (proxy->priv->chunk_to->mapping, gint, i) == abs_row) {
proxy_row = i;
break;
@@ -427,7 +427,7 @@ row_modifs_free (RowModif *rm)
{
GSList *list;
gint i;
-
+
list = rm->modify_values;
while (list) {
if (ROW_VALUE (list->data)->value)
@@ -436,7 +436,7 @@ row_modifs_free (RowModif *rm)
list = g_slist_next (list);
}
g_slist_free (rm->modify_values);
-
+
if (rm->orig_values) {
for (i=0; i < rm->orig_values_size; i++) {
if (rm->orig_values [i])
@@ -444,7 +444,7 @@ row_modifs_free (RowModif *rm)
}
g_free (rm->orig_values);
}
-
+
g_free (rm);
}
@@ -457,17 +457,17 @@ static RowModif *
row_modifs_new (GdaDataProxy *proxy, gint proxy_row)
{
RowModif *rm;
-
+
#ifdef GDA_DEBUG
rm = proxy_row_to_row_modif (proxy, proxy_row);
- if (rm)
+ if (rm)
g_warning ("%s(): RowModif already exists for that proxy_row", __FUNCTION__);
#endif
-
+
rm = g_new0 (RowModif, 1);
if (proxy_row >= 0) {
gint i, model_row;
-
+
rm->orig_values = g_new0 (GValue *, proxy->priv->model_nb_cols);
rm->orig_values_size = proxy->priv->model_nb_cols;
model_row = proxy_row_to_model_row (proxy, proxy_row);
@@ -475,14 +475,14 @@ row_modifs_new (GdaDataProxy *proxy, gint proxy_row)
if (model_row >= 0) {
for (i=0; i<proxy->priv->model_nb_cols; i++) {
const GValue *oval;
-
+
oval = gda_data_model_get_value_at (proxy->priv->model, i, model_row, NULL);
if (oval)
rm->orig_values [i] = gda_value_copy ((GValue *) oval);
}
}
}
-
+
return rm;
}
@@ -520,7 +520,7 @@ gda_data_proxy_get_type (void)
NULL,
NULL
};
-
+
g_static_mutex_lock (®istering);
if (type == 0) {
type = g_type_register_static (G_TYPE_OBJECT, "GdaDataProxy", &info, 0);
@@ -539,7 +539,7 @@ validate_row_changes_accumulator (G_GNUC_UNUSED GSignalInvocationHint *ihint,
{
GError *error;
- error = g_value_get_boxed (handler_return);
+ error = g_value_get_boxed (handler_return);
g_value_set_boxed (return_accu, error);
return error ? FALSE : TRUE; /* stop signal if 'thisvalue' is FALSE */
@@ -613,7 +613,7 @@ gda_data_proxy_class_init (GdaDataProxyClass *klass)
*
* Gets emitted when @proxy is about to commit a row change to the proxied data model. If any
* callback returns a non %NULL value, then the change commit fails with the returned #GError
- *
+ *
* Returns: a new #GError if validation failed, or %NULL
*/
gda_data_proxy_signals [VALIDATE_ROW_CHANGES] =
@@ -644,7 +644,7 @@ gda_data_proxy_class_init (GdaDataProxyClass *klass)
*
* Gets emitted when @proxy's filter has been changed
*/
- gda_data_proxy_signals [FILTER_CHANGED] =
+ gda_data_proxy_signals [FILTER_CHANGED] =
g_signal_new ("filter-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
@@ -672,20 +672,20 @@ gda_data_proxy_class_init (GdaDataProxyClass *klass)
GDA_TYPE_DATA_MODEL,
(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)));
g_object_class_install_property (object_class, PROP_ADD_NULL_ENTRY,
- g_param_spec_boolean ("prepend-null-entry", NULL,
+ g_param_spec_boolean ("prepend-null-entry", NULL,
"Tells if a row composed of NULL values is inserted "
"as the proxy's first row", FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (object_class, PROP_DEFER_SYNC,
- g_param_spec_boolean ("defer-sync", NULL,
+ g_param_spec_boolean ("defer-sync", NULL,
"Tells if changes to the sample of rows displayed "
"is done in background in several steps or if it's "
"done in one step.", TRUE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (object_class, PROP_SAMPLE_SIZE,
- g_param_spec_int ("sample-size", NULL,
+ g_param_spec_int ("sample-size", NULL,
"Number of rows which the proxy will contain at any time, "
- "like a sliding window on the proxied data model",
+ "like a sliding window on the proxied data model",
0, G_MAXINT - 1, 300,
(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)));
@@ -730,7 +730,7 @@ static void
gda_data_proxy_init (GdaDataProxy *proxy)
{
proxy->priv = g_new0 (GdaDataProxyPrivate, 1);
-
+
proxy->priv->mutex = gda_mutex_new ();
proxy->priv->modify_rows = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, NULL);
@@ -829,7 +829,7 @@ clean_proxy (GdaDataProxy *proxy)
display_chunk_free (proxy->priv->chunk_to);
proxy->priv->chunk_to = NULL;
}
-
+
if (proxy->priv->columns) {
gint i;
for (i = 0; i < 2 * proxy->priv->model_nb_cols; i++)
@@ -837,7 +837,7 @@ clean_proxy (GdaDataProxy *proxy)
g_free (proxy->priv->columns);
proxy->priv->columns = NULL;
}
-
+
if (proxy->priv->model) {
g_signal_handlers_disconnect_by_func (G_OBJECT (proxy->priv->model),
G_CALLBACK (proxied_model_row_inserted_cb), proxy);
@@ -850,7 +850,7 @@ clean_proxy (GdaDataProxy *proxy)
g_object_unref (proxy->priv->model);
proxy->priv->model = NULL;
}
-
+
if (proxy->priv->columns_attrs) {
gint i;
for (i = 0; i < proxy->priv->model_nb_cols; i++)
@@ -899,7 +899,7 @@ gda_data_proxy_finalize (GObject *object)
}
-static void
+static void
gda_data_proxy_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -926,16 +926,16 @@ gda_data_proxy_set_property (GObject *object,
}
proxy->priv->model = model;
g_object_ref (model);
-
+
proxy->priv->model_nb_cols = gda_data_model_get_n_columns (model);
proxy->priv->model_nb_rows = gda_data_model_get_n_rows (model);
-
+
/* column attributes */
proxy->priv->columns_attrs = g_new0 (GValue *, proxy->priv->model_nb_cols);
for (col = 0; col < proxy->priv->model_nb_cols; col++) {
GdaColumn *column;
GdaValueAttribute flags = GDA_VALUE_ATTR_IS_UNCHANGED;
-
+
column = gda_data_model_describe_column (model, col);
if (gda_column_get_allow_null (column))
flags |= GDA_VALUE_ATTR_CAN_BE_NULL;
@@ -944,7 +944,7 @@ gda_data_proxy_set_property (GObject *object,
proxy->priv->columns_attrs[col] = g_value_init (g_new0 (GValue, 1), GDA_TYPE_VALUE_ATTRIBUTE);
g_value_set_flags (proxy->priv->columns_attrs[col], flags);
}
-
+
g_signal_connect (G_OBJECT (model), "row-inserted",
G_CALLBACK (proxied_model_row_inserted_cb), proxy);
g_signal_connect (G_OBJECT (model), "row-updated",
@@ -953,7 +953,7 @@ gda_data_proxy_set_property (GObject *object,
G_CALLBACK (proxied_model_row_removed_cb), proxy);
g_signal_connect (G_OBJECT (model), "reset",
G_CALLBACK (proxied_model_reset_cb), proxy);
-
+
/* initial chunk settings, no need to emit any signal as it's an initial state */
proxy->priv->chunk = compute_display_chunk (proxy);
if (!proxy->priv->chunk->mapping) {
@@ -1042,7 +1042,7 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
- if (*v >= abs_row)
+ if (*v >= abs_row)
*v += 1;
}
}
@@ -1052,7 +1052,7 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
for (i = 0; i < proxy->priv->chunk_to->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk_to->mapping, gint, i);
- if (*v >= abs_row)
+ if (*v >= abs_row)
*v -= 1;
}
}
@@ -1068,7 +1068,7 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
tmp = tmprm->model_row;
g_hash_table_remove (proxy->priv->modify_rows, &tmp);
tmprm->model_row ++;
-
+
gint *ptr;
ptr = g_new (gint, 1);
*ptr = tmprm->model_row;
@@ -1086,7 +1086,7 @@ proxied_model_row_inserted_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaD
gda_data_model_row_inserted ((GdaDataModel *) proxy, row + signal_row_offset);
}
-static void
+static void
proxied_model_row_updated_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDataProxy *proxy)
{
gint proxy_row, tmp;
@@ -1126,7 +1126,7 @@ proxied_model_row_removed_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDa
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
- if (*v > abs_row)
+ if (*v > abs_row)
*v -= 1;
else if (*v == abs_row) {
g_assert (remove_index == -1);
@@ -1144,7 +1144,7 @@ proxied_model_row_removed_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDa
for (i = 0; i < proxy->priv->chunk_to->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk_to->mapping, gint, i);
- if (*v > abs_row)
+ if (*v > abs_row)
*v -= 1;
else if (*v == abs_row) {
g_assert (remove_index == -1);
@@ -1191,7 +1191,7 @@ proxied_model_row_removed_cb (G_GNUC_UNUSED GdaDataModel *model, gint row, GdaDa
gda_data_model_row_removed ((GdaDataModel *) proxy, proxy_row);
}
-/*
+/*
* called when the proxied model emits a "reset" signal
*/
static void
@@ -1214,7 +1214,7 @@ proxied_model_reset_cb (GdaDataModel *model, GdaDataProxy *proxy)
gda_column_set_g_type (proxy->priv->columns[i], gda_column_get_g_type (orig));
}
for (; i < 2 * proxy->priv->model_nb_cols; i++) {
- orig = gda_data_model_describe_column (proxy->priv->model,
+ orig = gda_data_model_describe_column (proxy->priv->model,
i - proxy->priv->model_nb_cols);
gda_column_set_g_type (proxy->priv->columns[i], gda_column_get_g_type (orig));
}
@@ -1243,7 +1243,7 @@ gda_data_proxy_get_proxied_model (GdaDataProxy *proxy)
/**
* gda_data_proxy_get_proxied_model_n_cols:
* @proxy: a #GdaDataProxy object
- *
+ *
* Get the number of columns in the proxied data model
*
* Returns: the number of columns, or -1 if an error occurred
@@ -1260,7 +1260,7 @@ gda_data_proxy_get_proxied_model_n_cols (GdaDataProxy *proxy)
/**
* gda_data_proxy_get_proxied_model_n_rows:
* @proxy: a #GdaDataProxy object
- *
+ *
* Get the number of rows in the proxied data model
*
* Returns: the number of rows, or -1 if the number of rows is not known
@@ -1287,7 +1287,7 @@ gda_data_proxy_is_read_only (GdaDataProxy *proxy)
g_return_val_if_fail (GDA_IS_DATA_PROXY (proxy), TRUE);
g_return_val_if_fail (proxy->priv, TRUE);
-
+
flags = gda_data_model_get_access_flags (proxy->priv->model);
return ! (flags & GDA_DATA_MODEL_ACCESS_WRITE);
}
@@ -1306,7 +1306,7 @@ find_or_create_row_modif (GdaDataProxy *proxy, gint proxy_row, gint col, RowValu
RowValue *rv = NULL;
gint model_row;
- model_row = absolute_row_to_model_row (proxy,
+ model_row = absolute_row_to_model_row (proxy,
proxy_row_to_absolute_row (proxy, proxy_row), &rm);
if (!rm) {
/* create a new RowModif */
@@ -1323,7 +1323,7 @@ find_or_create_row_modif (GdaDataProxy *proxy, gint proxy_row, gint col, RowValu
else {
/* there are already some modifications to the row, try to catch the RowValue if available */
GSList *list;
-
+
list = rm->modify_values;
while (list && !rv) {
if (ROW_VALUE (list->data)->model_column == col)
@@ -1345,11 +1345,11 @@ find_or_create_row_modif (GdaDataProxy *proxy, gint proxy_row, gint col, RowValu
* @cols_index: (array) (array length=n_cols): array containing the columns for which the values are requested
* @n_cols: size of @cols_index
*
- * Retrieve a whole list of values from the @proxy data model. This function
+ * Retrieve a whole list of values from the @proxy data model. This function
* calls gda_data_proxy_get_value()
* for each column index specified in @cols_index, and generates a #GSList on the way.
*
- * Returns: (element-type GValue) (transfer container): a new list of values (the list must be freed, not the values),
+ * Returns: (element-type GValue) (transfer container): a new list of values (the list must be freed, not the values),
* or %NULL if an error occurred
*/
GSList *
@@ -1416,7 +1416,7 @@ gda_data_proxy_get_value_attributes (GdaDataProxy *proxy, gint proxy_row, gint c
/* there are some modifications to the row */
GSList *list;
RowValue *rv = NULL;
-
+
list = rm->modify_values;
while (list && !rv) {
if (ROW_VALUE (list->data)->model_column == model_column)
@@ -1433,10 +1433,10 @@ gda_data_proxy_get_value_attributes (GdaDataProxy *proxy, gint proxy_row, gint c
}
}
}
-
+
if (! value_has_modifs)
flags |= GDA_VALUE_ATTR_IS_UNCHANGED;
-
+
/* compute the GDA_VALUE_ATTR_DATA_NON_VALID attribute */
if (! (flags & GDA_VALUE_ATTR_CAN_BE_NULL)) {
if ((flags & GDA_VALUE_ATTR_IS_NULL) && !(flags & GDA_VALUE_ATTR_IS_DEFAULT))
@@ -1471,16 +1471,16 @@ gda_data_proxy_alter_value_attributes (GdaDataProxy *proxy, gint proxy_row, gint
gda_mutex_lock (proxy->priv->mutex);
model_col = col % proxy->priv->model_nb_cols;
- if (alter_flags & GDA_VALUE_ATTR_IS_NULL)
- gda_data_proxy_set_value_at ((GdaDataModel*) proxy,
+ if (alter_flags & GDA_VALUE_ATTR_IS_NULL)
+ gda_data_proxy_set_value_at ((GdaDataModel*) proxy,
model_col, proxy_row, NULL, NULL);
else {
RowModif *rm;
RowValue *rv = NULL;
-
+
rm = find_or_create_row_modif (proxy, proxy_row, model_col, &rv);
g_assert (rm);
-
+
if (alter_flags & GDA_VALUE_ATTR_IS_DEFAULT) {
GdaValueAttribute flags = 0;
if (!rv) {
@@ -1490,15 +1490,15 @@ gda_data_proxy_alter_value_attributes (GdaDataProxy *proxy, gint proxy_row, gint
rv->model_column = model_col;
rv->attributes = gda_value_copy (proxy->priv->columns_attrs [col]);
flags = g_value_get_flags (rv->attributes);
-
+
rv->value = NULL;
flags &= ~GDA_VALUE_ATTR_IS_UNCHANGED;
if (rm->model_row >= 0)
flags |= GDA_VALUE_ATTR_HAS_VALUE_ORIG;
else
flags &= ~GDA_VALUE_ATTR_HAS_VALUE_ORIG;
-
- rm->modify_values = g_slist_prepend (rm->modify_values, rv);
+
+ rm->modify_values = g_slist_prepend (rm->modify_values, rv);
}
else {
flags = g_value_get_flags (rv->attributes);
@@ -1517,7 +1517,7 @@ gda_data_proxy_alter_value_attributes (GdaDataProxy *proxy, gint proxy_row, gint
if (!rm->orig_values)
g_warning ("Alter_Flags = GDA_VALUE_ATTR_IS_UNCHANGED, no RowValue!");
else
- gda_data_proxy_set_value_at ((GdaDataModel*) proxy,
+ gda_data_proxy_set_value_at ((GdaDataModel*) proxy,
model_col, proxy_row,
rm->orig_values [model_col],
NULL);
@@ -1589,7 +1589,7 @@ gda_data_proxy_delete (GdaDataProxy *proxy, gint proxy_row)
proxy->priv->all_modifs = g_slist_remove (proxy->priv->all_modifs, rm);
proxy->priv->new_rows = g_slist_remove (proxy->priv->new_rows, rm);
row_modifs_free (rm);
-
+
if (proxy->priv->chunk) {
/* Update chunk */
gsize i;
@@ -1597,13 +1597,13 @@ gda_data_proxy_delete (GdaDataProxy *proxy, gint proxy_row)
gint row_cmp = proxy_row - (proxy->priv->add_null_entry ? 1 : 0);
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
- if (*v > abs_row)
+ if (*v > abs_row)
*v -= 1;
}
g_array_remove_index (proxy->priv->chunk->mapping, row_cmp);
}
- if (proxy->priv->notify_changes)
+ if (proxy->priv->notify_changes)
gda_data_model_row_removed ((GdaDataModel *) proxy, proxy_row);
}
else {
@@ -1659,14 +1659,14 @@ gda_data_proxy_undelete (GdaDataProxy *proxy, gint proxy_row)
/* ensure that there is no sync to be done */
ensure_chunk_sync (proxy);
- model_row = absolute_row_to_model_row (proxy,
+ model_row = absolute_row_to_model_row (proxy,
proxy_row_to_absolute_row (proxy, proxy_row), &rm);
if (rm) {
rm->to_be_deleted = FALSE;
if (!rm->modify_values) {
/* get rid of that RowModif */
do_signal= TRUE;
-
+
gint tmp;
tmp = model_row;
g_hash_table_remove (proxy->priv->modify_rows, &tmp);
@@ -1754,14 +1754,14 @@ gda_data_proxy_append (GdaDataProxy *proxy)
gint col;
gint proxy_row;
gint abs_row;
-
+
g_return_val_if_fail (GDA_IS_DATA_PROXY (proxy), -1);
g_return_val_if_fail (proxy->priv, -1);
/* ensure that there is no sync to be done */
ensure_chunk_sync (proxy);
- if (! (gda_data_model_get_access_flags ((GdaDataModel *) proxy) & GDA_DATA_MODEL_ACCESS_INSERT))
+ if (! (gda_data_model_get_access_flags ((GdaDataModel *) proxy) & GDA_DATA_MODEL_ACCESS_INSERT))
return -1;
if (proxy->priv->model_nb_rows == -1)
return -1;
@@ -1783,24 +1783,24 @@ gda_data_proxy_append (GdaDataProxy *proxy)
if (proxy->priv->add_null_entry)
proxy_row++;
}
- else
+ else
proxy_row = gda_data_proxy_get_n_rows ((GdaDataModel*) proxy) - 1;
-
+
/* for the columns which allow a default value, set them to the default value */
for (col = 0; col < proxy->priv->model_nb_cols; col ++) {
GdaColumn *column;
const GValue *def;
RowValue *rv;
GdaValueAttribute flags = 0;
-
+
/* create a new RowValue */
rv = g_new0 (RowValue, 1);
rv->row_modif = rm;
rv->model_column = col;
rv->attributes = gda_value_new (GDA_TYPE_VALUE_ATTRIBUTE);
rv->value = NULL;
- rm->modify_values = g_slist_prepend (rm->modify_values, rv);
-
+ rm->modify_values = g_slist_prepend (rm->modify_values, rv);
+
column = gda_data_model_describe_column (proxy->priv->model, col);
def = gda_column_get_default_value (column);
if (def) {
@@ -1810,7 +1810,7 @@ gda_data_proxy_append (GdaDataProxy *proxy)
}
if (gda_column_get_allow_null (column)) {
GdaValueAttribute attributes;
-
+
attributes = gda_data_model_get_attributes_at (proxy->priv->model, col, -1);;
if (attributes & GDA_VALUE_ATTR_CAN_BE_NULL)
flags |= GDA_VALUE_ATTR_CAN_BE_NULL;
@@ -1824,7 +1824,7 @@ gda_data_proxy_append (GdaDataProxy *proxy)
/* signal row insertion */
if (proxy->priv->notify_changes)
- gda_data_model_row_inserted ((GdaDataModel *) proxy, proxy_row);
+ gda_data_model_row_inserted ((GdaDataModel *) proxy, proxy_row);
return proxy_row;
}
@@ -1861,7 +1861,7 @@ gda_data_proxy_cancel_row_changes (GdaDataProxy *proxy, gint proxy_row, gint col
/* there are some modifications to the row */
GSList *list;
RowValue *rv = NULL;
-
+
list = rm->modify_values;
while (list && (!rv || (col < 0))) {
if ((col < 0) || (ROW_VALUE (list->data)->model_column == col)) {
@@ -1881,7 +1881,7 @@ gda_data_proxy_cancel_row_changes (GdaDataProxy *proxy, gint proxy_row, gint col
abs_row = proxy_row_to_absolute_row (proxy, proxy_row);
for (i = 0; i < proxy->priv->chunk->mapping->len; i++) {
v = &g_array_index (proxy->priv->chunk->mapping, gint, i);
- if (*v > abs_row)
+ if (*v > abs_row)
*v -= 1;
}
g_array_remove_index (proxy->priv->chunk->mapping, row_cmp);
@@ -1895,7 +1895,7 @@ gda_data_proxy_cancel_row_changes (GdaDataProxy *proxy, gint proxy_row, gint col
g_hash_table_remove (proxy->priv->modify_rows, &tmp);
}
row_modifs_free (rm);
- rm = NULL;
+ rm = NULL;
}
else {
signal_update = TRUE;
@@ -1930,7 +1930,7 @@ static gboolean commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean ad
* @proxy: a #GdaDataProxy object
* @proxy_row: the row number to commit
* @error: place to store the error, or %NULL
- *
+ *
* Commits the modified data in the proxy back into the #GdaDataModel.
*
* Returns: TRUE if no error occurred.
@@ -2004,14 +2004,14 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
gboolean newvalue_found;
GValue *newvalue;
GValue **free_val;
-
+
g_assert (rm->modify_values);
g_assert (rm->orig_values);
free_val = g_new0 (GValue *, proxy->priv->model_nb_cols);
for (i=0; i < rm->orig_values_size; i++) {
newvalue_found = FALSE;
newvalue = NULL;
-
+
list = rm->modify_values;
while (list && !newvalue_found) {
if (ROW_VALUE (list->data)->model_column == i) {
@@ -2025,7 +2025,7 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
free_val [i] = newvalue;
}
else
- newvalue = ROW_VALUE (list->data)->value;
+ newvalue = ROW_VALUE (list->data)->value;
}
}
list = g_slist_next (list);
@@ -2035,7 +2035,7 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
values = g_list_append (values, newvalue);
}
- err = ! gda_data_model_set_values (proxy->priv->model, rm->model_row,
+ err = ! gda_data_model_set_values (proxy->priv->model, rm->model_row,
values, error);
g_list_free (values);
for (i = 0; i < proxy->priv->model_nb_cols; i++)
@@ -2051,12 +2051,12 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
GValue *newvalue;
GValue **free_val;
gint new_row;
-
+
g_assert (rm->modify_values);
free_val = g_new0 (GValue *, proxy->priv->model_nb_cols);
for (i = 0; i < proxy->priv->model_nb_cols; i++) {
newvalue = NULL;
-
+
list = rm->modify_values;
while (list && !newvalue) {
if (ROW_VALUE (list->data)->model_column == i) {
@@ -2070,14 +2070,14 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
}
else
newvalue = ROW_VALUE (list->data)->value;
-
+
}
}
list = g_slist_next (list);
}
values = g_list_append (values, newvalue);
}
-
+
proxy->priv->defer_proxied_model_insert = TRUE;
proxy->priv->catched_inserted_row = -1;
new_row = gda_data_model_append_values (proxy->priv->model, values, error);
@@ -2104,7 +2104,7 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
g_hash_table_remove (proxy->priv->modify_rows, &tmp);
row_modifs_free (rm);
rm = NULL;
-
+
if (proxy_row >= 0)
gda_data_model_row_updated ((GdaDataModel*) proxy, proxy_row);
@@ -2124,7 +2124,7 @@ commit_row_modif (GdaDataProxy *proxy, RowModif *rm, gboolean adjust_display, GE
g_signal_emit (G_OBJECT (proxy),
gda_data_proxy_signals[ROW_CHANGES_APPLIED],
0, proxy_row, model_row);
-
+
/* get rid of the committed change; if the changes have been applied correctly, @rm should
* have been removed from the proxy->priv->all_modifs list because the proxied model
* should habe emitted the "row_{inserted,removed,updated}" signals */
@@ -2261,7 +2261,7 @@ gda_data_proxy_set_sample_size (GdaDataProxy *proxy, gint sample_size)
adjust_displayed_chunk (proxy);
g_signal_emit (G_OBJECT (proxy),
gda_data_proxy_signals[SAMPLE_SIZE_CHANGED],
- 0, sample_size);
+ 0, sample_size);
}
gda_mutex_unlock (proxy->priv->mutex);
@@ -2342,7 +2342,7 @@ gda_data_proxy_get_sample_end (GdaDataProxy *proxy)
g_return_val_if_fail (GDA_IS_DATA_PROXY (proxy), 0);
g_return_val_if_fail (proxy->priv, 0);
- return proxy->priv->sample_last_row;
+ return proxy->priv->sample_last_row;
}
static DisplayChunk *
@@ -2399,7 +2399,7 @@ display_chunks_dump (GdaDataProxy *proxy)
}
#endif
}
-#else
+#else
static void
display_chunks_dump (G_GNUC_UNUSED GdaDataProxy *proxy)
{}
@@ -2415,7 +2415,7 @@ ensure_chunk_sync (GdaDataProxy *proxy)
if (proxy->priv->chunk_sync_idle_id) {
gboolean defer_sync = proxy->priv->defer_sync;
proxy->priv->defer_sync = FALSE;
-
+
chunk_sync_idle (proxy);
proxy->priv->defer_sync = defer_sync;
}
@@ -2456,11 +2456,11 @@ chunk_sync_idle (GdaDataProxy *proxy)
if (proxy->priv->chunk_to->mapping)
max_steps = MAX (max_steps, proxy->priv->chunk_to->mapping->len - proxy->priv->chunk_sep + 1);
else
- max_steps = MAX (max_steps, proxy->priv->chunk_proxy_nb_rows - proxy->priv->chunk_sep + 1);
+ max_steps = MAX (max_steps, (guint)(proxy->priv->chunk_proxy_nb_rows - proxy->priv->chunk_sep + 1));
if (proxy->priv->chunk)
max_steps = MAX (max_steps, proxy->priv->chunk->mapping->len - proxy->priv->chunk_sep + 1);
- else
- max_steps = MAX (max_steps, proxy->priv->chunk_proxy_nb_rows - proxy->priv->chunk_sep + 1);
+ else
+ max_steps = MAX (max_steps, (guint)(proxy->priv->chunk_proxy_nb_rows - proxy->priv->chunk_sep + 1));
if (proxy->priv->defer_sync)
max_steps = MIN (max_steps, IDLE_STEP);
@@ -2470,8 +2470,8 @@ chunk_sync_idle (GdaDataProxy *proxy)
display_chunks_dump (proxy);
#endif
- for (index = proxy->priv->chunk_sep, step = 0;
- step < max_steps && !finished;
+ for (index = proxy->priv->chunk_sep, step = 0;
+ step < max_steps && !finished;
step++) {
gint cur_row, repl_row;
@@ -2495,7 +2495,7 @@ chunk_sync_idle (GdaDataProxy *proxy)
}
else {
repl_row = index;
- if (!iter)
+ if (!iter)
iter = gda_data_model_create_iter (proxy->priv->model);
if (!gda_data_model_iter_move_to_row (iter, repl_row)) {
if (gda_data_model_iter_get_row (iter) != repl_row)
@@ -2514,7 +2514,7 @@ chunk_sync_idle (GdaDataProxy *proxy)
}
proxy->priv->chunk_sep++;
- if (cur_row != repl_row)
+ if (cur_row != repl_row)
if (proxy->priv->notify_changes) {
#ifdef DEBUG_SYNC
g_print ("Signal: Update row %d\n", index + signal_row_offset);
@@ -2525,7 +2525,7 @@ chunk_sync_idle (GdaDataProxy *proxy)
}
else if ((cur_row >= 0) && (repl_row < 0)) {
/* emit the GdaDataModel::"row-removed" signal */
- if (proxy->priv->chunk)
+ if (proxy->priv->chunk)
g_array_remove_index (proxy->priv->chunk->mapping, index);
proxy->priv->chunk_proxy_nb_rows--;
if (proxy->priv->notify_changes) {
@@ -2536,8 +2536,8 @@ chunk_sync_idle (GdaDataProxy *proxy)
}
}
else if ((cur_row < 0) && (repl_row >= 0)) {
- /* emit GdaDataModel::"row-inserted" insert signal */
- if (proxy->priv->chunk)
+ /* emit GdaDataModel::"row-inserted" insert signal */
+ if (proxy->priv->chunk)
g_array_insert_val (proxy->priv->chunk->mapping, index, repl_row);
proxy->priv->chunk_sep++;
if (proxy->priv->notify_changes) {
@@ -2549,12 +2549,12 @@ chunk_sync_idle (GdaDataProxy *proxy)
index++;
}
else
- finished = TRUE;
+ finished = TRUE;
}
if (iter)
g_object_unref (iter);
-
+
if (finished) {
if (proxy->priv->chunk_sync_idle_id) {
g_idle_remove_by_data (proxy);
@@ -2570,7 +2570,7 @@ chunk_sync_idle (GdaDataProxy *proxy)
proxy->priv->chunk_to = NULL;
}
else {
- if (proxy->priv->chunk)
+ if (proxy->priv->chunk)
display_chunk_free (proxy->priv->chunk);
proxy->priv->chunk = proxy->priv->chunk_to;
proxy->priv->chunk_to = NULL;
@@ -2602,11 +2602,11 @@ compute_display_chunk (GdaDataProxy *proxy)
g_assert (nb_rows >= 0); /* the number of rows IS known here */
if (proxy->priv->sample_size > 0) {
- if (proxy->priv->sample_first_row >= nb_rows)
- proxy->priv->sample_first_row = proxy->priv->sample_size *
+ if (proxy->priv->sample_first_row >= nb_rows)
+ proxy->priv->sample_first_row = proxy->priv->sample_size *
((nb_rows - 1) / proxy->priv->sample_size);
-
- proxy->priv->sample_last_row = proxy->priv->sample_first_row +
+
+ proxy->priv->sample_last_row = proxy->priv->sample_first_row +
proxy->priv->sample_size - 1;
if (proxy->priv->sample_last_row >= nb_rows)
proxy->priv->sample_last_row = nb_rows - 1;
@@ -2618,14 +2618,14 @@ compute_display_chunk (GdaDataProxy *proxy)
new_nb_rows = nb_rows;
}
- ret_chunk = display_chunk_new (proxy->priv->sample_size > 0 ?
+ ret_chunk = display_chunk_new (proxy->priv->sample_size > 0 ?
proxy->priv->sample_size : nb_rows);
for (i = 0; i < new_nb_rows; i++) {
const GValue *value;
gint val;
g_assert (i + proxy->priv->sample_first_row < nb_rows);
- value = gda_data_model_get_value_at (proxy->priv->filtered_rows,
+ value = gda_data_model_get_value_at (proxy->priv->filtered_rows,
0, i + proxy->priv->sample_first_row, NULL);
g_assert (value);
g_assert (G_VALUE_TYPE (value) == G_TYPE_INT);
@@ -2635,15 +2635,15 @@ compute_display_chunk (GdaDataProxy *proxy)
}
else {
gint i, new_nb_rows = 0;
-
+
if (proxy->priv->model_nb_rows >= 0) {
/* known number of rows */
if (proxy->priv->sample_size > 0) {
- if (proxy->priv->sample_first_row >= proxy->priv->model_nb_rows)
- proxy->priv->sample_first_row = proxy->priv->sample_size *
+ if (proxy->priv->sample_first_row >= proxy->priv->model_nb_rows)
+ proxy->priv->sample_first_row = proxy->priv->sample_size *
((proxy->priv->model_nb_rows - 1) / proxy->priv->sample_size);
-
- proxy->priv->sample_last_row = proxy->priv->sample_first_row +
+
+ proxy->priv->sample_last_row = proxy->priv->sample_first_row +
proxy->priv->sample_size - 1;
if (proxy->priv->sample_last_row >= proxy->priv->model_nb_rows)
proxy->priv->sample_last_row = proxy->priv->model_nb_rows - 1;
@@ -2672,7 +2672,7 @@ compute_display_chunk (GdaDataProxy *proxy)
else {
/* unknown number of rows */
if (proxy->priv->sample_size > 0) {
- proxy->priv->sample_last_row = proxy->priv->sample_first_row +
+ proxy->priv->sample_last_row = proxy->priv->sample_first_row +
proxy->priv->sample_size - 1;
new_nb_rows = proxy->priv->sample_last_row - proxy->priv->sample_first_row + 1;
}
@@ -2758,16 +2758,16 @@ adjust_displayed_chunk (GdaDataProxy *proxy)
#ifdef DEBUG_SYNC
g_print ("////////// %s(%d)\n", __FUNCTION__, __LINE__);
#endif
- display_chunks_dump (proxy);
+ display_chunks_dump (proxy);
/* signal sample changed if necessary */
g_signal_emit (G_OBJECT (proxy),
gda_data_proxy_signals[SAMPLE_CHANGED],
- 0, proxy->priv->sample_first_row, proxy->priv->sample_last_row);
+ 0, proxy->priv->sample_first_row, proxy->priv->sample_last_row);
/* sync proxy->priv->chunk to proxy->priv->chunk_to */
proxy->priv->chunk_sep = 0;
proxy->priv->chunk_proxy_nb_rows = -1;
- if (!proxy->priv->defer_sync)
+ if (!proxy->priv->defer_sync)
chunk_sync_idle (proxy);
else
proxy->priv->chunk_sync_idle_id = g_idle_add ((GSourceFunc) chunk_sync_idle, proxy);
@@ -2846,20 +2846,20 @@ gda_data_proxy_cancel_all_changes (GdaDataProxy *proxy)
if (proxy->priv->chunk) {
/* Using a chunk */
proxy->priv->chunk_to = display_chunk_new (proxy->priv->chunk->mapping->len);
- g_array_append_vals (proxy->priv->chunk_to->mapping,
+ g_array_append_vals (proxy->priv->chunk_to->mapping,
proxy->priv->chunk->mapping->data, proxy->priv->chunk->mapping->len);
-
+
while (proxy->priv->new_rows) {
gint proxy_row;
-
+
proxy_row = row_modif_to_proxy_row (proxy, (ROW_MODIF (proxy->priv->new_rows->data)));
proxy->priv->new_rows = g_slist_delete_link (proxy->priv->new_rows, proxy->priv->new_rows);
-
+
if ((proxy_row >= 0) && proxy->priv->chunk_to)
- g_array_remove_index (proxy->priv->chunk_to->mapping,
+ g_array_remove_index (proxy->priv->chunk_to->mapping,
proxy_row - (proxy->priv->add_null_entry ? 1 : 0));
}
-
+
if (proxy->priv->chunk_to) {
/* sync proxy->priv->chunk to proxy->priv->chunk_to */
gboolean defer_sync = proxy->priv->defer_sync;
@@ -2890,7 +2890,7 @@ gda_data_proxy_cancel_all_changes (GdaDataProxy *proxy)
if (proxy->priv->notify_changes && (model_row >= 0))
proxy_row = row_modif_to_proxy_row (proxy, (ROW_MODIF (proxy->priv->all_modifs->data)));
-
+
row_modifs_free (ROW_MODIF (proxy->priv->all_modifs->data));
if (model_row >= 0) {
gint tmp;
@@ -2898,7 +2898,7 @@ gda_data_proxy_cancel_all_changes (GdaDataProxy *proxy)
g_hash_table_remove (proxy->priv->modify_rows, &tmp);
}
proxy->priv->all_modifs = g_slist_delete_link (proxy->priv->all_modifs, proxy->priv->all_modifs);
-
+
if ((proxy_row >= 0) && proxy->priv->notify_changes)
gda_data_model_row_updated ((GdaDataModel *) proxy, proxy_row);
}
@@ -2964,9 +2964,9 @@ apply_filter_statement (GdaDataProxy *proxy, GError **error)
if (!stmt)
goto clean_previous_filter;
-
+
g_static_mutex_lock (&provider_mutex);
- if (!virtual_provider)
+ if (!virtual_provider)
virtual_provider = gda_vprovider_data_model_new ();
g_static_mutex_unlock (&provider_mutex);
@@ -3004,7 +3004,7 @@ apply_filter_statement (GdaDataProxy *proxy, GError **error)
goto clean_previous_filter;
}
g_object_unref (wrapper);
-
+
/* remork the statement for column names */
GdaSqlStatement *sqlst;
g_object_get (G_OBJECT (stmt), "structure", &sqlst, NULL);
@@ -3059,9 +3059,9 @@ apply_filter_statement (GdaDataProxy *proxy, GError **error)
gchar *sql;
sql = gda_statement_to_sql (stmt, NULL, NULL);
if (sql) {
- if (!g_ascii_strncasecmp (sql, FILTER_SELECT_WHERE, strlen (FILTER_SELECT_WHERE)))
+ if (!g_ascii_strncasecmp (sql, FILTER_SELECT_WHERE, strlen (FILTER_SELECT_WHERE)))
proxy->priv->filter_expr = g_strdup (sql + strlen (FILTER_SELECT_WHERE));
- else if (!g_ascii_strncasecmp (sql, FILTER_SELECT_NOWHERE, strlen (FILTER_SELECT_NOWHERE)))
+ else if (!g_ascii_strncasecmp (sql, FILTER_SELECT_NOWHERE, strlen (FILTER_SELECT_NOWHERE)))
proxy->priv->filter_expr = g_strdup (sql + strlen (FILTER_SELECT_NOWHERE));
g_free (sql);
}
@@ -3115,7 +3115,7 @@ gda_data_proxy_set_filter_expr (GdaDataProxy *proxy, const gchar *filter_expr, G
gda_mutex_lock (proxy->priv->mutex);
if (!filter_expr) {
- if (proxy->priv->filter_stmt)
+ if (proxy->priv->filter_stmt)
g_object_unref (proxy->priv->filter_stmt);
proxy->priv->filter_stmt = NULL;
@@ -3137,7 +3137,7 @@ gda_data_proxy_set_filter_expr (GdaDataProxy *proxy, const gchar *filter_expr, G
i++;
}
}
- if (! g_ascii_strncasecmp (tmp, "orderby", 7))
+ if (! g_ascii_strncasecmp (tmp, "orderby", 7))
sql = g_strdup_printf (FILTER_SELECT_NOWHERE "%s", filter_expr);
else
sql = g_strdup_printf (FILTER_SELECT_WHERE "%s", filter_expr);
@@ -3159,7 +3159,7 @@ gda_data_proxy_set_filter_expr (GdaDataProxy *proxy, const gchar *filter_expr, G
return FALSE;
}
- if (proxy->priv->filter_stmt)
+ if (proxy->priv->filter_stmt)
g_object_unref (proxy->priv->filter_stmt);
proxy->priv->filter_stmt = stmt;
@@ -3211,7 +3211,7 @@ gda_data_proxy_set_ordering_column (GdaDataProxy *proxy, gint col, GError **erro
/* test if we can actually toggle the sort ASC <-> DESC */
if (selst->order_by && !selst->order_by->next) {
GdaSqlSelectOrder *order_by = (GdaSqlSelectOrder*) selst->order_by->data;
- if (order_by->expr && order_by->expr->value &&
+ if (order_by->expr && order_by->expr->value &&
(G_VALUE_TYPE (order_by->expr->value) == G_TYPE_STRING) &&
gda_identifier_equal (g_value_get_string (order_by->expr->value), colname)) {
order_by->asc = !order_by->asc;
@@ -3227,7 +3227,7 @@ gda_data_proxy_set_ordering_column (GdaDataProxy *proxy, gint col, GError **erro
g_slist_free (selst->order_by);
selst->order_by = NULL;
}
-
+
GdaSqlSelectOrder *order_by;
GdaSqlExpr *expr;
order_by = gda_sql_select_order_new (GDA_SQL_ANY_PART (selst));
@@ -3305,7 +3305,7 @@ gda_data_proxy_get_filtered_n_rows (GdaDataProxy *proxy)
}
}
-/*
+/*
* GdaDataModel interface implementation
*/
static gint
@@ -3326,8 +3326,8 @@ gda_data_proxy_get_n_rows (GdaDataModel *model)
if (proxy->priv->chunk_to && proxy->priv->chunk_to->mapping) {
nbrows = proxy->priv->chunk_proxy_nb_rows;
}
- else
- nbrows = proxy->priv->model_nb_rows +
+ else
+ nbrows = proxy->priv->model_nb_rows +
g_slist_length (proxy->priv->new_rows);
}
else
@@ -3369,7 +3369,7 @@ static void create_columns (GdaDataProxy *proxy)
/* current proxy's values */
for (i = 0; i < proxy->priv->model_nb_cols; i++) {
GdaColumn *orig;
-
+
orig = gda_data_model_describe_column (proxy->priv->model, i);
proxy->priv->columns[i] = gda_column_copy (orig);
gda_column_set_position (proxy->priv->columns[i], i);
@@ -3381,8 +3381,8 @@ static void create_columns (GdaDataProxy *proxy)
const gchar *cname;
gchar *newname, *id;
gint k;
-
- orig = gda_data_model_describe_column (proxy->priv->model,
+
+ orig = gda_data_model_describe_column (proxy->priv->model,
i - proxy->priv->model_nb_cols);
proxy->priv->columns[i] = gda_column_copy (orig);
g_object_get ((GObject*) proxy->priv->columns[i], "id", &id, NULL);
@@ -3414,11 +3414,11 @@ static void create_columns (GdaDataProxy *proxy)
}
cname = gda_column_get_name (orig);
- if (cname && *cname)
+ if (cname && *cname)
newname = g_strdup_printf ("pre%s", cname);
else
newname = g_strdup_printf ("pre%d", i);
-
+
/* make sure there is no duplicate name */
for (k = 0; ; k++) {
gint j;
@@ -3431,7 +3431,7 @@ static void create_columns (GdaDataProxy *proxy)
if (j == i)
break;
g_free (newname);
- if (cname && *cname)
+ if (cname && *cname)
newname = g_strdup_printf ("pre%s_%d", cname, k);
else
newname = g_strdup_printf ("pre%d_%d", i, k);
@@ -3499,7 +3499,7 @@ gda_data_proxy_get_value_at (GdaDataModel *model, gint column, gint proxy_row, G
/* there are some modifications to the row, see if there are some for the column */
GSList *list;
RowValue *rv = NULL;
-
+
list = rm->modify_values;
while (list && !rv) {
if (ROW_VALUE (list->data)->model_column == model_col)
@@ -3540,7 +3540,7 @@ gda_data_proxy_get_value_at (GdaDataModel *model, gint column, gint proxy_row, G
gda_mutex_unlock (proxy->priv->mutex);
return retval;
}
-
+
/* proxied data model's values (original values) */
if (column < 2 *proxy->priv->model_nb_cols) {
RowModif *rm;
@@ -3578,7 +3578,7 @@ gda_data_proxy_get_value_at (GdaDataModel *model, gint column, gint proxy_row, G
gda_mutex_unlock (proxy->priv->mutex);
return retval;
}
-
+
g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
_("Column %d out of range (0-%d)"), column, 2 *proxy->priv->model_nb_cols - 1);
@@ -3640,14 +3640,14 @@ gda_data_proxy_find_row_from_values (GdaDataModel *model, GSList *values, gint *
GSList *list;
gint index;
const GValue *value;
-
+
for (list = values, index = 0;
list;
list = list->next, index++) {
if (cols_index)
g_return_val_if_fail (cols_index [index] < proxy->priv->model_nb_cols, FALSE);
- value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy,
- cols_index ? cols_index [index] :
+ value = gda_data_proxy_get_value_at ((GdaDataModel *) proxy,
+ cols_index ? cols_index [index] :
index, proxy_row, NULL);
if ((!value) || !list->data ||
(G_VALUE_TYPE (value) != G_VALUE_TYPE ((GValue *) list->data)) ||
@@ -3661,7 +3661,7 @@ gda_data_proxy_find_row_from_values (GdaDataModel *model, GSList *values, gint *
break;
}
}
-
+
gda_mutex_unlock (proxy->priv->mutex);
return found ? proxy_row : -1;
}
@@ -3691,7 +3691,7 @@ gda_data_proxy_create_iter (GdaDataModel *model)
for (; plist1 && plist2; plist1 = plist1->next, plist2 = plist2->next)
gda_attributes_manager_copy (gda_holder_attributes_manager, (gpointer) plist2->data,
gda_holder_attributes_manager, (gpointer) plist1->data);
- if (plist1 || plist2)
+ if (plist1 || plist2)
g_warning ("Proxy iterator does not have the same length as proxied model's iterator: %d/%d",
g_slist_length (GDA_SET (iter)->holders),
g_slist_length (GDA_SET (iter2)->holders));
@@ -3722,7 +3722,7 @@ gda_data_proxy_get_access_flags (GdaDataModel *model)
}
static gboolean
-gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, const GValue *value,
+gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, const GValue *value,
GError **error)
{
GdaDataProxy *proxy;
@@ -3777,14 +3777,14 @@ gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, cons
rm = find_or_create_row_modif (proxy, proxy_row, col, &rv);
if (rv) {
- /* compare with the original value (before modifications) and either delete the RowValue,
+ /* compare with the original value (before modifications) and either delete the RowValue,
* or alter it */
if (rv->value) {
gda_value_free (rv->value);
rv->value = NULL;
}
- if (rm->orig_values && (col < rm->orig_values_size) &&
+ if (rm->orig_values && (col < rm->orig_values_size) &&
rm->orig_values [col] &&
! gda_value_compare ((GValue *) value, rm->orig_values [col])) {
/* remove the RowValue */
@@ -3795,7 +3795,7 @@ gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, cons
else {
/* simply alter the RowValue */
GdaValueAttribute flags = g_value_get_flags (rv->attributes);
-
+
if (value && !gda_value_is_null ((GValue *) value)) {
flags &= ~GDA_VALUE_ATTR_IS_NULL;
rv->value = gda_value_copy ((GValue*) value);
@@ -3828,7 +3828,7 @@ gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, cons
g_value_set_flags (rv->attributes, flags);
rm->modify_values = g_slist_prepend (rm->modify_values, rv);
}
-
+
if (rv) {
GdaValueAttribute flags = g_value_get_flags (rv->attributes);
flags &= ~GDA_VALUE_ATTR_IS_UNCHANGED;
@@ -3849,7 +3849,7 @@ gda_data_proxy_set_value_at (GdaDataModel *model, gint col, gint proxy_row, cons
gda_data_model_row_updated ((GdaDataModel *) proxy, proxy_row);
}
else {
- g_set_error (error, GDA_DATA_PROXY_ERROR, GDA_DATA_PROXY_READ_ONLY_VALUE,
+ g_set_error (error, GDA_DATA_PROXY_ERROR, GDA_DATA_PROXY_READ_ONLY_VALUE,
_("Trying to change read-only column: %d"), col);
gda_mutex_unlock (proxy->priv->mutex);
return FALSE;
@@ -3874,7 +3874,7 @@ gda_data_proxy_set_values (GdaDataModel *model, gint row, GList *values, GError
if (!values)
return TRUE;
- g_return_val_if_fail (g_list_length (values) <= gda_data_proxy_get_n_columns (model), FALSE);
+ g_return_val_if_fail ((gint)g_list_length (values) <= gda_data_proxy_get_n_columns (model), FALSE);
/* check values */
col = 0;
@@ -3896,7 +3896,7 @@ gda_data_proxy_set_values (GdaDataModel *model, gint row, GList *values, GError
col++;
list = g_list_next (list);
}
-
+
/* stop here if there is a value error */
if (err)
return FALSE;
@@ -3908,7 +3908,7 @@ gda_data_proxy_set_values (GdaDataModel *model, gint row, GList *values, GError
proxy->priv->notify_changes = FALSE;
for (col = 0, list = values; list; col ++, list = list->next) {
- if (list->data &&
+ if (list->data &&
!gda_data_proxy_set_value_at (model, col, row, (GValue *)(list->data), error)) {
err = TRUE;
break;
@@ -3943,7 +3943,7 @@ gda_data_proxy_append_values (GdaDataModel *model, const GList *values, GError *
/* temporary disable changes notification */
notify_changes = proxy->priv->notify_changes;
proxy->priv->notify_changes = FALSE;
-
+
newrow = gda_data_proxy_append (proxy);
if (! gda_data_proxy_set_values (model, newrow, (GList *) values, error)) {
gda_data_proxy_remove_row (model, newrow, NULL);
diff --git a/libgda/gda-data-select.c b/libgda/gda-data-select.c
index 8210e26..becd6e7 100644
--- a/libgda/gda-data-select.c
+++ b/libgda/gda-data-select.c
@@ -51,7 +51,7 @@ typedef struct {
static void delayed_select_stmt_free (DelayedSelectStmt *dstmt);
/*
- * To go from an "external" row number to an "internal" row number and then to a GdaRow,
+ * To go from an "external" row number to an "internal" row number and then to a GdaRow,
* the following steps are required:
* - use @del_rows to determine if the row has been removed (if it's in the array), and otherwise
* get an "internal" row number
@@ -73,7 +73,7 @@ typedef struct {
GdaSet *ext_params;
gboolean reset_with_ext_params_change;
GdaDataModelAccessFlags usage_flags;
-
+
/* attributes specific to data model modifications */
GdaDataSelectInternals *modif_internals;
@@ -165,7 +165,7 @@ static gboolean gda_data_select_iter_next (GdaDataModel *model
static gboolean gda_data_select_iter_prev (GdaDataModel *model, GdaDataModelIter *iter);
static gboolean gda_data_select_iter_at_row (GdaDataModel *model, GdaDataModelIter *iter, gint row);
-static gboolean gda_data_select_set_value_at (GdaDataModel *model, gint col, gint row,
+static gboolean gda_data_select_set_value_at (GdaDataModel *model, gint col, gint row,
const GValue *value, GError **error);
static gboolean gda_data_select_iter_set_value (GdaDataModel *model, GdaDataModelIter *iter, gint col,
const GValue *value, GError **error);
@@ -221,7 +221,7 @@ gda_data_select_get_type (void)
return type;
}
-static void
+static void
gda_data_select_class_init (GdaDataSelectClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -233,17 +233,17 @@ gda_data_select_class_init (GdaDataSelectClass *klass)
object_class->get_property = gda_data_select_get_property;
g_object_class_install_property (object_class, PROP_CNC,
g_param_spec_object ("connection", NULL,
- "Connection from which this data model is created",
+ "Connection from which this data model is created",
GDA_TYPE_CONNECTION,
G_PARAM_WRITABLE | G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_PREP_STMT,
- g_param_spec_object ("prepared-stmt", NULL,
- "Associated prepared statement (for internal usage)",
+ g_param_spec_object ("prepared-stmt", NULL,
+ "Associated prepared statement (for internal usage)",
GDA_TYPE_PSTMT,
G_PARAM_WRITABLE | G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_FLAGS,
- g_param_spec_uint ("model-usage", NULL,
- "Determines how the data model may be used",
+ g_param_spec_uint ("model-usage", NULL,
+ "Determines how the data model may be used",
GDA_DATA_MODEL_ACCESS_RANDOM, G_MAXUINT,
GDA_DATA_MODEL_ACCESS_RANDOM,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
@@ -252,24 +252,24 @@ gda_data_select_class_init (GdaDataSelectClass *klass)
"Tells if model has analyzed all the rows", FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_PARAMS,
- g_param_spec_object ("exec-params", NULL,
- "GdaSet used when the SELECT statement was executed",
+ g_param_spec_object ("exec-params", NULL,
+ "GdaSet used when the SELECT statement was executed",
GDA_TYPE_SET,
G_PARAM_WRITABLE | G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_INS_QUERY,
- g_param_spec_object ("insert-stmt", "INSERT statement",
+ g_param_spec_object ("insert-stmt", "INSERT statement",
"INSERT Statement to be executed to add data",
GDA_TYPE_STATEMENT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_UPD_QUERY,
- g_param_spec_object ("update-stmt", "UPDATE statement",
+ g_param_spec_object ("update-stmt", "UPDATE statement",
"UPDATE Statement to be executed to update data",
GDA_TYPE_STATEMENT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_DEL_QUERY,
- g_param_spec_object ("delete-stmt", "DELETE statement",
+ g_param_spec_object ("delete-stmt", "DELETE statement",
"DELETE Statement to be executed to remove data",
GDA_TYPE_STATEMENT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -312,7 +312,7 @@ gda_data_select_data_model_init (GdaDataModelIface *iface)
iface->i_append_row = NULL;
iface->i_remove_row = gda_data_select_remove_row;
iface->i_find_row = NULL;
-
+
iface->i_set_notify = gda_data_select_set_notify;
iface->i_get_notify = gda_data_select_get_notify;
iface->i_send_hint = NULL;
@@ -508,7 +508,7 @@ _gda_data_select_internals_free (GdaDataSelectInternals *inter)
gda_sql_expr_free (inter->unique_row_condition);
inter->unique_row_condition = NULL;
}
-
+
if (inter->insert_to_select_mapping) {
g_free (inter->insert_to_select_mapping);
inter->insert_to_select_mapping = NULL;
@@ -524,12 +524,12 @@ _gda_data_select_internals_free (GdaDataSelectInternals *inter)
inter->modif_params [i] = NULL;
}
}
-
+
if (inter->exec_set) {
g_object_unref (inter->exec_set);
inter->exec_set = NULL;
}
-
+
for (i = FIRST_QUERY; i < NB_QUERIES; i++) {
if (inter->modif_stmts [i]) {
g_object_unref (inter->modif_stmts [i]);
@@ -565,7 +565,7 @@ gda_data_select_finalize (GObject *object)
/* free memory */
if (model->priv) {
if (model->priv->exceptions) {
- gint i;
+ guint i;
for (i = 0; i < model->priv->exceptions->len; i++) {
GError *e;
e = g_array_index (model->priv->exceptions, GError*, i);
@@ -600,7 +600,7 @@ _gda_data_select_internals_paste (GdaDataSelect *model, GdaDataSelectInternals *
}
static void
-create_columns (GdaDataSelect *model)
+create_columns (GdaDataSelect *model)
{
gint i;
if (model->priv->sh->columns) {
@@ -625,7 +625,7 @@ create_columns (GdaDataSelect *model)
for (i = 0; i < model->prep_stmt->ncols; i++) {
GdaColumn *gda_col;
gda_col = gda_column_new ();
- if (model->prep_stmt->types)
+ if (model->prep_stmt->types)
gda_column_set_g_type (gda_col, model->prep_stmt->types [i]);
model->priv->sh->columns = g_slist_append (model->priv->sh->columns, gda_col);
}
@@ -655,7 +655,7 @@ gda_data_select_set_property (GObject *object,
g_object_ref (model->prep_stmt);
sel_stmt = gda_pstmt_get_gda_statement (model->prep_stmt);
if (sel_stmt &&
- gda_statement_get_statement_type (sel_stmt) == GDA_SQL_STATEMENT_SELECT)
+ gda_statement_get_statement_type (sel_stmt) == GDA_SQL_STATEMENT_SELECT)
model->priv->sh->sel_stmt = gda_statement_copy (sel_stmt);
}
create_columns (model);
@@ -672,7 +672,7 @@ gda_data_select_set_property (GObject *object,
if (g_value_get_boolean (value)) {
if ((model->advertized_nrows < 0) && CLASS (model)->fetch_nb_rows)
CLASS (model)->fetch_nb_rows (model);
-
+
if (model->nb_stored_rows != model->advertized_nrows) {
if (CLASS (model)->store_all)
CLASS (model)->store_all (model, NULL);
@@ -684,7 +684,7 @@ gda_data_select_set_property (GObject *object,
set = g_value_get_object (value);
if (set) {
model->priv->sh->ext_params = g_object_ref (set);
- model->priv->ext_params_changed_sig_id =
+ model->priv->ext_params_changed_sig_id =
g_signal_connect (model->priv->sh->ext_params, "holder-changed",
G_CALLBACK (ext_params_holder_changed_cb), model);
model->priv->sh->modif_internals->exec_set = gda_set_copy (set);
@@ -761,7 +761,7 @@ gda_data_select_get_property (GObject *object,
case PROP_UPD_QUERY:
g_value_set_object (value, model->priv->sh->modif_internals->modif_stmts [UPD_QUERY]);
break;
- case PROP_SEL_STMT:
+ case PROP_SEL_STMT:
g_value_set_object (value, check_acceptable_statement (model, NULL));
break;
case PROP_RESET_WITH_EXT_PARAM:
@@ -780,7 +780,7 @@ gda_data_select_get_property (GObject *object,
* @row: (transfer full): a #GdaRow row
* @rownum: "external" advertized row number
*
- * Stores @row into @model, externally advertized at row number @rownum (if no row has been removed).
+ * Stores @row into @model, externally advertized at row number @rownum (if no row has been removed).
* The reference to @row is stolen.
*/
void
@@ -791,7 +791,7 @@ gda_data_select_take_row (GdaDataSelect *model, GdaRow *row, gint rownum)
g_return_if_fail (GDA_IS_ROW (row));
tmp = rownum;
- if (g_hash_table_lookup (model->priv->sh->index, &tmp))
+ if (g_hash_table_lookup (model->priv->sh->index, &tmp))
g_error ("INTERNAL error: row %d already exists, aborting", rownum);
ptr = g_new (gint, 2);
@@ -820,9 +820,9 @@ gda_data_select_get_stored_row (GdaDataSelect *model, gint rownum)
irow = rownum;
ptr = g_hash_table_lookup (model->priv->sh->index, &irow);
- if (ptr)
+ if (ptr)
return g_array_index (model->priv->sh->rows, GdaRow *, *ptr);
- else
+ else
return NULL;
}
@@ -877,7 +877,7 @@ static gboolean
compute_modif_set (GdaDataSelect *model, GError **error)
{
gint i;
-
+
if (model->priv->sh->modif_internals->modif_set)
g_object_unref (model->priv->sh->modif_internals->modif_set);
if (model->priv->sh->modif_internals->exec_set)
@@ -903,10 +903,10 @@ compute_modif_set (GdaDataSelect *model, GError **error)
}
gda_set_merge_with_set (model->priv->sh->modif_internals->modif_set, set);
-
+
GSList *list;
for (list = set->holders; list; list = list->next) {
- GdaHolder *holder;
+ GdaHolder *holder;
holder = gda_set_get_holder (model->priv->sh->modif_internals->modif_set,
gda_holder_get_id ((GdaHolder*) list->data));
model->priv->sh->modif_internals->modif_params [i] =
@@ -947,7 +947,7 @@ param_name_to_int (const gchar *pname, gint *result, gboolean *old_val)
if (!pname || ((*pname != '-') && (*pname != '+')))
return FALSE;
-
+
ptr = pname + 1;
while (*ptr) {
if ((*ptr > '9') || (*ptr < '0'))
@@ -955,12 +955,12 @@ param_name_to_int (const gchar *pname, gint *result, gboolean *old_val)
sum = sum * 10 + *ptr - '0';
ptr++;
}
-
- if (result)
+
+ if (result)
*result = sum;
if (old_val)
*old_val = (*pname == '-') ? TRUE : FALSE;
-
+
return TRUE;
}
@@ -995,7 +995,7 @@ gda_data_select_set_modification_statement_sql (GdaDataSelect *model, const gcha
stmt = gda_sql_parser_parse_string (parser, sql, &remain, error);
g_object_unref (parser);
- if (!stmt)
+ if (!stmt)
return FALSE;
if (remain) {
g_object_unref (stmt);
@@ -1003,7 +1003,7 @@ gda_data_select_set_modification_statement_sql (GdaDataSelect *model, const gcha
"%s", _("Incorrect SQL expression"));
return FALSE;
}
-
+
retval = gda_data_select_set_modification_statement (model, stmt, error);
g_object_unref (stmt);
@@ -1117,7 +1117,7 @@ gda_data_select_set_modification_statement (GdaDataSelect *model, GdaStatement *
gda_sql_statement_free (sqlst);
return FALSE;
}
-
+
gda_sql_statement_free (sqlst);
break;
}
@@ -1184,7 +1184,7 @@ gda_data_select_set_modification_statement (GdaDataSelect *model, GdaStatement *
gda_sql_statement_free (sqlst);
return FALSE;
}
- }
+ }
else {
if (model->priv->sh->modif_internals->unique_row_condition) {
/* replace WHERE with model->priv->sh->modif_internals->unique_row_condition */
@@ -1197,14 +1197,14 @@ gda_data_select_set_modification_statement (GdaDataSelect *model, GdaStatement *
gda_sql_statement_free (sqlst);
return FALSE;
}
- }
+ }
gda_sql_statement_free (sqlst);
break;
}
default:
break;
}
-
+
if (mtype != NB_QUERIES) {
if (! gda_statement_check_structure (mod_stmt, error))
return FALSE;
@@ -1244,7 +1244,7 @@ gda_data_select_set_modification_statement (GdaDataSelect *model, GdaStatement *
if (num > gda_data_select_get_n_columns ((GdaDataModel*) model)) {
g_set_error (error, GDA_DATA_SELECT_ERROR,
GDA_DATA_SELECT_MISSING_MODIFICATION_STATEMENT_ERROR,
- _("Column %d out of range (0-%d)"), num,
+ _("Column %d out of range (0-%d)"), num,
gda_data_select_get_n_columns ((GdaDataModel*) model)-1);
g_object_unref (params);
if (params_to_add)
@@ -1372,7 +1372,7 @@ gda_data_select_compute_modification_statements (GdaDataSelect *model, GError **
}
for (mtype = FIRST_QUERY; mtype < NB_QUERIES; mtype++) {
- if (modif_stmts[mtype])
+ if (modif_stmts[mtype])
g_object_unref (modif_stmts[mtype]);
}
@@ -1382,7 +1382,7 @@ gda_data_select_compute_modification_statements (GdaDataSelect *model, GError **
static gboolean
row_selection_condition_foreach_func (GdaSqlAnyPart *part, G_GNUC_UNUSED gpointer data, GError **error)
{
- if (part->type != GDA_SQL_ANY_SQL_OPERATION)
+ if (part->type != GDA_SQL_ANY_SQL_OPERATION)
return TRUE;
GdaSqlOperation *op = (GdaSqlOperation*) part;
@@ -1430,7 +1430,7 @@ gda_data_select_set_row_selection_condition (GdaDataSelect *model, GdaSqlExpr *
NULL, error);
if (!valid)
return FALSE;
-
+
model->priv->sh->modif_internals->unique_row_condition = gda_sql_expr_copy (expr);
return TRUE;
}
@@ -1444,15 +1444,15 @@ gda_data_select_set_row_selection_condition (GdaDataSelect *model, GdaSqlExpr *
* Specifies the SQL condition corresponding to the WHERE part of a SELECT statement which would
* return only 1 row (the expression of the primary key).
*
- * For example for a table created as <![CDATA["CREATE TABLE mytable (part1 int NOT NULL, part2 string NOT NULL,
- * name string, PRIMARY KEY (part1, part2))"]]>, and if @pmodel corresponds to the execution of the
+ * For example for a table created as <![CDATA["CREATE TABLE mytable (part1 int NOT NULL, part2 string NOT NULL,
+ * name string, PRIMARY KEY (part1, part2))"]]>, and if @pmodel corresponds to the execution of the
* <![CDATA["SELECT name, part1, part2 FROM mytable"]]>, then the sensible value for @sql_where would be
* <![CDATA["part1 = ##-1::int AND part2 = ##-2::string"]]> because the values of the 'part1' field are located
* in @pmodel's column number 1 and the values of the 'part2' field are located
* in @pmodel's column number 2 and the primary key is composed of (part1, part2).
*
* For more information about the syntax of the parameters (named <![CDATA["##-1::int"]]> for example), see the
- * <link linkend="GdaSqlParser.description">GdaSqlParser</link> documentation, and
+ * <link linkend="GdaSqlParser.description">GdaSqlParser</link> documentation, and
* gda_data_select_set_modification_statement().
*
* Returns: TRUE if no error occurred
@@ -1500,10 +1500,10 @@ gda_data_select_set_row_selection_condition_sql (GdaDataSelect *model, const gch
}
g_free (sql);
-
+
g_object_get (stmt, "structure", &sqlst, NULL);
selstmt = (GdaSqlStatementSelect *) sqlst->contents;
-
+
retval = gda_data_select_set_row_selection_condition (model, selstmt->where_cond, error);
gda_sql_statement_free (sqlst);
@@ -1521,7 +1521,7 @@ gda_data_select_set_row_selection_condition_sql (GdaDataSelect *model, const gch
*
* NOTE1: make sure the meta data associated to the connection is up to date before using this
* method, see gda_connection_update_meta_store().
- *
+ *
* NOTE2: if the SELECT statement from which @model has been created uses more than one table, or
* if the table used does not have any primary key, then this method will fail
*
@@ -1575,9 +1575,9 @@ gda_data_select_compute_row_selection_condition (GdaDataSelect *model, GError **
g_value_set_string ((nvalue = gda_value_new (G_TYPE_STRING)), target->table_name);
mstruct = gda_meta_struct_new (gda_connection_get_meta_store (model->priv->cnc), GDA_META_STRUCT_FEATURE_NONE);
dbo = gda_meta_struct_complement (mstruct, GDA_META_DB_TABLE, NULL, NULL, nvalue, error);
- if (!dbo)
+ if (!dbo)
goto out;
-
+
expr = gda_compute_unique_table_row_condition (select, GDA_META_TABLE (dbo), TRUE, error);
retval = gda_data_select_set_row_selection_condition (model, expr, error);
@@ -1603,11 +1603,11 @@ gda_data_select_get_n_rows (GdaDataModel *model)
g_return_val_if_fail (imodel->priv, 0);
retval = imodel->advertized_nrows;
- if ((imodel->advertized_nrows < 0) &&
+ if ((imodel->advertized_nrows < 0) &&
(imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM) &&
CLASS (model)->fetch_nb_rows)
retval = CLASS (model)->fetch_nb_rows (imodel);
-
+
if ((retval > 0) && (imodel->priv->sh->del_rows))
retval -= imodel->priv->sh->del_rows->len;
return retval;
@@ -1620,7 +1620,7 @@ gda_data_select_get_n_columns (GdaDataModel *model)
imodel = GDA_DATA_SELECT (model);
g_return_val_if_fail (imodel->priv, 0);
-
+
if (imodel->prep_stmt)
return imodel->prep_stmt->ncols;
else
@@ -1690,9 +1690,9 @@ external_to_internal_row (GdaDataSelect *model, gint ext_row, GError **error)
break;
}
}
-
+
/* check row number validity */
- nrows = model->advertized_nrows < 0 ? gda_data_select_get_n_rows ((GdaDataModel*) model) :
+ nrows = model->advertized_nrows < 0 ? gda_data_select_get_n_rows ((GdaDataModel*) model) :
model->advertized_nrows;
if ((ext_row < 0) || ((nrows >= 0) && (int_row >= nrows))) {
gint n;
@@ -1782,10 +1782,10 @@ gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **
types [imodel->prep_stmt->ncols] = G_TYPE_NONE;
}
tmpmodel = gda_connection_statement_execute_select_full (imodel->priv->cnc,
- dstmt->select,
- dstmt->params,
+ dstmt->select,
+ dstmt->params,
GDA_STATEMENT_MODEL_RANDOM_ACCESS,
- types,
+ types,
NULL);
g_free (types);
@@ -1814,7 +1814,7 @@ gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **
cvalue = gda_data_model_get_value_at (tmpmodel, i, 0, error);
if (!cvalue)
return NULL;
-
+
if (!gda_value_is_null (cvalue)) {
gda_value_reset_with_type (value, G_VALUE_TYPE (cvalue));
if (! gda_value_set_from_value (value, cvalue)) {
@@ -1842,14 +1842,14 @@ gda_data_select_get_value_at (GdaDataModel *model, gint col, gint row, GError **
ptr = g_hash_table_lookup (imodel->priv->sh->index, &irow);
if (!ptr) {
prow = NULL;
- if (CLASS (model)->fetch_random &&
+ if (CLASS (model)->fetch_random &&
!CLASS (model)->fetch_random (imodel, &prow, int_row, error))
return NULL;
}
else
prow = g_array_index (imodel->priv->sh->rows, GdaRow *, *ptr);
}
-
+
g_assert (prow);
GValue *retval = gda_row_get_value (prow, col);
@@ -1873,7 +1873,7 @@ gda_data_select_get_attributes_at (GdaDataModel *model, gint col, G_GNUC_UNUSED
imodel = (GdaDataSelect *) model;
g_return_val_if_fail (imodel->priv, 0);
-
+
if (imodel->priv->sh->modif_internals->safely_locked ||
!imodel->priv->sh->modif_internals->modif_stmts [UPD_QUERY])
flags = GDA_VALUE_ATTR_NO_MODIF;
@@ -1894,7 +1894,7 @@ gda_data_select_create_iter (GdaDataModel *model)
imodel = (GdaDataSelect *) model;
g_return_val_if_fail (imodel->priv, 0);
- if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
+ if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
return (GdaDataModelIter *) g_object_new (GDA_TYPE_DATA_MODEL_ITER,
"data-model", model, NULL);
else {
@@ -1921,7 +1921,7 @@ gda_data_select_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
imodel = (GdaDataSelect *) model;
g_return_val_if_fail (imodel->priv, FALSE);
- if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
+ if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
return gda_data_model_iter_move_next_default (model, iter);
g_return_val_if_fail (CLASS (model)->fetch_next, FALSE);
@@ -1947,7 +1947,7 @@ gda_data_select_iter_next (GdaDataModel *model, GdaDataModelIter *iter)
g_object_set (G_OBJECT (iter), "current-row", target_iter_row, NULL);
return FALSE;
}
-
+
if (prow) {
imodel->priv->sh->iter_row = target_iter_row;
return update_iter (imodel, prow);
@@ -1971,7 +1971,7 @@ gda_data_select_iter_prev (GdaDataModel *model, GdaDataModelIter *iter)
imodel = (GdaDataSelect *) model;
g_return_val_if_fail (imodel->priv, FALSE);
- if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
+ if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
return gda_data_model_iter_move_prev_default (model, iter);
if (! CLASS (model)->fetch_prev)
@@ -2024,7 +2024,7 @@ gda_data_select_iter_at_row (GdaDataModel *model, GdaDataModelIter *iter, gint r
g_return_val_if_fail (imodel->priv, FALSE);
int_row = external_to_internal_row (imodel, row, NULL);
- if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
+ if (imodel->priv->sh->usage_flags & GDA_DATA_MODEL_ACCESS_RANDOM)
return gda_data_model_iter_move_to_row_default (model, iter, row);
g_return_val_if_fail (iter, FALSE);
@@ -2087,12 +2087,12 @@ update_iter (GdaDataSelect *imodel, GdaRow *prow)
GSList *plist;
gboolean update_model;
gboolean retval = TRUE;
-
+
g_object_get (G_OBJECT (iter), "update-model", &update_model, NULL);
if (update_model)
g_object_set (G_OBJECT (iter), "update-model", FALSE, NULL);
-
- for (i = 0, plist = GDA_SET (iter)->holders;
+
+ for (i = 0, plist = GDA_SET (iter)->holders;
plist;
i++, plist = plist->next) {
GValue *value;
@@ -2114,7 +2114,7 @@ update_iter (GdaDataSelect *imodel, GdaRow *prow)
error && error->message ? error->message : _("No detail"));
gda_holder_set_not_null ((GdaHolder*) plist->data, TRUE);
}
- else
+ else
g_warning (_("Allowed GdaHolder's value to be NULL for the iterator "
"to be updated"));
}
@@ -2156,7 +2156,7 @@ compute_single_update_stmt (GdaDataSelect *model, BVector *bv, GError **error)
sqlst->sql = NULL;
g_assert (sqlst->stmt_type == GDA_SQL_STATEMENT_UPDATE);
upd = (GdaSqlStatementUpdate*) sqlst->contents;
-
+
/* remove non necessary fields to update */
GSList *elist, *flist;
gboolean field_found = FALSE;
@@ -2193,7 +2193,7 @@ compute_single_update_stmt (GdaDataSelect *model, BVector *bv, GError **error)
/* create a new GdaStatement */
if (field_found)
updstmt = (GdaStatement *) g_object_new (GDA_TYPE_STATEMENT, "structure", sqlst, NULL);
- else
+ else
g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_MISSING_MODIFICATION_STATEMENT_ERROR,
"%s", _("Some columns can't be modified"));
gda_sql_statement_free (sqlst);
@@ -2213,7 +2213,7 @@ compute_single_update_stmt (GdaDataSelect *model, BVector *bv, GError **error)
}
}
g_string_append_c (bvstr, ')');
-
+
if (updstmt) {
gchar *sql;
sql = gda_statement_serialize (updstmt);
@@ -2249,7 +2249,7 @@ compute_single_insert_stmt (GdaDataSelect *model, BVector *bv, GError **error)
sqlst->sql = NULL;
g_assert (sqlst->stmt_type == GDA_SQL_STATEMENT_INSERT);
ins = (GdaSqlStatementInsert*) sqlst->contents;
-
+
/* remove fields to insert for which we don't have any value (the default value will be used) */
GSList *elist, *flist;
gboolean field_found = FALSE;
@@ -2286,7 +2286,7 @@ compute_single_insert_stmt (GdaDataSelect *model, BVector *bv, GError **error)
/* create a new GdaStatement */
if (field_found)
insstmt = (GdaStatement *) g_object_new (GDA_TYPE_STATEMENT, "structure", sqlst, NULL);
- else
+ else
g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_MISSING_MODIFICATION_STATEMENT_ERROR,
"%s", _("Some columns can't be modified"));
gda_sql_statement_free (sqlst);
@@ -2306,7 +2306,7 @@ compute_single_insert_stmt (GdaDataSelect *model, BVector *bv, GError **error)
}
}
g_string_append_c (bvstr, ')');
-
+
if (insstmt) {
gchar *sql;
sql = gda_statement_serialize (insstmt);
@@ -2345,7 +2345,7 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
"%s", _("Internal error: can't get the prepared statement's actual statement"));
return NULL;
}
-
+
if (model->priv->sh->modif_internals->unique_row_condition)
row_cond = gda_sql_expr_copy (model->priv->sh->modif_internals->unique_row_condition);
else if (model->priv->sh->modif_internals->modif_stmts [DEL_QUERY]) {
@@ -2353,7 +2353,7 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
GdaSqlStatement *del_sqlst;
GdaSqlStatementDelete *del;
del_stmt = model->priv->sh->modif_internals->modif_stmts [DEL_QUERY];
-
+
g_object_get (G_OBJECT (del_stmt), "structure", &del_sqlst, NULL);
del = (GdaSqlStatementDelete*) del_sqlst->contents;
row_cond = del->cond;
@@ -2369,7 +2369,7 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
GdaSqlStatement *upd_sqlst;
GdaSqlStatementUpdate *upd;
upd_stmt = model->priv->sh->modif_internals->modif_stmts [UPD_QUERY];
-
+
g_object_get (G_OBJECT (upd_stmt), "structure", &upd_sqlst, NULL);
upd = (GdaSqlStatementUpdate*) upd_sqlst->contents;
row_cond = upd->cond;
@@ -2385,7 +2385,7 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
"%s", _("Unable to identify a way to fetch a single row"));
return NULL;
}
-
+
g_object_get (G_OBJECT (sel_stmt), "structure", &sel_sqlst, NULL);
if (sel_sqlst->stmt_type != GDA_SQL_STATEMENT_SELECT) {
g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_MODIFICATION_STATEMENT_ERROR,
@@ -2394,13 +2394,13 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
gda_sql_expr_free (row_cond);
return NULL;
}
-
+
GdaSqlStatementSelect *sel;
sel = (GdaSqlStatementSelect*) sel_sqlst->contents;
g_free (sel_sqlst->sql);
sel_sqlst->sql = NULL;
- if (sel->where_cond)
+ if (sel->where_cond)
gda_sql_expr_free (sel->where_cond);
sel->where_cond = row_cond;
GDA_SQL_ANY_PART (row_cond)->parent = GDA_SQL_ANY_PART (sel);
@@ -2408,7 +2408,7 @@ compute_single_select_stmt (GdaDataSelect *model, GError **error)
ret_stmt = (GdaStatement *) g_object_new (GDA_TYPE_STATEMENT, "structure", sel_sqlst, NULL);
gda_sql_statement_free (sel_sqlst);
-
+
#ifdef GDA_DEBUG_NO
gchar *sql;
sql = gda_statement_serialize (ret_stmt);
@@ -2493,7 +2493,7 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
/* compute UPDATE statement */
if (! imodel->priv->sh->modif_internals->upd_stmts)
- imodel->priv->sh->modif_internals->upd_stmts = g_hash_table_new_full ((GHashFunc) bvector_hash, (GEqualFunc) bvector_equal,
+ imodel->priv->sh->modif_internals->upd_stmts = g_hash_table_new_full ((GHashFunc) bvector_hash, (GEqualFunc) bvector_equal,
(GDestroyNotify) bvector_free, g_object_unref);
stmt = g_hash_table_lookup (imodel->priv->sh->modif_internals->upd_stmts, bv);
if (! stmt) {
@@ -2537,14 +2537,14 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
if (free_bv)
bvector_free (bv);
-
+
/* actually execute UPDATE statement */
#ifdef GDA_DEBUG_NO
gchar *sql;
GError *lerror = NULL;
sql = gda_statement_to_sql_extended (stmt,
imodel->priv->cnc,
- imodel->priv->sh->modif_internals->modif_set,
+ imodel->priv->sh->modif_internals->modif_set,
GDA_STATEMENT_SQL_PRETTY, NULL,
&lerror);
g_print ("%s(): SQL=> %s\n", __FUNCTION__, sql);
@@ -2557,7 +2557,7 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
imodel->priv->sh->modif_internals->modif_set,
NULL, error) == -1)
return FALSE;
-
+
/* mark that this row has been modified */
DelayedSelectStmt *dstmt;
dstmt = g_new0 (DelayedSelectStmt, 1);
@@ -2576,8 +2576,8 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
GdaHolder *h = (GdaHolder*) list->data;
gint res;
gboolean old;
- if (gda_holder_is_valid ((GdaHolder*) list->data) &&
- param_name_to_int (gda_holder_get_id (h), &res, &old) &&
+ if (gda_holder_is_valid ((GdaHolder*) list->data) &&
+ param_name_to_int (gda_holder_get_id (h), &res, &old) &&
!old) {
str = g_strdup_printf ("-%d", res);
holder = gda_set_get_holder (imodel->priv->sh->modif_internals->modif_set,
@@ -2594,9 +2594,9 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
for (list = dstmt->params->holders; list && allok; list = list->next) {
GdaHolder *holder = GDA_HOLDER (list->data);
GdaHolder *eholder;
- eholder = gda_set_get_holder (imodel->priv->sh->modif_internals->modif_set,
+ eholder = gda_set_get_holder (imodel->priv->sh->modif_internals->modif_set,
gda_holder_get_id (holder));
- if (!eholder ||
+ if (!eholder ||
! gda_holder_set_value (holder, gda_holder_get_value (eholder), NULL)) {
allok = FALSE;
break;
@@ -2612,7 +2612,7 @@ vector_set_value_at (GdaDataSelect *imodel, BVector *bv, GdaDataModelIter *iter,
dstmt->row = NULL;
if (! imodel->priv->sh->upd_rows)
imodel->priv->sh->upd_rows = g_hash_table_new_full (g_int_hash, g_int_equal,
- g_free,
+ g_free,
(GDestroyNotify) delayed_select_stmt_free);
gint *tmp = g_new (gint, 1);
*tmp = int_row;
@@ -2661,7 +2661,7 @@ gda_data_select_set_value_at (GdaDataModel *model, gint col, gint row, const GVa
_("Column %d out of range (0-%d)"), col, ncols-1);
return FALSE;
}
-
+
/* invalidate all the imodel->priv->sh->modif_internals->modif_set's value holders */
GSList *list;
for (list = imodel->priv->sh->modif_internals->modif_set->holders; list; list = list->next) {
@@ -2728,7 +2728,7 @@ gda_data_select_iter_set_value (GdaDataModel *model, GdaDataModelIter *iter, gi
_("Column %d out of range (0-%d)"), col, ncols-1);
return FALSE;
}
-
+
/* invalidate all the imodel->priv->sh->modif_internals->modif_set's value holders */
GSList *list;
for (list = imodel->priv->sh->modif_internals->modif_set->holders; list; list = list->next) {
@@ -2805,7 +2805,7 @@ gda_data_select_set_values (GdaDataModel *model, gint row, GList *values, GError
"%s", _("No UPDATE statement provided"));
return FALSE;
}
-
+
ncols = gda_data_select_get_n_columns (model);
nvalues = g_list_length (values);
if (nvalues > ncols) {
@@ -2925,16 +2925,16 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
bvector_free (bv);
g_set_error (error, GDA_DATA_SELECT_ERROR, GDA_DATA_SELECT_MODIFICATION_STATEMENT_ERROR,
"%s", _("Missing values to insert in INSERT statement"));
-
+
return -1;
}
/* compute INSERT statement */
GdaStatement *stmt;
if (! imodel->priv->sh->modif_internals->ins_stmts)
- imodel->priv->sh->modif_internals->ins_stmts = g_hash_table_new_full ((GHashFunc) bvector_hash,
- (GEqualFunc) bvector_equal,
- (GDestroyNotify) bvector_free,
+ imodel->priv->sh->modif_internals->ins_stmts = g_hash_table_new_full ((GHashFunc) bvector_hash,
+ (GEqualFunc) bvector_equal,
+ (GDestroyNotify) bvector_free,
g_object_unref);
stmt = g_hash_table_lookup (imodel->priv->sh->modif_internals->ins_stmts, bv);
if (! stmt) {
@@ -2982,7 +2982,7 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
GError *lerror = NULL;
sql = gda_statement_to_sql_extended (stmt,
imodel->priv->cnc,
- imodel->priv->sh->modif_internals->modif_set,
+ imodel->priv->sh->modif_internals->modif_set,
GDA_STATEMENT_SQL_PRETTY, NULL,
&lerror);
g_print ("%s(): SQL=> %s\n", __FUNCTION__, sql);
@@ -3016,7 +3016,7 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
if (dstmt->params) {
GSList *list;
if (! imodel->priv->sh->modif_internals->insert_to_select_mapping)
- imodel->priv->sh->modif_internals->insert_to_select_mapping =
+ imodel->priv->sh->modif_internals->insert_to_select_mapping =
compute_insert_select_params_mapping (dstmt->params, last_insert,
imodel->priv->sh->modif_internals->unique_row_condition);
if (imodel->priv->sh->modif_internals->insert_to_select_mapping) {
@@ -3024,12 +3024,12 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
GdaHolder *holder = GDA_HOLDER (list->data);
GdaHolder *eholder;
gint pos;
-
+
g_assert (param_name_to_int (gda_holder_get_id (holder), &pos, NULL));
-
- eholder = g_slist_nth_data (last_insert->holders,
+
+ eholder = g_slist_nth_data (last_insert->holders,
imodel->priv->sh->modif_internals->insert_to_select_mapping[pos]);
- if (!eholder ||
+ if (!eholder ||
! gda_holder_set_value (holder, gda_holder_get_value (eholder), error)) {
g_object_unref (dstmt->params);
dstmt->params = NULL;
@@ -3045,7 +3045,7 @@ gda_data_select_append_values (GdaDataModel *model, const GList *values, GError
dstmt->row = NULL;
if (! imodel->priv->sh->upd_rows)
imodel->priv->sh->upd_rows = g_hash_table_new_full (g_int_hash, g_int_equal,
- g_free,
+ g_free,
(GDestroyNotify) delayed_select_stmt_free);
gint *tmp = g_new (gint, 1);
*tmp = int_row;
@@ -3118,7 +3118,7 @@ gda_data_select_remove_row (GdaDataModel *model, gint row, GError **error)
GError *lerror = NULL;
sql = gda_statement_to_sql_extended (imodel->priv->sh->modif_internals->modif_stmts [DEL_QUERY],
imodel->priv->cnc,
- imodel->priv->sh->modif_internals->modif_set,
+ imodel->priv->sh->modif_internals->modif_set,
GDA_STATEMENT_SQL_PRETTY, NULL,
&lerror);
g_print ("%s(): SQL=> %s\n", __FUNCTION__, sql);
@@ -3126,7 +3126,7 @@ gda_data_select_remove_row (GdaDataModel *model, gint row, GError **error)
g_print ("\tERR: %s\n", lerror && lerror->message ? lerror->message : "No detail");
g_free (sql);
#endif
- if (gda_connection_statement_execute_non_select (imodel->priv->cnc,
+ if (gda_connection_statement_execute_non_select (imodel->priv->cnc,
imodel->priv->sh->modif_internals->modif_stmts [DEL_QUERY],
imodel->priv->sh->modif_internals->modif_set, NULL, error) == -1)
return FALSE;
@@ -3196,8 +3196,8 @@ gda_data_select_add_exception (GdaDataSelect *model, GError *error)
* execute the model->one_row_select_stmt statement (GdaHolders named "-<num>", in ), and the GdaHolder
* returned after having executed the model->modif_stmts[INS_QUERY] INSERT statement.
*
- * The way of preceeding is:
- * - for each parameter required by model->one_row_select_stmt statement (the @sel_params argument),
+ * The way of preceeding is:
+ * - for each parameter required by model->one_row_select_stmt statement (the @sel_params argument),
* use the model->priv->sh->modif_internals->unique_row_condition to get the name of the corresponding column (the GdaHolder's ID
* is "-<num1>" )
* - from the column name get the GdaHolder in the GdaSet retruned after the INSERT statement (the
@@ -3239,7 +3239,7 @@ compute_insert_select_params_mapping (GdaSet *sel_params, GdaSet *ins_values, Gd
if ((*(cdata.colid) == '"') || (*(cdata.colid) == '`'))
gda_sql_identifier_prepare_for_compare ((gchar*) cdata.colid);
/*g_print ("SEL param '%s' <=> column named '%s'\n", cdata.hid, cdata.colid);*/
-
+
GSList *ins_list;
cdata.hid = NULL;
for (ins_list = ins_values->holders; ins_list; ins_list = ins_list->next) {
@@ -3285,13 +3285,13 @@ static gboolean
compute_insert_select_params_mapping_foreach_func (GdaSqlAnyPart *part, CorrespData *data,
G_GNUC_UNUSED GError **error)
{
- if (part->type != GDA_SQL_ANY_SQL_OPERATION)
+ if (part->type != GDA_SQL_ANY_SQL_OPERATION)
return TRUE;
GdaSqlOperation *op = (GdaSqlOperation*) part;
if (op->operator_type != GDA_SQL_OPERATOR_TYPE_EQ)
return TRUE;
-
+
if (!op->operands || !op->operands->data || !op->operands->next || !op->operands->next->data ||
op->operands->next->next)
return TRUE;
@@ -3336,7 +3336,7 @@ set_column_properties_from_select_stmt (GdaDataSelect *model, GdaConnection *cnc
/* we only want a single target */
if (!select->from || !select->from->targets || select->from->targets->next)
goto out;
-
+
target = (GdaSqlSelectTarget *) select->from->targets->data;
if (!target || !target->table_name)
goto out;
@@ -3351,8 +3351,8 @@ set_column_properties_from_select_stmt (GdaDataSelect *model, GdaConnection *cnc
/* FIXME: also set some column attributes using gda_column_set_attribute() */
- for (fields = select->expr_list, columns = model->priv->sh->columns;
- fields && columns;
+ for (fields = select->expr_list, columns = model->priv->sh->columns;
+ fields && columns;
fields = fields->next) {
GdaSqlSelectField *selfield = (GdaSqlSelectField*) fields->data;
if (selfield->validity_meta_table_column) {
@@ -3368,9 +3368,9 @@ set_column_properties_from_select_stmt (GdaDataSelect *model, GdaConnection *cnc
}
columns = columns->next;
}
- else if (selfield->validity_meta_object &&
+ else if (selfield->validity_meta_object &&
(selfield->validity_meta_object->obj_type == GDA_META_DB_TABLE) &&
- selfield->expr && selfield->expr->value && !selfield->expr->param_spec &&
+ selfield->expr && selfield->expr->value && !selfield->expr->param_spec &&
(G_VALUE_TYPE (selfield->expr->value) == G_TYPE_STRING) &&
!strcmp (g_value_get_string (selfield->expr->value), "*")) {
/* expand all the fields */
@@ -3466,10 +3466,10 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
sizeof (GType) * model->prep_stmt->ncols);
types [model->prep_stmt->ncols] = G_TYPE_NONE;
}
- new_model = (GdaDataSelect*) gda_connection_statement_execute_select_full (model->priv->cnc, select,
- model->priv->sh->ext_params,
+ new_model = (GdaDataSelect*) gda_connection_statement_execute_select_full (model->priv->cnc, select,
+ model->priv->sh->ext_params,
model->priv->sh->usage_flags | GDA_STATEMENT_MODEL_ALLOW_NOPARAM,
- types,
+ types,
error);
g_free (types);
if (!new_model) {
@@ -3502,10 +3502,10 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
memcpy (copy, (gint8*) new_model + offset, size); /* Flawfinder: ignore */
memcpy ((gint8*) new_model + offset, (gint8*) model + offset, size); /* Flawfinder: ignore */
memcpy ((gint8*) model + offset, copy, size); /* Flawfinder: ignore */
-
+
/* we need to keep some data from the old model */
GdaDataSelectInternals *mi;
-
+
model->priv->sh->reset_with_ext_params_change = old_model->priv->sh->reset_with_ext_params_change;
model->priv->sh->notify_changes = old_model->priv->sh->notify_changes;
mi = old_model->priv->sh->modif_internals;
@@ -3531,13 +3531,13 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
l1 = l1->next, l2 = l2->next) {
if ((gda_column_get_g_type ((GdaColumn*) l1->data) == GDA_TYPE_NULL) &&
(gda_column_get_g_type ((GdaColumn*) l2->data) != GDA_TYPE_NULL))
- gda_column_set_g_type ((GdaColumn*) l1->data,
+ gda_column_set_g_type ((GdaColumn*) l1->data,
gda_column_get_g_type ((GdaColumn*) l2->data));
}
g_object_unref (old_model);
- /* copy all the param's holders' values from model->priv->sh->ext_params to
+ /* copy all the param's holders' values from model->priv->sh->ext_params to
to model->priv->sh->modif_internals->exec_set */
GSList *list;
if (model->priv->sh->ext_params) {
@@ -3547,7 +3547,7 @@ gda_data_select_rerun (GdaDataSelect *model, GError **error)
gda_holder_get_id (list->data));
if (h) {
GError *lerror = NULL;
- if (!gda_holder_is_valid (GDA_HOLDER (list->data)))
+ if (!gda_holder_is_valid (GDA_HOLDER (list->data)))
gda_holder_set_value (h, gda_holder_get_value (GDA_HOLDER (list->data)), NULL);
else if (! gda_holder_set_value (h, gda_holder_get_value (GDA_HOLDER (list->data)),
&lerror)) {
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 4e906e5..00704ed 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -111,14 +111,14 @@ typedef struct {
/* data access statements */
GdaStatement *current_all;
GdaStatement *delete_all;
-
+
GdaStatement *insert;
GdaStatement *update;
GdaStatement *delete;
-
+
/* a single #GdaSet for all the statements above */
GdaSet *params;
-
+
/* PK fields index */
gint *pk_cols_array;
gint pk_cols_nb;
@@ -145,13 +145,13 @@ typedef struct {
} ViewInfo;
static void view_info_free_contents (ViewInfo *info);
-/*
+/*
* Struture to hold information about each object
* which can be created in the internal GdaMetaStore's connection.
* It is available for tables, views, triggers, ...
*/
typedef struct {
- GdaMetaStore *store; /* if not NULL, the store in which this db object is,
+ GdaMetaStore *store; /* if not NULL, the store in which this db object is,
* or %NULL if it's a class db object */
GdaServerOperationType obj_type;
gchar *obj_name; /* may be %NULL */
@@ -182,7 +182,7 @@ typedef struct {
DbObject *table_info;
DbObject *depend_on;
- gint cols_nb;
+ gint cols_nb;
gint *fk_cols_array; /* FK fields index */
gchar **fk_names_array; /* FK fields names */
gint *ref_pk_cols_array; /* Ref PK fields index */
@@ -210,7 +210,7 @@ struct _GdaMetaStoreClassPrivate {
GSList *db_objects; /* list of DbObject structures */
GHashTable *db_objects_hash; /* key = table name, value = a DbObject structure */
GHashTable *table_cond_info_hash; /* key = string composed of the column names of
- * the parameters separated by a period,
+ * the parameters separated by a period,
* value = a TableConditionInfo structure */
GHashTable *provider_specifics; /* key = a ProviderSpecificKey , value = a ProviderSpecificValue */
};
@@ -289,7 +289,7 @@ GQuark gda_meta_store_error_quark (void) {
GType
gda_meta_store_get_type (void) {
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
sizeof (GdaMetaStoreClass),
@@ -303,7 +303,7 @@ gda_meta_store_get_type (void) {
(GInstanceInitFunc) gda_meta_store_init,
0
};
-
+
g_static_rec_mutex_lock (&init_mutex);
if (type == 0)
type = g_type_register_static (G_TYPE_OBJECT, "GdaMetaStore", &info, 0);
@@ -325,7 +325,7 @@ static guint
ProviderSpecific_hash (gconstpointer key)
{
ProviderSpecificKey *pkey = (ProviderSpecificKey*) key;
- return g_str_hash (pkey->path) + g_str_hash (pkey->prov) +
+ return g_str_hash (pkey->path) + g_str_hash (pkey->prov) +
(pkey->expr ? g_str_hash (pkey->expr) : 0);
}
@@ -367,19 +367,19 @@ m_suggest_update (G_GNUC_UNUSED GdaMetaStore *store, G_GNUC_UNUSED GdaMetaContex
}
static void
-gda_meta_store_class_init (GdaMetaStoreClass *klass)
+gda_meta_store_class_init (GdaMetaStoreClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_static_rec_mutex_lock (&init_mutex);
parent_class = g_type_class_peek_parent (klass);
-
+
/**
* GdaMetaStore::suggest-update
* @store: the #GdaMetaStore instance that emitted the signal
* @suggest: the suggested update, as a #GdaMetaContext structure
*
- * This signal is emitted when the contents of a table should be updated (data to update or insert only;
+ * This signal is emitted when the contents of a table should be updated (data to update or insert only;
* deleting data is done automatically). This signal is used for internal purposes by the #GdaConnection
* object.
*
@@ -423,11 +423,11 @@ gda_meta_store_class_init (GdaMetaStoreClass *klass)
G_STRUCT_OFFSET (GdaMetaStoreClass, meta_reset),
NULL, NULL,
_gda_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
+
klass->suggest_update = m_suggest_update;
klass->meta_changed = NULL;
klass->meta_reset = NULL;
-
+
/* Properties */
object_class->set_property = gda_meta_store_set_property;
object_class->get_property = gda_meta_store_get_property;
@@ -443,11 +443,11 @@ gda_meta_store_class_init (GdaMetaStoreClass *klass)
g_object_class_install_property (object_class, PROP_SCHEMA,
g_param_spec_string ("schema", NULL, _ ("Schema in which the database objects will be created"), NULL,
(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
-
+
object_class->constructor = gda_meta_store_constructor;
object_class->dispose = gda_meta_store_dispose;
object_class->finalize = gda_meta_store_finalize;
-
+
/* Class private data */
klass->cpriv = g_new0 (GdaMetaStoreClassPrivate, 1);
klass->cpriv->prep_stmts = g_new0 (GdaStatement *, STMT_LAST);
@@ -458,19 +458,19 @@ gda_meta_store_class_init (GdaMetaStoreClass *klass)
klass->cpriv->table_cond_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
klass->cpriv->prep_stmts[STMT_SET_VERSION] =
- compute_prepared_stmt (klass->cpriv->parser,
+ compute_prepared_stmt (klass->cpriv->parser,
"INSERT INTO _attributes (att_name, att_value) VALUES ('_schema_version', ##version::string)");
klass->cpriv->prep_stmts[STMT_UPD_VERSION] =
- compute_prepared_stmt (klass->cpriv->parser,
+ compute_prepared_stmt (klass->cpriv->parser,
"UPDATE _attributes SET att_value = ##version::string WHERE att_name = '_schema_version'");
klass->cpriv->prep_stmts[STMT_GET_VERSION] =
- compute_prepared_stmt (klass->cpriv->parser,
+ compute_prepared_stmt (klass->cpriv->parser,
"SELECT att_value FROM _attributes WHERE att_name='_schema_version'");
klass->cpriv->prep_stmts[STMT_DEL_ATT_VALUE] =
- compute_prepared_stmt (klass->cpriv->parser,
+ compute_prepared_stmt (klass->cpriv->parser,
"DELETE FROM _attributes WHERE att_name = ##name::string");
klass->cpriv->prep_stmts[STMT_SET_ATT_VALUE] =
- compute_prepared_stmt (klass->cpriv->parser,
+ compute_prepared_stmt (klass->cpriv->parser,
"INSERT INTO _attributes VALUES (##name::string, ##value::string::null)");
klass->cpriv->prep_stmts[STMT_ADD_DECLARE_FK] =
compute_prepared_stmt (klass->cpriv->parser,
@@ -524,7 +524,7 @@ gda_meta_store_class_init (GdaMetaStoreClass *klass)
static void
-gda_meta_store_init (GdaMetaStore *store)
+gda_meta_store_init (GdaMetaStore *store)
{
store->priv = g_new0 (GdaMetaStorePrivate, 1);
store->priv->cnc = NULL;
@@ -546,20 +546,20 @@ gda_meta_store_init (GdaMetaStore *store)
store->priv->max_extract_stmt = 10;
store->priv->current_extract_stmt = 0;
store->priv->extract_stmt_hash = NULL;
-
+
store->priv->mutex = gda_mutex_new ();
}
static GObject *
gda_meta_store_constructor (GType type,
guint n_construct_properties,
- GObjectConstructParam *construct_properties)
+ GObjectConstructParam *construct_properties)
{
GObject *object;
guint i;
GdaMetaStore *store;
gboolean been_specified = FALSE;
-
+
g_static_rec_mutex_lock (&init_mutex);
object = G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_properties,
@@ -576,11 +576,11 @@ gda_meta_store_constructor (GType type,
}
}
store = (GdaMetaStore *) object;
-
+
if (!store->priv->cnc && !been_specified)
/* in memory DB */
g_object_set (object, "cnc-string", "SQLite://DB_DIR=.;DB_NAME=__gda_tmp", NULL);
-
+
if (store->priv->cnc)
store->priv->schema_ok = initialize_cnc_struct (store, &(store->priv->init_error));
@@ -599,11 +599,11 @@ gda_meta_store_constructor (GType type,
if (!store->priv->schema) {
/* uses all the klass->cpriv->db_objects AS IS in store->priv->p_db_objects */
store->priv->p_db_objects = g_slist_copy (klass->cpriv->db_objects);
- for (list = store->priv->p_db_objects; list; list = list->next)
+ for (list = store->priv->p_db_objects; list; list = list->next)
g_hash_table_insert (store->priv->p_db_objects_hash, DB_OBJECT (list->data)->obj_name,
list->data);
}
- else
+ else
create_db_objects (klass, store);
}
g_static_rec_mutex_unlock (&init_mutex);
@@ -621,14 +621,14 @@ gda_meta_store_constructor (GType type,
* Returns: (transfer full): the newly created object, or %NULL if an error occurred
*/
GdaMetaStore *
-gda_meta_store_new_with_file (const gchar *file_name)
+gda_meta_store_new_with_file (const gchar *file_name)
{
gchar *string;
gchar *base, *dir;
GdaMetaStore *store;
-
+
g_return_val_if_fail (file_name && *file_name, NULL);
-
+
base = g_path_get_basename (file_name);
dir = g_path_get_dirname (file_name);
if (g_str_has_suffix (base, ".db"))
@@ -650,7 +650,7 @@ gda_meta_store_new_with_file (const gchar *file_name)
* Returns: (transfer full): the newly created object, or %NULL if an error occurred
*/
GdaMetaStore *
-gda_meta_store_new (const gchar *cnc_string)
+gda_meta_store_new (const gchar *cnc_string)
{
GObject *obj;
GdaMetaStore *store;
@@ -675,17 +675,17 @@ gda_meta_store_new (const gchar *cnc_string)
store = NULL;
}
}
-
+
return store;
}
static void
-gda_meta_store_dispose (GObject *object)
+gda_meta_store_dispose (GObject *object)
{
GdaMetaStore *store;
-
+
g_return_if_fail (GDA_IS_META_STORE (object));
-
+
store = GDA_META_STORE (object);
if (store->priv) {
GSList *list;
@@ -695,7 +695,7 @@ gda_meta_store_dispose (GObject *object)
store->priv->extract_stmt_hash = NULL;
}
- if (store->priv->override_mode)
+ if (store->priv->override_mode)
_gda_meta_store_cancel_data_reset (store, NULL);
g_free (store->priv->catalog);
@@ -717,7 +717,7 @@ gda_meta_store_dispose (GObject *object)
gda_mutex_free (store->priv->mutex);
}
-
+
/* parent class */
parent_class->dispose (object);
}
@@ -726,10 +726,10 @@ static void
gda_meta_store_finalize (GObject *object)
{
GdaMetaStore *store;
-
+
g_return_if_fail (object != NULL);
g_return_if_fail (GDA_IS_META_STORE (object));
-
+
store = GDA_META_STORE (object);
if (store->priv) {
if (store->priv->init_error)
@@ -738,7 +738,7 @@ gda_meta_store_finalize (GObject *object)
g_free (store->priv);
store->priv = NULL;
}
-
+
/* parent class */
parent_class->finalize (object);
}
@@ -751,7 +751,7 @@ gda_meta_store_set_property (GObject *object,
{
GdaMetaStore *store;
const gchar *cnc_string;
-
+
store = GDA_META_STORE (object);
if (store->priv) {
switch (param_id) {
@@ -760,13 +760,13 @@ gda_meta_store_set_property (GObject *object,
cnc_string = g_value_get_string (value);
if (cnc_string) {
GdaConnection *cnc;
- cnc = gda_connection_open_from_string (NULL, cnc_string, NULL,
+ cnc = gda_connection_open_from_string (NULL, cnc_string, NULL,
GDA_CONNECTION_OPTIONS_NONE,
NULL);
if (!cnc) {
if (g_ascii_strcasecmp (cnc_string, "sqlite")) {
/* use _gda_config_sqlite_provider */
-
+
cnc = _gda_open_internal_sqlite_connection (cnc_string);
}
}
@@ -807,7 +807,7 @@ gda_meta_store_get_property (GObject *object,
{
GdaMetaStore *store;
store = GDA_META_STORE (object);
-
+
if (store->priv) {
switch (param_id) {
case PROP_CNC_STRING:
@@ -877,17 +877,17 @@ initialize_cnc_struct (GdaMetaStore *store, GError **error)
GdaMetaStoreClass *klass;
g_return_val_if_fail (GDA_IS_CONNECTION (store->priv->cnc), FALSE);
g_return_val_if_fail (gda_connection_is_opened (store->priv->cnc), FALSE);
-
+
if (handle_schema_version (store, &schema_present, error))
return TRUE;
if (schema_present)
return FALSE;
-
+
if (error && *error) {
g_error_free (*error);
*error = NULL;
}
-
+
/* assume schema not present => create it */
klass = (GdaMetaStoreClass *) G_OBJECT_GET_CLASS (store);
GSList *list;
@@ -934,11 +934,11 @@ initialize_cnc_struct (GdaMetaStore *store, GError **error)
}
-static GdaServerOperation *create_server_operation_for_table (GHashTable *specific_hash,
- GdaServerProvider *prov, GdaConnection *cnc,
+static GdaServerOperation *create_server_operation_for_table (GHashTable *specific_hash,
+ GdaServerProvider *prov, GdaConnection *cnc,
DbObject *dbobj, GError **error);
-static GdaServerOperation *create_server_operation_for_view (GHashTable *specific_hash,
- GdaServerProvider *prov, GdaConnection *cnc,
+static GdaServerOperation *create_server_operation_for_view (GHashTable *specific_hash,
+ GdaServerProvider *prov, GdaConnection *cnc,
DbObject *dbobj, GError **error);
static gboolean prepare_dbo_server_operation (GdaMetaStoreClass *klass, GdaMetaStore *store, GdaServerProvider *prov,
DbObject *dbo, GError **error);
@@ -952,7 +952,7 @@ prepare_server_operations (GdaMetaStore *store, GError **error)
for (objects = klass->cpriv->db_objects; objects; objects = objects->next) {
DbObject *dbo = DB_OBJECT (objects->data);
- if (! prepare_dbo_server_operation (klass, store, gda_connection_get_provider (store->priv->cnc),
+ if (! prepare_dbo_server_operation (klass, store, gda_connection_get_provider (store->priv->cnc),
dbo, error))
return FALSE;
}
@@ -968,10 +968,10 @@ prepare_dbo_server_operation (GdaMetaStoreClass *klass, GdaMetaStore *store, Gda
g_object_unref (dbo->create_op);
dbo->create_op = NULL;
}
-
+
switch (dbo->obj_type) {
case GDA_SERVER_OPERATION_CREATE_TABLE:
- dbo->create_op = create_server_operation_for_table (klass->cpriv->provider_specifics,
+ dbo->create_op = create_server_operation_for_table (klass->cpriv->provider_specifics,
prov, store->priv->cnc, dbo, error);
if (!dbo->create_op)
return FALSE;
@@ -999,14 +999,14 @@ provider_specific_match (GHashTable *specific_hash, GdaServerProvider *prov, con
spec.expr = (gchar *) expr;
val = g_hash_table_lookup (specific_hash, &spec);
/*g_print ("RULESEARCH %s, %s, %s => %s\n", spec.prov, spec.path, spec.expr, val ? val->repl : "-no rule found-");*/
- if (val)
+ if (val)
return val->repl;
else
return expr;
}
static GdaServerOperation *
-create_server_operation_for_table (GHashTable *specific_hash,
+create_server_operation_for_table (GHashTable *specific_hash,
GdaServerProvider *prov, GdaConnection *cnc, DbObject *dbobj, GError **error)
{
GdaServerOperation *op;
@@ -1118,12 +1118,12 @@ create_db_objects (GdaMetaStoreClass *klass, GdaMetaStore *store)
return;
}
}
-
+
node = xmlDocGetRootElement (doc);
- if (!node || strcmp ((gchar *) node->name, "schema"))
+ if (!node || strcmp ((gchar *) node->name, "schema"))
g_error ("Root node of file '%s' should be <schema>.", file);
g_free (file);
-
+
/* walk through the xmlDoc */
if (store)
store->priv->p_db_objects = NULL;
@@ -1157,7 +1157,7 @@ create_db_objects (GdaMetaStoreClass *klass, GdaMetaStore *store)
}
ProviderSpecificKey *key = g_new0 (ProviderSpecificKey, 1);
ProviderSpecificValue *val = g_new0 (ProviderSpecificValue, 1);
- key->prov = (gchar *) pname;
+ key->prov = (gchar *) pname;
pname_used = TRUE;
key->path = (gchar *) context;
key->expr = (gchar *) xmlGetProp (rnode, BAD_CAST "expr");
@@ -1177,7 +1177,7 @@ create_db_objects (GdaMetaStoreClass *klass, GdaMetaStore *store)
DbObject *dbo;
dbo = create_table_object (klass, store, node, error);
if (!dbo)
- g_error ("Information schema creation error: %s",
+ g_error ("Information schema creation error: %s",
lerror && lerror->message ? lerror->message : "No detail");
}
/* <view> tag for view creation */
@@ -1185,22 +1185,22 @@ create_db_objects (GdaMetaStoreClass *klass, GdaMetaStore *store)
DbObject *dbo;
dbo = create_view_object (klass, store, node, error);
if (!dbo)
- g_error ("Information schema creation error: %s",
+ g_error ("Information schema creation error: %s",
lerror && lerror->message ? lerror->message : "No detail");
}
}
xmlFreeDoc (doc);
-
+
if (store) {
store->priv->p_db_objects = reorder_db_objects (store->priv->p_db_objects, store->priv->p_db_objects_hash);
- if (!complement_db_objects (store->priv->p_db_objects, store->priv->p_db_objects_hash, error))
- g_error ("Information schema structure error: %s",
+ if (!complement_db_objects (store->priv->p_db_objects, store->priv->p_db_objects_hash, error))
+ g_error ("Information schema structure error: %s",
lerror && lerror->message ? lerror->message : "No detail");
}
else {
klass->cpriv->db_objects = reorder_db_objects (klass->cpriv->db_objects, klass->cpriv->db_objects_hash);
- if (!complement_db_objects (klass->cpriv->db_objects, klass->cpriv->db_objects_hash, error))
- g_error ("Information schema structure error: %s",
+ if (!complement_db_objects (klass->cpriv->db_objects, klass->cpriv->db_objects_hash, error))
+ g_error ("Information schema structure error: %s",
lerror && lerror->message ? lerror->message : "No detail");
}
}
@@ -1213,13 +1213,13 @@ column_name_to_index (TableInfo *tinfo, const gchar *column_name)
{
GSList *list;
gint i;
- for (i = 0, list = tinfo->columns; list; list = list->next, i++)
+ for (i = 0, list = tinfo->columns; list; list = list->next, i++)
if (!strcmp (TABLE_COLUMN (list->data)->column_name, column_name))
return i;
return -1;
}
-static void compute_view_dependencies (GdaMetaStoreClass *klass, GdaMetaStore *store,
+static void compute_view_dependencies (GdaMetaStoreClass *klass, GdaMetaStore *store,
DbObject *view_dbobj, GdaSqlStatement *sqlst);
static DbObject *
create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr node, GError **error)
@@ -1230,13 +1230,13 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
view_name = xmlGetProp (node, BAD_CAST "name");
if (!view_name) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Missing view name from <view> node"));
goto onerror;
}
/* determine object's complete name */
- if (store && store->priv->schema)
+ if (store && store->priv->schema)
complete_obj_name = g_strdup_printf ("%s.%s", store->priv->schema, (gchar *) view_name);
else
complete_obj_name = g_strdup ((gchar *) view_name);
@@ -1261,7 +1261,7 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
}
xmlFree (view_name);
dbobj->obj_type = GDA_SERVER_OPERATION_CREATE_VIEW;
-
+
/* walk through the view attributes */
xmlNodePtr cnode;
for (cnode = node->children; cnode; cnode = cnode->next) {
@@ -1270,11 +1270,11 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
continue;
def = xmlNodeGetContent (cnode);
if (!def) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Missing view definition from <view> node"));
goto onerror;
}
-
+
/* use a parser to analyze the view dependencies */
GdaStatement *stmt;
const gchar *remain;
@@ -1284,7 +1284,7 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
goto onerror;
}
if (remain) {
- g_set_error (error, 0, 0,
+ g_set_error (error, 0, 0,
_("View definition contains more than one statement (for view '%s')"),
complete_obj_name);
g_object_unref (stmt);
@@ -1293,7 +1293,7 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
}
VIEW_INFO (dbobj)->view_def = g_strdup ((gchar *) def);
xmlFree (def);
-
+
if ((gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_SELECT) ||
(gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_COMPOUND)) {
GdaSqlStatement *sqlst;
@@ -1301,30 +1301,30 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
compute_view_dependencies (klass, store, dbobj, sqlst);
gda_sql_statement_free (sqlst);
g_object_unref (stmt);
-
+
#ifdef GDA_DEBUG_NO
g_print ("View %s depends on: ", complete_obj_name);
GSList *list;
- for (list = dbobj->depend_list; list; list = list->next)
+ for (list = dbobj->depend_list; list; list = list->next)
g_print ("%s ", DB_OBJECT (list->data)->obj_name);
g_print ("\n");
#endif
}
else {
- g_set_error (error, 0, 0,
- _("View definition is not a selection statement (for view '%s')"),
+ g_set_error (error, 0, 0,
+ _("View definition is not a selection statement (for view '%s')"),
complete_obj_name);
g_object_unref (stmt);
- goto onerror;
+ goto onerror;
}
}
g_free (complete_obj_name);
return dbobj;
-
+
onerror:
g_free (complete_obj_name);
db_object_free (dbobj);
- return NULL;
+ return NULL;
}
static GdaSqlExpr *make_expr_EQUAL (GdaSqlAnyPart *parent, xmlChar *cname, xmlChar *type, GType ptype, gboolean nullok, gint index);
@@ -1338,13 +1338,13 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
table_name = xmlGetProp (node, BAD_CAST "name");
if (!table_name) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Missing table name from <table> node"));
return NULL;
}
/* determine object's complete name */
- if (store && store->priv->schema)
+ if (store && store->priv->schema)
complete_obj_name = g_strdup_printf ("%s.%s", store->priv->schema, (gchar *) table_name);
else
complete_obj_name = g_strdup ((gchar *) table_name);
@@ -1377,18 +1377,18 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
g_free (sql);
if (!TABLE_INFO (dbobj)->current_all) {
g_set_error (error, 0, 0,
- "Internal fatal error: could not create SELECT ALL statement (for table '%s')",
+ "Internal fatal error: could not create SELECT ALL statement (for table '%s')",
complete_obj_name);
goto onerror;
}
-
+
/* delete all */
sql = g_strdup_printf ("DELETE FROM %s", complete_obj_name);
TABLE_INFO (dbobj)->delete_all = compute_prepared_stmt (klass->cpriv->parser, sql);
g_free (sql);
if (!TABLE_INFO (dbobj)->delete_all) {
g_set_error (error, 0, 0,
- "Internal fatal error: could not create DELETE ALL statement (for table '%s')",
+ "Internal fatal error: could not create DELETE ALL statement (for table '%s')",
complete_obj_name);
goto onerror;
}
@@ -1400,7 +1400,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
GdaSqlStatementUpdate *ust;
GdaSqlStatement *sql_dst;
GdaSqlStatementDelete *dst;
-
+
sql_ist = gda_sql_statement_new (GDA_SQL_STATEMENT_INSERT);
ist = (GdaSqlStatementInsert*) sql_ist->contents;
g_assert (GDA_SQL_ANY_PART (ist)->type == GDA_SQL_ANY_STMT_INSERT);
@@ -1412,16 +1412,16 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
sql_dst = gda_sql_statement_new (GDA_SQL_STATEMENT_DELETE);
dst = (GdaSqlStatementDelete*) sql_dst->contents;
g_assert (GDA_SQL_ANY_PART (dst)->type == GDA_SQL_ANY_STMT_DELETE);
-
+
ist->table = gda_sql_table_new (GDA_SQL_ANY_PART (ist));
ist->table->table_name = g_strdup ((gchar *) complete_obj_name);
-
+
ust->table = gda_sql_table_new (GDA_SQL_ANY_PART (ust));
ust->table->table_name = g_strdup ((gchar *) complete_obj_name);
-
+
dst->table = gda_sql_table_new (GDA_SQL_ANY_PART (dst));
dst->table->table_name = g_strdup ((gchar *) complete_obj_name);
-
+
/* walk through the columns and Fkey nodes */
xmlNodePtr cnode;
gint colindex = 0;
@@ -1430,9 +1430,9 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
if (!strcmp ((gchar *) cnode->name, "column")) {
xmlChar *cname, *ctype, *xstr;
gboolean pkey = FALSE;
- gboolean nullok = FALSE;
+ gboolean nullok = FALSE;
gboolean autoinc = FALSE;
-
+
cname = xmlGetProp (cnode, BAD_CAST "name");
if (!cname)
g_error ("Missing column name (table=%s)", complete_obj_name);
@@ -1455,7 +1455,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
xmlFree (xstr);
}
ctype = xmlGetProp (cnode, BAD_CAST "type");
-
+
/* a field */
GdaSqlField *field;
field = gda_sql_field_new (GDA_SQL_ANY_PART (ist));
@@ -1548,7 +1548,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
if (colindex == 0)
TABLE_INFO (dbobj)->type_cols_array = g_new0 (GType, colindex + 2);
else
- TABLE_INFO (dbobj)->type_cols_array = g_renew (GType, TABLE_INFO (dbobj)->type_cols_array,
+ TABLE_INFO (dbobj)->type_cols_array = g_renew (GType, TABLE_INFO (dbobj)->type_cols_array,
colindex + 2);
TABLE_INFO (dbobj)->type_cols_array [colindex] = ptype;
TABLE_INFO (dbobj)->type_cols_array [colindex+1] = G_TYPE_NONE;
@@ -1557,7 +1557,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
TableColumn *tcol = NULL;
GSList *tlist;
for (tlist = TABLE_INFO (dbobj)->columns; tlist; tlist = tlist->next) {
- if (((TableColumn*) tlist->data)->column_name &&
+ if (((TableColumn*) tlist->data)->column_name &&
!strcmp (((TableColumn*) tlist->data)->column_name, (gchar*) cname)) {
tcol = (TableColumn*) tlist->data;
if ((tcol->gtype != ptype) ||
@@ -1568,7 +1568,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
(tcol->column_type && !ctype) ||
(tcol->column_type && strcmp (tcol->column_type, (gchar *) ctype))) {
g_set_error (error, 0, 0,
- _("Column '%s' already exists and has different characteristics"),
+ _("Column '%s' already exists and has different characteristics"),
tcol->column_name);
xmlFree (cname);
if (ctype)
@@ -1601,12 +1601,12 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
ref_table = xmlGetProp (cnode, BAD_CAST "ref_table");
if (!ref_table) {
- g_set_error (error, 0, 0,
- _("Missing foreign key's referenced table name (for table '%s')"),
+ g_set_error (error, 0, 0,
+ _("Missing foreign key's referenced table name (for table '%s')"),
complete_obj_name);
goto onerror;
}
-
+
/* referenced DbObject */
DbObject *ref_obj;
if (store)
@@ -1618,9 +1618,9 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
ref_obj->store = store;
ref_obj->obj_name = g_strdup ((gchar *) ref_table);
if (store) {
- store->priv->p_db_objects = g_slist_prepend (store->priv->p_db_objects,
+ store->priv->p_db_objects = g_slist_prepend (store->priv->p_db_objects,
ref_obj);
- g_hash_table_insert (store->priv->p_db_objects_hash, ref_obj->obj_name,
+ g_hash_table_insert (store->priv->p_db_objects_hash, ref_obj->obj_name,
ref_obj);
}
else {
@@ -1630,10 +1630,10 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
}
xmlFree (ref_table);
dbobj->depend_list = g_slist_append (dbobj->depend_list, ref_obj);
-
+
/* TableFKey structure */
TableFKey *tfk = g_new0 (TableFKey, 1);
-
+
tfk->table_info = dbobj;
tfk->depend_on = ref_obj;
@@ -1654,8 +1654,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
continue;
col = xmlGetProp (fnode, BAD_CAST "column");
if (!col) {
- g_set_error (error, 0, 0,
- _("Missing foreign key's column name (for table '%s')"),
+ g_set_error (error, 0, 0,
+ _("Missing foreign key's column name (for table '%s')"),
complete_obj_name);
table_fkey_free (tfk);
goto onerror;
@@ -1689,13 +1689,13 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
ist->values_list = g_slist_append (NULL, insert_values_list);
TABLE_INFO (dbobj)->insert = g_object_new (GDA_TYPE_STATEMENT, "structure", sql_ist, NULL);
gda_sql_statement_free (sql_ist);
-
+
TABLE_INFO (dbobj)->update = g_object_new (GDA_TYPE_STATEMENT, "structure", sql_ust, NULL);
gda_sql_statement_free (sql_ust);
-
+
TABLE_INFO (dbobj)->delete = g_object_new (GDA_TYPE_STATEMENT, "structure", sql_dst, NULL);
gda_sql_statement_free (sql_dst);
-
+
if (TABLE_INFO (dbobj)->pk_cols_nb == 0)
g_error ("Missing key fields identification (table=%s)", complete_obj_name);
@@ -1723,19 +1723,19 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
complete_obj_name);
gda_set_merge_with_set (TABLE_INFO (dbobj)->params, params);
g_object_unref (params);
-
+
if (!gda_statement_get_parameters (TABLE_INFO (dbobj)->delete, ¶ms, NULL))
g_error ("Internal fatal error: could not get DELETE statement's parameters (table=%s)",
complete_obj_name);
gda_set_merge_with_set (TABLE_INFO (dbobj)->params, params);
g_object_unref (params);
-
+
/* insert DbObject */
if (store)
g_hash_table_insert (store->priv->p_db_objects_hash, dbobj->obj_name, dbobj);
else
g_hash_table_insert (klass->cpriv->db_objects_hash, dbobj->obj_name, dbobj);
-
+
g_free (complete_obj_name);
return dbobj;
@@ -1747,7 +1747,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
static GdaSqlExpr *
-make_expr_AND (GdaSqlAnyPart *parent, GdaSqlExpr *current)
+make_expr_AND (GdaSqlAnyPart *parent, GdaSqlExpr *current)
{
GdaSqlExpr *expr;
expr = gda_sql_expr_new (parent);
@@ -1773,11 +1773,11 @@ make_expr_EQUAL (GdaSqlAnyPart *parent, xmlChar *cname, G_GNUC_UNUSED xmlChar *t
op = gda_sql_operation_new (GDA_SQL_ANY_PART (retexpr));
op->operator_type = GDA_SQL_OPERATOR_TYPE_EQ;
retexpr->cond = op;
-
+
expr = gda_sql_expr_new (GDA_SQL_ANY_PART (op));
g_value_set_string ((expr->value = gda_value_new (G_TYPE_STRING)), (gchar *) cname);
op->operands = g_slist_append (op->operands, expr);
-
+
pspec = g_new0 (GdaSqlParamSpec, 1);
pspec->name = g_strdup_printf ("-%d", index);
pspec->g_type = ptype;
@@ -1791,15 +1791,15 @@ make_expr_EQUAL (GdaSqlAnyPart *parent, xmlChar *cname, G_GNUC_UNUSED xmlChar *t
static void
-compute_view_dependencies (GdaMetaStoreClass *klass, GdaMetaStore *store,
- DbObject *view_dbobj, GdaSqlStatement *sqlst) {
+compute_view_dependencies (GdaMetaStoreClass *klass, GdaMetaStore *store,
+ DbObject *view_dbobj, GdaSqlStatement *sqlst) {
if (sqlst->stmt_type == GDA_SQL_STATEMENT_SELECT) {
GdaSqlStatementSelect *selst;
selst = (GdaSqlStatementSelect*) (sqlst->contents);
GSList *targets;
for (targets = selst->from->targets; targets; targets = targets->next) {
GdaSqlSelectTarget *t = (GdaSqlSelectTarget *) targets->data;
-
+
if (!t->table_name)
continue;
DbObject *ref_obj = NULL;
@@ -1813,9 +1813,9 @@ compute_view_dependencies (GdaMetaStoreClass *klass, GdaMetaStore *store,
ref_obj->store = store;
ref_obj->obj_name = g_strdup (t->table_name);
if (store) {
- store->priv->p_db_objects = g_slist_prepend (store->priv->p_db_objects,
+ store->priv->p_db_objects = g_slist_prepend (store->priv->p_db_objects,
ref_obj);
- g_hash_table_insert (store->priv->p_db_objects_hash, ref_obj->obj_name,
+ g_hash_table_insert (store->priv->p_db_objects_hash, ref_obj->obj_name,
ref_obj);
}
else {
@@ -1864,7 +1864,7 @@ build_pass (GSList *objects, GSList *ordered_list)
#ifdef GDA_DEBUG_NO
g_print (">> PASS\n");
- for (list = retlist; list; list = list->next)
+ for (list = retlist; list; list = list->next)
g_print ("--> %s\n", DB_OBJECT (list->data)->obj_name);
g_print ("<<\n");
#endif
@@ -1882,14 +1882,14 @@ reorder_db_objects (GSList *objects, G_GNUC_UNUSED GHashTable *hash)
GSList *pass_list;
GSList *ordered_list = NULL;
- for (pass_list = build_pass (objects, ordered_list); pass_list; pass_list = build_pass (objects, ordered_list))
+ for (pass_list = build_pass (objects, ordered_list); pass_list; pass_list = build_pass (objects, ordered_list))
ordered_list = g_slist_concat (ordered_list, pass_list);
#ifdef GDA_DEBUG_NO
GSList *list;
- for (list = ordered_list; list; list = list->next)
+ for (list = ordered_list; list; list = list->next)
g_print ("--> %s\n", ((DbObject*) list->data)->obj_name);
-#endif
+#endif
return ordered_list;
}
@@ -1935,7 +1935,7 @@ complement_db_objects (GSList *objects, G_GNUC_UNUSED GHashTable *hash, GError *
cond = g_string_new ("");
tcol = TABLE_COLUMN (g_slist_nth_data (info->columns, tfk->fk_cols_array[i]));
g_assert (tcol);
- g_string_append_printf (cond, "%s = ##%s::%s%s", tcol->column_name,
+ g_string_append_printf (cond, "%s = ##%s::%s%s", tcol->column_name,
tfk->fk_names_array[i],
tcol->column_type ? tcol->column_type : g_type_name (tcol->gtype),
tcol->nullok ? "::NULL" : "");
@@ -1946,11 +1946,11 @@ complement_db_objects (GSList *objects, G_GNUC_UNUSED GHashTable *hash, GError *
tfk->fk_fields_cond = cond->str;
g_string_free (cond, FALSE);
- /* fix TableInfo->reverse_fk_list,
+ /* fix TableInfo->reverse_fk_list,
* but we don't want the "_tables"-->"_views" reverse dependency */
if (strcmp (tfk->depend_on->obj_name, "_tables") ||
strcmp (tfk->table_info->obj_name, "_views"))
- TABLE_INFO (tfk->depend_on)->reverse_fk_list =
+ TABLE_INFO (tfk->depend_on)->reverse_fk_list =
g_slist_append (TABLE_INFO (tfk->depend_on)->reverse_fk_list, tfk);
}
}
@@ -2181,10 +2181,10 @@ handle_schema_version (GdaMetaStore *store, gboolean *schema_present, GError **e
{
GdaDataModel *model;
GdaMetaStoreClass *klass = (GdaMetaStoreClass *) G_OBJECT_GET_CLASS (store);
-
+
model = gda_connection_statement_execute_select_fullv (store->priv->cnc,
klass->cpriv->prep_stmts[STMT_GET_VERSION],
- NULL, GDA_STATEMENT_MODEL_RANDOM_ACCESS, NULL,
+ NULL, GDA_STATEMENT_MODEL_RANDOM_ACCESS, NULL,
0, G_TYPE_STRING, -1);
if (schema_present)
*schema_present = model ? TRUE : FALSE;
@@ -2196,7 +2196,7 @@ handle_schema_version (GdaMetaStore *store, gboolean *schema_present, GError **e
g_object_unref (model);
return FALSE;
}
-
+
version = gda_data_model_get_value_at (model, 0, 0, error);
if (!version)
return FALSE;
@@ -2223,7 +2223,7 @@ handle_schema_version (GdaMetaStore *store, gboolean *schema_present, GError **e
/* no downgrade to do */
break;
}
-
+
if (store->priv->version != atoi (CURRENT_SCHEMA_VERSION)) { /* Flawfinder: ignore */
/* it's an error */
g_object_unref (model);
@@ -2252,7 +2252,7 @@ gint
gda_meta_store_get_version (GdaMetaStore *store) {
g_return_val_if_fail (GDA_IS_META_STORE (store), 0);
g_return_val_if_fail (store->priv, 0);
-
+
return store->priv->version;
}
@@ -2273,7 +2273,7 @@ GdaConnection *
gda_meta_store_get_internal_connection (GdaMetaStore *store) {
g_return_val_if_fail (GDA_IS_META_STORE (store), 0);
g_return_val_if_fail (store->priv, 0);
-
+
return store->priv->cnc;
}
@@ -2298,7 +2298,7 @@ gda_meta_store_sql_identifier_quote (const gchar *id, GdaConnection *cnc)
{
GdaConnectionOptions cncoptions;
g_return_val_if_fail (!cnc || GDA_IS_CONNECTION (cnc), NULL);
-
+
g_object_get (G_OBJECT (cnc), "options", &cncoptions, NULL);
return gda_sql_identifier_quote (id, cnc, NULL, TRUE,
cncoptions & GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE);
@@ -2335,7 +2335,7 @@ gda_meta_store_extract (GdaMetaStore *store, const gchar *select_sql, GError **e
if (store->priv->init_error) {
g_propagate_error (error, g_error_copy (store->priv->init_error));
return NULL;
- }
+ }
gda_mutex_lock (store->priv->mutex);
@@ -2345,7 +2345,7 @@ gda_meta_store_extract (GdaMetaStore *store, const gchar *select_sql, GError **e
/* statement creation */
if (store->priv->extract_stmt_hash)
stmt = g_hash_table_lookup (store->priv->extract_stmt_hash, select_sql);
- if (stmt)
+ if (stmt)
g_object_ref (stmt);
else {
GdaMetaStoreClass *klass;
@@ -2370,7 +2370,7 @@ gda_meta_store_extract (GdaMetaStore *store, const gchar *select_sql, GError **e
store->priv->current_extract_stmt++;
}
}
-
+
/* parameters */
if (!gda_statement_get_parameters (stmt, ¶ms, error)) {
g_object_unref (stmt);
@@ -2405,7 +2405,7 @@ gda_meta_store_extract (GdaMetaStore *store, const gchar *select_sql, GError **e
for (list = params->holders; list; list = list->next) {
if (!g_slist_find (params_set, list->data))
- g_warning (_("No value set for parameter '%s'"),
+ g_warning (_("No value set for parameter '%s'"),
gda_holder_get_id (GDA_HOLDER (list->data)));
}
g_slist_free (params_set);
@@ -2425,7 +2425,7 @@ gda_meta_store_extract (GdaMetaStore *store, const gchar *select_sql, GError **e
* gda_meta_store_extract_v:
* @store: a #GdaMetaStore object
* @select_sql: a SELECT statement
- * @vars: (element-type gchar GObject.Value) (allow-none): a hash table with all variables names as keys and GValue* as
+ * @vars: (element-type gchar GObject.Value) (allow-none): a hash table with all variables names as keys and GValue* as
* value, representing values for all the variables mentioned in @select_sql. If there is no variable then this part can be
* omitted.
* @error: a place to store errors, or %NULL
@@ -2457,7 +2457,7 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
if (store->priv->init_error) {
g_propagate_error (error, g_error_copy (store->priv->init_error));
return NULL;
- }
+ }
gda_mutex_lock (store->priv->mutex);
@@ -2467,7 +2467,7 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
/* statement creation */
if (store->priv->extract_stmt_hash)
stmt = g_hash_table_lookup (store->priv->extract_stmt_hash, select_sql);
- if (stmt)
+ if (stmt)
g_object_ref (stmt);
else {
GdaMetaStoreClass *klass;
@@ -2492,7 +2492,7 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
store->priv->current_extract_stmt++;
}
}
-
+
/* parameters */
if (!gda_statement_get_parameters (stmt, ¶ms, error)) {
g_object_unref (stmt);
@@ -2505,7 +2505,7 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
GValue *value;
GHashTableIter iter;
g_hash_table_iter_init (&iter, vars);
- while (g_hash_table_iter_next (&iter, &pname, &value)) {
+ while (g_hash_table_iter_next (&iter, (gpointer*)&pname, (gpointer*)&value)) {
GdaHolder *h;
h = gda_set_get_holder (params, pname);
if (!h)
@@ -2520,10 +2520,10 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
params_set = g_slist_prepend (params_set, h);
}
}
-
+
for (list = params->holders; list; list = list->next) {
if (!g_slist_find (params_set, list->data))
- g_warning (_("No value set for parameter '%s'"),
+ g_warning (_("No value set for parameter '%s'"),
gda_holder_get_id (GDA_HOLDER (list->data)));
}
g_slist_free (params_set);
@@ -2537,11 +2537,11 @@ gda_meta_store_extract_v (GdaMetaStore *store, const gchar *select_sql, GHashTab
gda_mutex_unlock (store->priv->mutex);
return model;
-}
+}
-static gboolean prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos,
+static gboolean prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos,
TableConditionInfo **out_cond_infos, gboolean *out_with_key,
- const gchar *table_name, const gchar *condition, GError **error,
+ const gchar *table_name, const gchar *condition, GError **error,
gint nvalues, const gchar **value_names, const GValue **values);
static gint find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint row,
gint *pk_cols, gint pk_cols_nb, gboolean *out_has_changed, GError **error);
@@ -2570,8 +2570,8 @@ static gint find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint r
* Returns: TRUE if no error occurred
*/
gboolean
-gda_meta_store_modify (GdaMetaStore *store, const gchar *table_name,
- GdaDataModel *new_data, const gchar *condition, GError **error, ...)
+gda_meta_store_modify (GdaMetaStore *store, const gchar *table_name,
+ GdaDataModel *new_data, const gchar *condition, GError **error, ...)
{
va_list ap;
gboolean retval;
@@ -2605,7 +2605,7 @@ gda_meta_store_modify (GdaMetaStore *store, const gchar *table_name,
values [n_values] = v;
}
va_end (ap);
- retval = gda_meta_store_modify_v (store, table_name, new_data, condition,
+ retval = gda_meta_store_modify_v (store, table_name, new_data, condition,
n_values, value_names, values, error);
g_free (value_names);
g_free (values);
@@ -2626,7 +2626,7 @@ gda_meta_store_modify (GdaMetaStore *store, const gchar *table_name,
* Returns: TRUE if no error occurred
*/
gboolean
-gda_meta_store_modify_with_context (GdaMetaStore *store, GdaMetaContext *context,
+gda_meta_store_modify_with_context (GdaMetaStore *store, GdaMetaContext *context,
GdaDataModel *new_data, GError **error)
{
GString *cond = NULL;
@@ -2640,8 +2640,8 @@ gda_meta_store_modify_with_context (GdaMetaStore *store, GdaMetaContext *context
cond = g_string_new ("");
else
g_string_append (cond, " AND ");
- g_string_append_printf (cond, "%s = ##%s::%s", context->column_names [i],
- context->column_names [i],
+ g_string_append_printf (cond, "%s = ##%s::%s", context->column_names [i],
+ context->column_names [i],
g_type_name (G_VALUE_TYPE (context->column_values [i])));
}
@@ -2651,7 +2651,7 @@ gda_meta_store_modify_with_context (GdaMetaStore *store, GdaMetaContext *context
}
retval = gda_meta_store_modify_v (store, context->table_name, new_data, cond ? cond->str : NULL,
- context->size,
+ context->size,
(const gchar **) context->column_names,
(const GValue **)context->column_values, error);
if (cond)
@@ -2682,8 +2682,8 @@ gda_meta_store_modify_with_context (GdaMetaStore *store, GdaMetaContext *context
* Rename to: gda_meta_store_modify
*/
gboolean
-gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
- GdaDataModel *new_data, const gchar *condition,
+gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
+ GdaDataModel *new_data, const gchar *condition,
gint nvalues, const gchar **value_names, const GValue **values,
GError **error)
{
@@ -2699,17 +2699,17 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_return_val_if_fail (store->priv->cnc, FALSE);
g_return_val_if_fail (gda_connection_is_opened (store->priv->cnc), FALSE);
g_return_val_if_fail (!new_data || GDA_IS_DATA_MODEL (new_data), FALSE);
-
+
gda_mutex_lock (store->priv->mutex);
/* get the correct TableInfo */
- prep = prepare_tables_infos (store, &schema_set, &custom_set, &with_cond, table_name,
+ prep = prepare_tables_infos (store, &schema_set, &custom_set, &with_cond, table_name,
condition, error, nvalues, value_names, values);
if (!prep) {
gda_mutex_unlock (store->priv->mutex);
return FALSE;
}
-
+
GdaDataModel *current = NULL;
gboolean *rows_to_del = NULL;
gint current_n_rows = 0, i;
@@ -2718,10 +2718,10 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
if (! store->priv->override_mode) {
/* get current data */
current = gda_connection_statement_execute_select_full (store->priv->cnc,
- with_cond ? custom_set->select :
+ with_cond ? custom_set->select :
schema_set->current_all,
- with_cond ? custom_set->params : NULL,
- GDA_STATEMENT_MODEL_RANDOM_ACCESS,
+ with_cond ? custom_set->params : NULL,
+ GDA_STATEMENT_MODEL_RANDOM_ACCESS,
schema_set->type_cols_array, error);
if (!current) {
gda_mutex_unlock (store->priv->mutex);
@@ -2735,7 +2735,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("CURRENT:\n");
gda_data_model_dump (current, stdout);
#endif
-
+
/* start a transaction if possible */
if (! gda_connection_get_transaction_status (store->priv->cnc)) {
started_transaction = gda_connection_begin_transaction (store->priv->cnc, NULL,
@@ -2749,7 +2749,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
else {
/* remove everything from table */
if (gda_connection_statement_execute_non_select (store->priv->cnc,
- schema_set->delete_all, NULL,
+ schema_set->delete_all, NULL,
NULL, error) == -1) {
gda_mutex_unlock (store->priv->mutex);
return FALSE;
@@ -2779,7 +2779,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("wrapped as:\n");
gda_data_model_dump (wrapped_data, stdout);
}
-#endif
+#endif
for (i = 0; i < new_n_rows; i++) {
/* find existing row if necessary */
@@ -2790,11 +2790,11 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
if (!store->priv->override_mode) {
if (current) {
erow = find_row_in_model (current, wrapped_data, i,
- schema_set->pk_cols_array,
- schema_set->pk_cols_nb, &has_changed,
+ schema_set->pk_cols_array,
+ schema_set->pk_cols_nb, &has_changed,
error);
#ifdef DEBUG_STORE_MODIFY
- g_print ("FIND row %d(/%d) returned row %d (%s)\n", i, new_n_rows - 1, erow,
+ g_print ("FIND row %d(/%d) returned row %d (%s)\n", i, new_n_rows - 1, erow,
has_changed ? "CHANGED" : "unchanged");
#endif
}
@@ -2803,7 +2803,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_object_unref (wrapped_data);
goto out;
}
-
+
/* prepare change information */
change = g_new0 (GdaMetaStoreChange, 1);
change->c_type = -1;
@@ -2812,7 +2812,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_free, (GDestroyNotify) gda_value_free);
all_changes = g_slist_append (all_changes, change);
}
-
+
/* bind parameters for new values */
gint j;
for (j = 0; j < new_n_cols; j++) {
@@ -2828,7 +2828,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_object_unref (wrapped_data);
goto out;
}
-
+
if (! gda_holder_set_value (h, value, error)) {
g_free (pid);
retval = FALSE;
@@ -2842,7 +2842,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
}
g_free (pid);
}
-
+
/* execute INSERT or UPDATE statements */
if (erow == -1) {
/* INSERT: bind INSERT parameters */
@@ -2850,13 +2850,13 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("Insert new row %d into table %s\n", i, table_name);
#endif
if (gda_connection_statement_execute_non_select (store->priv->cnc,
- schema_set->insert, schema_set->params,
+ schema_set->insert, schema_set->params,
NULL, error) == -1) {
retval = FALSE;
g_object_unref (wrapped_data);
goto out;
}
- if (change)
+ if (change)
change->c_type = GDA_META_STORE_ADD;
}
else if (has_changed) {
@@ -2892,17 +2892,17 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("Update for row %d (old row was %d) into table %s\n", i, erow, table_name);
#endif
if (gda_connection_statement_execute_non_select (store->priv->cnc,
- schema_set->update, schema_set->params,
+ schema_set->update, schema_set->params,
NULL, error) == -1) {
retval = FALSE;
g_object_unref (wrapped_data);
goto out;
}
- if (change)
+ if (change)
change->c_type = GDA_META_STORE_MODIFY;
rows_to_del [erow] = FALSE;
}
- else if (rows_to_del)
+ else if (rows_to_del)
/* row has not changed */
rows_to_del [erow] = FALSE;
@@ -2913,14 +2913,14 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
TableFKey *tfk = (TableFKey*) list->data;
gint k;
GdaMetaContext context;
-
+
context.table_name = tfk->table_info->obj_name;
context.size = tfk->cols_nb;
context.column_names = tfk->fk_names_array;
context.column_values = g_new (GValue *, context.size);
-
+
for (k = 0; k < tfk->cols_nb; k++) {
- context.column_values [k] = (GValue*) gda_data_model_get_value_at (new_data,
+ context.column_values [k] = (GValue*) gda_data_model_get_value_at (new_data,
tfk->ref_pk_cols_array[k], i, error);
if (!context.column_values [k]) {
g_free (context.column_values);
@@ -2940,12 +2940,12 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("\n");
#endif
GError *suggest_reports_error = NULL;
- g_signal_emit (store, gda_meta_store_signals[SUGGEST_UPDATE], 0, &context,
+ g_signal_emit (store, gda_meta_store_signals[SUGGEST_UPDATE], 0, &context,
&suggest_reports_error);
g_free (context.column_values);
if (suggest_reports_error) {
g_print ("SUGGEST META UPDATE Returned FALSE: %s\n",
- suggest_reports_error && suggest_reports_error->message ?
+ suggest_reports_error && suggest_reports_error->message ?
suggest_reports_error->message : "???");
retval = FALSE;
if (error && !(*error))
@@ -2960,7 +2960,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
}
g_object_unref (wrapped_data);
}
-
+
if (!store->priv->override_mode) {
/* treat rows to delete */
for (i = 0; i < current_n_rows; i++) {
@@ -2973,7 +2973,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
change->keys = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) gda_value_free);
all_changes = g_slist_append (all_changes, change);
-
+
/* DELETE */
gint j;
for (j = 0; j < current_n_cols; j++) {
@@ -3009,7 +3009,7 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
TableFKey *tfk = (TableFKey*) list->data;
const GValue **values;
gint k;
-
+
/*g_print ("Also remove data from table '%s'...\n", tfk->table_info->obj_name);*/
values = g_new (const GValue *, tfk->cols_nb);
for (k = 0; k < tfk->cols_nb; k++) {
@@ -3029,9 +3029,9 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
}
g_free (values);
}
-
+
if (gda_connection_statement_execute_non_select (store->priv->cnc,
- schema_set->delete, schema_set->params,
+ schema_set->delete, schema_set->params,
NULL, error) == -1) {
retval = FALSE;
goto out;
@@ -3045,10 +3045,10 @@ gda_meta_store_modify_v (GdaMetaStore *store, const gchar *table_name,
g_print ("------- COMMIT\n");
#endif
}
- if (retval && all_changes)
+ if (retval && all_changes)
g_signal_emit (store, gda_meta_store_signals[META_CHANGED], 0, all_changes);
}
-
+
out:
if (all_changes) {
g_slist_foreach (all_changes, (GFunc) gda_meta_store_change_free, NULL);
@@ -3073,18 +3073,18 @@ out:
* Find the row in @find_in from the values of @data at line @row, and columns pointed by
* the values of @pk_cols
*
- * Returns:
- * -2 on error,
- * -1 if not found,
+ * Returns:
+ * -2 on error,
+ * -1 if not found,
* >=0 if found (if changes need to be made, then @out_has_changed is set to TRUE).
*/
static gint
-find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint row, gint *pk_cols, gint pk_cols_nb,
+find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint row, gint *pk_cols, gint pk_cols_nb,
gboolean *out_has_changed, GError **error)
{
gint i, erow;
GSList *values = NULL;
-
+
for (i = 0; i < pk_cols_nb; i++) {
const GValue *cvalue;
cvalue = gda_data_model_get_value_at (data, pk_cols[i], row, error);
@@ -3094,7 +3094,7 @@ find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint row, gint *pk
}
erow = gda_data_model_get_row_from_values (find_in, values, pk_cols);
g_slist_free (values);
-
+
if (erow >= 0) {
gint ncols;
ncols = gda_data_model_get_n_columns (find_in);
@@ -3121,25 +3121,25 @@ find_row_in_model (GdaDataModel *find_in, GdaDataModel *data, gint row, gint *pk
*out_has_changed = changed;
}
}
-
+
return erow;
}
static TableConditionInfo *create_custom_set (GdaMetaStore *store, const gchar *table_name, const gchar *condition, GError **error);
static gboolean
-prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos, TableConditionInfo **out_cond_infos,
+prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos, TableConditionInfo **out_cond_infos,
gboolean *out_with_key,
- const gchar *table_name, const gchar *condition, GError **error,
- gint nvalues, const gchar **value_names, const GValue **values)
+ const gchar *table_name, const gchar *condition, GError **error,
+ gint nvalues, const gchar **value_names, const GValue **values)
{
GdaMetaStoreClass *klass = (GdaMetaStoreClass *) G_OBJECT_GET_CLASS (store);
-
+
g_assert (out_table_infos);
g_assert (out_cond_infos);
g_assert (out_with_key);
*out_with_key = FALSE;
-
+
/* compute *out_cond_infos */
*out_cond_infos= NULL;
if (condition) {
@@ -3156,7 +3156,7 @@ prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos, TableCon
else
g_free (key);
}
-
+
/* fetch or create *out_table_infos */
DbObject *dbobj = g_hash_table_lookup (klass->cpriv->db_objects_hash, table_name);
if (!dbobj) {
@@ -3171,7 +3171,7 @@ prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos, TableCon
for (i = 0; i < nvalues; i++) {
GdaHolder *h;
GValue *wvalue;
-
+
wvalue = _gda_data_meta_wrapper_compute_value (values [i], store->priv->ident_style,
store->priv->reserved_keyword_func);
h = gda_set_get_holder ((*out_cond_infos)->params, value_names [i]);
@@ -3185,7 +3185,7 @@ prepare_tables_infos (GdaMetaStore *store, TableInfo **out_table_infos, TableCon
if (wvalue)
gda_value_free (wvalue);
}
-
+
return TRUE;
}
@@ -3195,10 +3195,10 @@ create_custom_set (GdaMetaStore *store, const gchar *table_name, const gchar *co
GdaMetaStoreClass *klass = (GdaMetaStoreClass *) G_OBJECT_GET_CLASS (store);
gchar *sql;
TableConditionInfo *set;
-
+
g_assert (condition);
set = g_new0 (TableConditionInfo, 1);
-
+
/* SELECT */
sql = g_strdup_printf ("SELECT * FROM %s WHERE %s", table_name, condition);
set->select = compute_prepared_stmt (klass->cpriv->parser, sql);
@@ -3209,11 +3209,11 @@ create_custom_set (GdaMetaStore *store, const gchar *table_name, const gchar *co
"%s", _("Could not create SELECT statement"));
goto out;
}
-
+
/* parameters (are the same for both statements */
if (! gda_statement_get_parameters (set->select, &(set->params), error))
goto out;
-
+
/* DELETE */
sql = g_strdup_printf ("DELETE FROM %s WHERE %s", table_name, condition);
set->delete = compute_prepared_stmt (klass->cpriv->parser, sql);
@@ -3225,7 +3225,7 @@ create_custom_set (GdaMetaStore *store, const gchar *table_name, const gchar *co
goto out;
}
return set;
-
+
out:
if (set->select)
g_object_unref (set->select);
@@ -3306,7 +3306,7 @@ _gda_meta_store_cancel_data_reset (GdaMetaStore *store, GError **error)
gda_mutex_unlock (store->priv->mutex);
return TRUE;
}
-
+
store->priv->override_mode = FALSE;
retval = gda_connection_rollback_transaction (store->priv->cnc, NULL, error);
gda_mutex_unlock (store->priv->mutex);
@@ -3338,7 +3338,7 @@ _gda_meta_store_finish_data_reset (GdaMetaStore *store, GError **error)
return TRUE;
}
- store->priv->override_mode = FALSE;
+ store->priv->override_mode = FALSE;
if (!gda_connection_commit_transaction (store->priv->cnc, NULL, error)) {
gda_mutex_unlock (store->priv->mutex);
return FALSE;
@@ -3361,7 +3361,7 @@ _gda_meta_store_finish_data_reset (GdaMetaStore *store, GError **error)
static void
gda_meta_store_change_free (GdaMetaStoreChange *change) {
if (!change) return;
-
+
g_free (change->table_name);
g_hash_table_destroy (change->keys);
g_free (change);
@@ -3371,7 +3371,7 @@ gda_meta_store_change_free (GdaMetaStoreChange *change) {
* gda_meta_store_create_modify_data_model:
* @store: a #GdaMetaStore object
* @table_name: the name of a table present in @store
- *
+ *
* Creates a new #GdaDataModelArray data model which can be used, after being correctly filled,
* with the gda_meta_store_modify*() methods.*
*
@@ -3463,9 +3463,9 @@ gda_meta_store_schema_get_all_tables (GdaMetaStore *store)
* gda_meta_store_schema_get_depend_tables:
* @store: a #GdaMetaStore object
* @table_name: the name of the table for which all the dependencies must be listed
- *
*
- * Get an ordered list of the tables @store knows about on which the @table_name table depends (recursively).
+ *
+ * Get an ordered list of the tables @store knows about on which the @table_name table depends (recursively).
* The tables are ordered in a way that tables dependencies
* are respected: if table B has a foreign key on table A, then table A will be listed before table B in the returned
* list.
@@ -3537,7 +3537,7 @@ gda_meta_store_schema_get_structure (GdaMetaStore *store, GError **error)
/* create a GdaMetaStruct */
real_store = gda_connection_get_meta_store (store->priv->cnc);
model = gda_meta_store_extract (real_store,
- "SELECT table_catalog, table_schema, table_name FROM _tables",
+ "SELECT table_catalog, table_schema, table_name FROM _tables",
error, NULL);
if (!model) {
gda_mutex_unlock (store->priv->mutex);
@@ -3611,7 +3611,7 @@ gda_meta_store_schema_get_structure (GdaMetaStore *store, GError **error)
g_slist_free (all_db_obj_list);
gda_mutex_unlock (store->priv->mutex);
-
+
return mstruct;
}
@@ -3625,9 +3625,9 @@ gda_meta_store_schema_get_structure (GdaMetaStore *store, GError **error)
* The #GdaMetaStore object maintains a list of (name,value) attributes (attributes names starting with a '_'
* character are for internal use only and cannot be altered). This method and the gda_meta_store_set_attribute_value()
* method allows the user to add, set or remove attributes specific to their usage.
- *
- * This method allows to get the value of a attribute stored in @store. The returned attribute value is
- * placed at @att_value, the caller is responsible for free that string.
+ *
+ * This method allows to get the value of a attribute stored in @store. The returned attribute value is
+ * placed at @att_value, the caller is responsible for free that string.
*
* If there is no attribute named @att_name then @att_value is set to %NULL
* and @error will contain the GDA_META_STORE_ATTRIBUTE_NOT_FOUND_ERROR error code, and FALSE is returned.
@@ -3661,12 +3661,12 @@ gda_meta_store_get_attribute_value (GdaMetaStore *store, const gchar *att_name,
return FALSE;
}
nrows = gda_data_model_get_n_rows (model);
- if (nrows < 1)
+ if (nrows < 1)
g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_ATTRIBUTE_NOT_FOUND_ERROR,
_("Attribute '%s' not found"), att_name);
- else if (nrows > 1)
+ else if (nrows > 1)
g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_ATTRIBUTE_ERROR,
- ngettext ("Attribute '%s' has %d value", "Attribute '%s' has %d values", nrows),
+ ngettext ("Attribute '%s' has %d value", "Attribute '%s' has %d values", nrows),
att_name, nrows);
else {
value = (GValue*) gda_data_model_get_value_at (model, 0, 0, error);
@@ -3677,7 +3677,7 @@ gda_meta_store_get_attribute_value (GdaMetaStore *store, const gchar *att_name,
if (G_VALUE_TYPE (value) == G_TYPE_STRING) {
const gchar *val;
val = g_value_get_string (value);
- if (val)
+ if (val)
*att_value = g_strdup (val);
}
gda_mutex_unlock (store->priv->mutex);
@@ -3700,7 +3700,7 @@ gda_meta_store_get_attribute_value (GdaMetaStore *store, const gchar *att_name,
* Returns: TRUE if no error occurred
*/
gboolean
-gda_meta_store_set_attribute_value (GdaMetaStore *store, const gchar *att_name,
+gda_meta_store_set_attribute_value (GdaMetaStore *store, const gchar *att_name,
const gchar *att_value, GError **error)
{
GdaMetaStoreClass *klass;
@@ -3734,9 +3734,9 @@ gda_meta_store_set_attribute_value (GdaMetaStore *store, const gchar *att_name,
gda_mutex_unlock (store->priv->mutex);
return FALSE;
}
-
+
/* start a transaction if possible */
- if (! gda_connection_get_transaction_status (store->priv->cnc))
+ if (! gda_connection_get_transaction_status (store->priv->cnc))
started_transaction = gda_connection_begin_transaction (store->priv->cnc, NULL,
GDA_TRANSACTION_ISOLATION_UNKNOWN,
NULL);
@@ -3745,7 +3745,7 @@ gda_meta_store_set_attribute_value (GdaMetaStore *store, const gchar *att_name,
"attributes problems"));
/* delete existing attribute */
- if (gda_connection_statement_execute_non_select (store->priv->cnc,
+ if (gda_connection_statement_execute_non_select (store->priv->cnc,
klass->cpriv->prep_stmts [STMT_DEL_ATT_VALUE], set,
NULL, error) == -1)
goto onerror;
@@ -3755,7 +3755,7 @@ gda_meta_store_set_attribute_value (GdaMetaStore *store, const gchar *att_name,
if (!gda_set_set_holder_value (set, error, "value", att_value))
goto onerror;
- if (gda_connection_statement_execute_non_select (store->priv->cnc,
+ if (gda_connection_statement_execute_non_select (store->priv->cnc,
klass->cpriv->prep_stmts [STMT_SET_ATT_VALUE], set,
NULL, error) == -1)
goto onerror;
@@ -3873,7 +3873,7 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
"%s", _("Missing custom database object name"));
goto onerror;
}
- else if (*prop == '_') {
+ else if (*prop == '_') {
g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
"%s", _("Custom database object names starting with a '_' are reserved for internal usage"));
goto onerror;
@@ -3882,14 +3882,14 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
/* keep a list of custom DB objects _before_ adding the new one(s) (more than
* one if there are dependencies) */
pre_p_db_objects = g_slist_copy (store->priv->p_db_objects);
-
+
/* create DbObject structure from XML description, stored in @store's custom db objects */
- if (!strcmp ((gchar *) node->name, "table"))
+ if (!strcmp ((gchar *) node->name, "table"))
dbo = create_table_object (klass, store, node, error);
- else if (!strcmp ((gchar *) node->name, "view"))
+ else if (!strcmp ((gchar *) node->name, "view"))
dbo = create_view_object (klass, store, node, error);
- if (!dbo)
+ if (!dbo)
goto onerror;
xmlFreeDoc (doc);
doc = NULL;
@@ -3899,7 +3899,7 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
/* make sure the private connection's meta store is up to date about the requested object */
switch (dbo->obj_type) {
- case GDA_SERVER_OPERATION_CREATE_TABLE:
+ case GDA_SERVER_OPERATION_CREATE_TABLE:
case GDA_SERVER_OPERATION_CREATE_VIEW: {
GdaMetaContext context;
gboolean upd_ok;
@@ -3914,7 +3914,7 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
g_free (context.column_names);
gda_value_free (context.column_values[0]);
g_free (context.column_values);
- if (!upd_ok)
+ if (!upd_ok)
goto onerror;
break;
}
@@ -3939,7 +3939,7 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
}
}
gda_value_free (value);
-
+
if (eobj) {
gboolean conflict = FALSE;
@@ -3980,14 +3980,14 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
}
g_object_unref (mstruct);
mstruct = NULL;
-
+
if (needs_creation) {
/* prepare the create operation */
GdaServerProvider *prov;
prov = gda_connection_get_provider (store->priv->cnc);
if (! prepare_dbo_server_operation (klass, store, prov, dbo, error))
goto onerror;
-
+
/* actually create the object in database */
/*g_print ("Creating object: %s\n", dbo->obj_name);*/
if (dbo->create_op) {
@@ -4024,7 +4024,7 @@ gda_meta_store_schema_add_custom_object (GdaMetaStore *store, const gchar *xml_d
g_object_unref (pstore);
if (mstruct)
g_object_unref (mstruct);
-
+
return FALSE;
}
@@ -4043,7 +4043,7 @@ gda_meta_store_schema_remove_custom_object (GdaMetaStore *store, const gchar *ob
{
g_return_val_if_fail (GDA_IS_META_STORE (store), FALSE);
g_return_val_if_fail (obj_name && *obj_name, FALSE);
-
+
if (store->priv->init_error) {
g_propagate_error (error, g_error_copy (store->priv->init_error));
return FALSE;
@@ -4094,7 +4094,7 @@ _gda_meta_store_validate_context (GdaMetaStore *store, GdaMetaContext *context,
lcontext->column_names = g_new0 (gchar*, lcontext->size);
lcontext->column_values = g_new0 (GValue*, lcontext->size);
}
-
+
tinfo = TABLE_INFO (dbobj);
for (i = 0; i < lcontext->size; i++) {
GSList *list;
@@ -4135,7 +4135,7 @@ _gda_meta_store_validate_context (GdaMetaStore *store, GdaMetaContext *context,
}
lcontext->column_values [i] = gda_value_new (G_TYPE_STRING);
g_value_take_string (lcontext->column_values [i], id);
-
+
}
else if (G_VALUE_TYPE (context->column_values [i]) == GDA_TYPE_NULL) {
lcontext->column_values [i] = gda_value_new_null ();
@@ -4235,7 +4235,7 @@ _gda_meta_store_schema_get_upstream_contexts (GdaMetaStore *store, GdaMetaContex
TableFKey *tfk = (TableFKey*) list->data;
gint i, j, partial_parts = 0;
gint *cols_array;
-
+
cols_array = g_new (gint, tfk->cols_nb);
for (i = 0; i < tfk->cols_nb; i++) {
cols_array [i] = -1;
@@ -4436,18 +4436,18 @@ gda_meta_store_declare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruct,
g_return_val_if_fail (nb_cols > 0, FALSE);
g_return_val_if_fail (colnames, FALSE);
g_return_val_if_fail (ref_colnames, FALSE);
-
+
if (!mstruct)
u_mstruct = gda_meta_struct_new (store, GDA_META_STRUCT_FEATURE_NONE);
/* find database objects */
GValue *v1 = NULL, *v2 = NULL, *v3;
-
+
if (catalog)
g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), catalog);
if (schema)
g_value_set_string ((v2 = gda_value_new (G_TYPE_STRING)), schema);
- g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), table);
+ g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), table);
if (mstruct) {
dbo = gda_meta_struct_get_db_object (mstruct, v1, v2, v3);
if (!dbo || (dbo->obj_type != GDA_META_DB_TABLE)) {
@@ -4470,14 +4470,14 @@ gda_meta_store_declare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruct,
if (! dbo)
goto out;
mtable = GDA_META_TABLE (dbo);
-
+
v1 = NULL;
v2 = NULL;
if (ref_catalog)
g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), ref_catalog);
if (ref_schema)
g_value_set_string ((v2 = gda_value_new (G_TYPE_STRING)), ref_schema);
- g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), ref_table);
+ g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), ref_table);
if (mstruct) {
ref_dbo = gda_meta_struct_get_db_object (mstruct, v1, v2, v3);
if (!ref_dbo || (ref_dbo->obj_type != GDA_META_DB_TABLE)) {
@@ -4579,7 +4579,7 @@ gda_meta_store_declare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruct,
}
if (! gda_set_set_holder_value (params, error, "ref_colname", ref_colnames[l]))
goto out;
-
+
if (gda_connection_statement_execute_non_select (store_cnc,
klass->cpriv->prep_stmts[STMT_ADD_DECLARE_FK],
params,
@@ -4590,7 +4590,7 @@ gda_meta_store_declare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruct,
goto out;
}
}
-
+
if (intrans)
gda_connection_commit_transaction (store_cnc, NULL, NULL);
retval = TRUE;
@@ -4656,18 +4656,18 @@ gda_meta_store_undeclare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruc
g_return_val_if_fail (!ref_catalog || (ref_catalog && ref_schema), FALSE);
g_return_val_if_fail (table, FALSE);
g_return_val_if_fail (ref_table, FALSE);
-
+
if (!mstruct)
u_mstruct = gda_meta_struct_new (store, GDA_META_STRUCT_FEATURE_NONE);
/* find database objects */
GValue *v1 = NULL, *v2 = NULL, *v3;
-
+
if (catalog)
g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), catalog);
if (schema)
g_value_set_string ((v2 = gda_value_new (G_TYPE_STRING)), schema);
- g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), table);
+ g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), table);
if (mstruct) {
dbo = gda_meta_struct_get_db_object (mstruct, v1, v2, v3);
if (!dbo || (dbo->obj_type != GDA_META_DB_TABLE)) {
@@ -4690,14 +4690,14 @@ gda_meta_store_undeclare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruc
if (! dbo)
goto out;
mtable = GDA_META_TABLE (dbo);
-
+
v1 = NULL;
v2 = NULL;
if (ref_catalog)
g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), ref_catalog);
if (ref_schema)
g_value_set_string ((v2 = gda_value_new (G_TYPE_STRING)), ref_schema);
- g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), ref_table);
+ g_value_set_string ((v3 = gda_value_new (G_TYPE_STRING)), ref_table);
if (mstruct) {
ref_dbo = gda_meta_struct_get_db_object (mstruct, v1, v2, v3);
if (!ref_dbo || (ref_dbo->obj_type != GDA_META_DB_TABLE)) {
@@ -4757,7 +4757,7 @@ gda_meta_store_undeclare_foreign_key (GdaMetaStore *store, GdaMetaStruct *mstruc
gda_connection_rollback_transaction (store_cnc, NULL, NULL);
goto out;
}
-
+
if (intrans)
gda_connection_commit_transaction (store_cnc, NULL, NULL);
retval = TRUE;
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index fcddcee..5a1fdb8 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -213,7 +213,7 @@ set_from_string (GValue *value, const gchar *as_string)
else if (type == G_TYPE_ULONG)
{
gulong ulvalue;
-
+
ulvalue = strtoul (as_string, endptr, 10);
if (*as_string!=0 && **endptr==0) {
g_value_set_ulong (value, ulvalue);
@@ -223,7 +223,7 @@ set_from_string (GValue *value, const gchar *as_string)
else if (type == G_TYPE_LONG)
{
glong lvalue;
-
+
lvalue = strtol (as_string, endptr, 10);
if (*as_string!=0 && **endptr==0) {
g_value_set_long (value, lvalue);
@@ -265,8 +265,8 @@ set_from_string (GValue *value, const gchar *as_string)
return retval;
}
-/*
- * Register the NULL type in the GType system
+/*
+ * Register the NULL type in the GType system
*/
static void
string_to_null (const GValue *src, GValue *dest)
@@ -315,38 +315,38 @@ gda_null_get_type (void)
return type;
}
-/*
- * Register the GdaBinary type in the GType system
+/*
+ * Register the GdaBinary type in the GType system
*/
/* Transform a String GValue to a GdaBinary*/
-static void
-string_to_binary (const GValue *src, GValue *dest)
+static void
+string_to_binary (const GValue *src, GValue *dest)
{
/* FIXME: add more checks*/
GdaBinary *bin;
const gchar *as_string;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_BINARY (dest));
-
+
as_string = g_value_get_string (src);
-
+
bin = gda_string_to_binary (as_string);
g_return_if_fail (bin);
gda_value_take_binary (dest, bin);
}
-static void
-binary_to_string (const GValue *src, GValue *dest)
+static void
+binary_to_string (const GValue *src, GValue *dest)
{
gchar *str;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_BINARY (src));
-
+
str = gda_binary_to_string (gda_value_get_binary ((GValue *) src), 0);
-
+
g_value_take_string (dest, str);
}
@@ -354,21 +354,21 @@ GType
gda_binary_get_type (void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaBinary",
(GBoxedCopyFunc) gda_binary_copy,
(GBoxedFreeFunc) gda_binary_free);
-
+
g_value_register_transform_func (G_TYPE_STRING,
type,
string_to_binary);
-
- g_value_register_transform_func (type,
+
+ g_value_register_transform_func (type,
G_TYPE_STRING,
binary_to_string);
}
-
+
return type;
}
@@ -393,7 +393,7 @@ gda_binary_copy (gpointer boxed)
copy = g_new0 (GdaBinary, 1);
copy->data = g_memdup (src->data, src->binary_length);
copy->binary_length = src->binary_length;
-
+
return copy;
}
@@ -407,44 +407,44 @@ void
gda_binary_free (gpointer boxed)
{
GdaBinary *binary = (GdaBinary*) boxed;
-
+
g_return_if_fail (binary);
-
+
g_free (binary->data);
g_free (binary);
}
-/*
- * Register the GdaBlob type in the GType system
+/*
+ * Register the GdaBlob type in the GType system
*/
/* Transform a String GValue to a GdaBlob*/
-static void
-string_to_blob (const GValue *src, GValue *dest)
+static void
+string_to_blob (const GValue *src, GValue *dest)
{
/* FIXME: add more checks*/
GdaBlob *blob;
const gchar *as_string;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_BLOB (dest));
-
+
as_string = g_value_get_string (src);
-
+
blob = gda_string_to_blob (as_string);
g_return_if_fail (blob);
gda_value_take_blob (dest, blob);
}
-static void
-blob_to_string (const GValue *src, GValue *dest)
+static void
+blob_to_string (const GValue *src, GValue *dest)
{
gchar *str;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_BLOB (src));
-
+
str = gda_blob_to_string ((GdaBlob *) gda_value_get_blob ((GValue *) src), 0);
-
+
g_value_take_string (dest, str);
}
@@ -452,21 +452,21 @@ GType
gda_blob_get_type (void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaBlob",
(GBoxedCopyFunc) gda_blob_copy,
(GBoxedFreeFunc) gda_blob_free);
-
+
g_value_register_transform_func (G_TYPE_STRING,
type,
string_to_blob);
-
- g_value_register_transform_func (type,
+
+ g_value_register_transform_func (type,
G_TYPE_STRING,
blob_to_string);
}
-
+
return type;
}
@@ -494,7 +494,7 @@ gda_blob_copy (gpointer boxed)
((GdaBinary *)copy)->binary_length = ((GdaBinary *)src)->binary_length;
}
gda_blob_set_op (copy, src->op);
-
+
return copy;
}
@@ -508,7 +508,7 @@ void
gda_blob_free (gpointer boxed)
{
GdaBlob *blob = (GdaBlob*) boxed;
-
+
g_return_if_fail (blob);
if (blob->op) {
@@ -538,26 +538,26 @@ gda_blob_set_op (GdaBlob *blob, GdaBlobOp *op)
}
}
-/*
- * Register the GdaGeometricPoint type in the GType system
+/*
+ * Register the GdaGeometricPoint type in the GType system
*/
static void
-geometric_point_to_string (const GValue *src, GValue *dest)
+geometric_point_to_string (const GValue *src, GValue *dest)
{
gchar *str;
GdaGeometricPoint *point;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_GEOMETRIC_POINT (src));
-
+
point = (GdaGeometricPoint *) gda_value_get_geometric_point ((GValue *) src);
-
+
str = g_strdup_printf ("(%.*g,%.*g)",
DBL_DIG,
point->x,
DBL_DIG,
point->y);
-
+
g_value_take_string (dest, str);
}
@@ -568,13 +568,13 @@ string_to_geometricpoint (const GValue *src, GValue *dest)
/* FIXME: add more checks*/
GdaGeometricPoint *point;
const gchar *as_string;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_GEOMETRIC_POINT (dest));
-
+
as_string = g_value_get_string (src);
point = g_new0 (GdaGeometricPoint, 1);
-
+
as_string++;
point->x = atof (as_string);
as_string = strchr (as_string, ',');
@@ -589,21 +589,21 @@ GType
gda_geometricpoint_get_type (void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaGeometricPoint",
(GBoxedCopyFunc) gda_geometricpoint_copy,
(GBoxedFreeFunc) gda_geometricpoint_free);
-
+
g_value_register_transform_func (G_TYPE_STRING,
type,
string_to_geometricpoint);
-
- g_value_register_transform_func (type,
+
+ g_value_register_transform_func (type,
G_TYPE_STRING,
geometric_point_to_string);
}
-
+
return type;
}
@@ -612,14 +612,14 @@ gda_geometricpoint_get_type (void)
*
* Returns: (transfer full):
*/
-gpointer
+gpointer
gda_geometricpoint_copy (gpointer boxed)
{
GdaGeometricPoint *val = (GdaGeometricPoint*) boxed;
GdaGeometricPoint *copy;
-
+
g_return_val_if_fail( val, NULL);
-
+
copy = g_new0 (GdaGeometricPoint, 1);
copy->x = val->x;
copy->y = val->y;
@@ -634,14 +634,14 @@ gda_geometricpoint_free (gpointer boxed)
}
-/*
- * Register the GdaNumeric type in the GType system
+/*
+ * Register the GdaNumeric type in the GType system
*/
-static void
-numeric_to_string (const GValue *src, GValue *dest)
+static void
+numeric_to_string (const GValue *src, GValue *dest)
{
const GdaNumeric *numeric;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_NUMERIC (src));
@@ -652,11 +652,11 @@ numeric_to_string (const GValue *src, GValue *dest)
g_value_set_string (dest, "");
}
-static void
-numeric_to_int (const GValue *src, GValue *dest)
+static void
+numeric_to_int (const GValue *src, GValue *dest)
{
const GdaNumeric *numeric;
-
+
g_return_if_fail (G_VALUE_HOLDS_INT (dest) &&
GDA_VALUE_HOLDS_NUMERIC (src));
@@ -672,11 +672,11 @@ numeric_to_int (const GValue *src, GValue *dest)
g_value_set_int (dest, 0);
}
-static void
-numeric_to_uint (const GValue *src, GValue *dest)
+static void
+numeric_to_uint (const GValue *src, GValue *dest)
{
const GdaNumeric *numeric;
-
+
g_return_if_fail (G_VALUE_HOLDS_UINT (dest) &&
GDA_VALUE_HOLDS_NUMERIC (src));
@@ -684,7 +684,7 @@ numeric_to_uint (const GValue *src, GValue *dest)
if (numeric) {
glong tmp;
tmp = atol (numeric->number); /* Flawfinder: ignore */
- if ((tmp < 0) || (tmp > G_MAXUINT))
+ if ((tmp < 0) || (tmp > (glong)G_MAXUINT))
g_warning ("Unsigned integer overflow for value %ld", tmp);
g_value_set_uint (dest, tmp);
}
@@ -692,11 +692,11 @@ numeric_to_uint (const GValue *src, GValue *dest)
g_value_set_uint (dest, 0);
}
-static void
-numeric_to_boolean (const GValue *src, GValue *dest)
+static void
+numeric_to_boolean (const GValue *src, GValue *dest)
{
const GdaNumeric *numeric;
-
+
g_return_if_fail (G_VALUE_HOLDS_BOOLEAN (dest) &&
GDA_VALUE_HOLDS_NUMERIC (src));
@@ -711,20 +711,20 @@ GType
gda_numeric_get_type (void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaNumeric",
(GBoxedCopyFunc) gda_numeric_copy,
(GBoxedFreeFunc) gda_numeric_free);
-
+
/* FIXME: No function to Transform String to from GdaNumeric */
-
+
g_value_register_transform_func (type, G_TYPE_STRING, numeric_to_string);
g_value_register_transform_func (type, G_TYPE_INT, numeric_to_int);
g_value_register_transform_func (type, G_TYPE_UINT, numeric_to_uint);
g_value_register_transform_func (type, G_TYPE_BOOLEAN, numeric_to_boolean);
}
-
+
return type;
}
@@ -750,7 +750,7 @@ gda_numeric_copy (gpointer boxed)
copy = g_new0 (GdaNumeric, 1);
copy->number = g_strdup (src->number);
copy->precision = src->precision;
- copy->width = src->width;
+ copy->width = src->width;
return copy;
}
@@ -773,21 +773,21 @@ gda_numeric_free (gpointer boxed)
-/*
- * Register the GdaTime type in the GType system
+/*
+ * Register the GdaTime type in the GType system
*/
-static void
-time_to_string (const GValue *src, GValue *dest)
+static void
+time_to_string (const GValue *src, GValue *dest)
{
GdaTime *gdatime;
GString *string;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_TIME (src));
-
+
gdatime = (GdaTime *) gda_value_get_time ((GValue *) src);
-
+
string = g_string_new ("");
g_string_append_printf (string, "%02u:%02u:%02u",
gdatime->hour,
@@ -795,7 +795,7 @@ time_to_string (const GValue *src, GValue *dest)
gdatime->second);
if (gdatime->fraction != 0)
g_string_append_printf (string, ".%lu", gdatime->fraction);
-
+
if (gdatime->timezone != GDA_TIMEZONE_INVALID)
g_string_append_printf (string, "%+02d", (int) gdatime->timezone / 3600);
@@ -811,10 +811,10 @@ string_to_time (const GValue *src, GValue *dest)
GdaTime *timegda;
const gchar *as_string;
const gchar *ptr;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_TIME (dest));
-
+
as_string = g_value_get_string (src);
if (!as_string)
return;
@@ -861,11 +861,11 @@ string_to_time (const GValue *src, GValue *dest)
if ((*ptr >= '0') && (*ptr <= '9') &&
(*(ptr+1) >= '0') && (*(ptr+1) <= '9'))
timegda->second = (*ptr - '0') * 10 + *(ptr+1) - '0';
-
+
/* extra */
ptr += 2;
if (! *ptr) {
- if ((timegda->hour <= 24) && (timegda->minute <= 60) &&
+ if ((timegda->hour <= 24) && (timegda->minute <= 60) &&
(timegda->second <= 60))
gda_value_set_time (dest, timegda);
g_free (timegda);
@@ -891,7 +891,7 @@ string_to_time (const GValue *src, GValue *dest)
}
timegda->timezone *= 3600;
}
-
+
/* checks */
if ((timegda->hour <= 24) || (timegda->minute <= 60) || (timegda->second <= 60))
gda_value_set_time (dest, timegda);
@@ -902,16 +902,16 @@ GType
gda_time_get_type(void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaTime",
(GBoxedCopyFunc) gda_time_copy,
(GBoxedFreeFunc) gda_time_free);
-
+
g_value_register_transform_func (G_TYPE_STRING, type, string_to_time);
g_value_register_transform_func (type, G_TYPE_STRING, time_to_string);
}
-
+
return type;
}
@@ -923,12 +923,12 @@ gda_time_get_type(void)
gpointer
gda_time_copy (gpointer boxed)
{
-
+
GdaTime *src = (GdaTime*) boxed;
GdaTime *copy = NULL;
-
+
g_return_val_if_fail (src, NULL);
-
+
copy = g_new0 (GdaTime, 1);
copy->hour = src->hour;
copy->minute = src->minute;
@@ -967,8 +967,8 @@ gda_time_valid (const GdaTime *time)
}
-/*
- * Register the GdaTimestamp type in the GType system
+/*
+ * Register the GdaTimestamp type in the GType system
*/
/* Transform a String GValue to a GdaTimestamp from a string like "2003-12-13 13:12:01.12+01" */
static void
@@ -976,7 +976,7 @@ string_to_timestamp (const GValue *src, GValue *dest)
{
/* FIXME: add more checks*/
GdaTimestamp timestamp;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
GDA_VALUE_HOLDS_TIMESTAMP (dest));
@@ -985,17 +985,17 @@ string_to_timestamp (const GValue *src, GValue *dest)
gda_value_set_timestamp (dest, ×tamp);
}
-static void
-timestamp_to_string (const GValue *src, GValue *dest)
+static void
+timestamp_to_string (const GValue *src, GValue *dest)
{
GdaTimestamp *timestamp;
GString *string;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
GDA_VALUE_HOLDS_TIMESTAMP (src));
-
+
timestamp = (GdaTimestamp *) gda_value_get_timestamp ((GValue *) src);
-
+
string = g_string_new ("");
g_string_append_printf (string, "%04u-%02u-%02u %02u:%02u:%02u",
timestamp->year,
@@ -1017,16 +1017,16 @@ GType
gda_timestamp_get_type (void)
{
static GType type = 0;
-
+
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GdaTimestamp",
(GBoxedCopyFunc) gda_timestamp_copy,
(GBoxedFreeFunc) gda_timestamp_free);
-
+
g_value_register_transform_func (G_TYPE_STRING, type, string_to_timestamp);
g_value_register_transform_func (type, G_TYPE_STRING, timestamp_to_string);
}
-
+
return type;
}
@@ -1035,14 +1035,14 @@ gda_timestamp_get_type (void)
*
* Returns: (transfer full):
*/
-gpointer
+gpointer
gda_timestamp_copy (gpointer boxed)
{
GdaTimestamp *src = (GdaTimestamp*) boxed;
GdaTimestamp *copy;
-
+
g_return_val_if_fail(src, NULL);
-
+
copy = g_new0 (GdaTimestamp, 1);
copy->year = src->year;
copy->month = src->month;
@@ -1052,7 +1052,7 @@ gda_timestamp_copy (gpointer boxed)
copy->second = src->second;
copy->fraction = src->fraction;
copy->timezone = src->timezone;
-
+
return copy;
}
@@ -1149,7 +1149,7 @@ gda_value_new_binary (const guchar *val, glong size)
GValue *value;
GdaBinary binary;
- /* We use the const on the function parameter to make this clearer,
+ /* We use the const on the function parameter to make this clearer,
* but it would be awkward to keep the const in the struct.
*/
binary.data = (guchar*)val;
@@ -1273,11 +1273,11 @@ gda_value_new_timestamp_from_timet (time_t val)
* @as_string: stringified representation of the value.
* @type: the new value type.
*
- * Makes a new #GValue of type @type from its string representation.
+ * Makes a new #GValue of type @type from its string representation.
*
* For more information
* about the string format, see the gda_value_set_from_string() function.
- * This function is typically used when reading configuration files or other non-user input that should be locale
+ * This function is typically used when reading configuration files or other non-user input that should be locale
* independent.
*
* Returns: (transfer full): the newly created #GValue or %NULL if the string representation cannot be converted to the specified @type.
@@ -1288,9 +1288,9 @@ GValue *
gda_value_new_from_string (const gchar *as_string, GType type)
{
GValue *value;
-
+
g_return_val_if_fail (as_string, NULL);
-
+
value = gda_value_new (type);
if (set_from_string (value, as_string))
return value;
@@ -1310,7 +1310,7 @@ gda_value_new_from_string (const gchar *as_string, GType type)
*
* For more information
* about the string format, see the gda_value_set_from_string() function.
- * This function is typically used when reading configuration files or other non-user input that should be locale
+ * This function is typically used when reading configuration files or other non-user input that should be locale
* independent.
*
* Returns: (transfer full): the newly created #GValue.
@@ -1326,7 +1326,7 @@ gda_value_new_from_xml (const xmlNodePtr node)
g_return_val_if_fail (node, NULL);
/* parse the XML */
- if (!node || !(node->name) || (node && strcmp ((gchar*)node->name, "value")))
+ if (!node || !(node->name) || (node && strcmp ((gchar*)node->name, "value")))
return NULL;
value = g_new0 (GValue, 1);
@@ -1426,7 +1426,7 @@ gda_value_is_number (const GValue *value)
* @value: value to get a copy from.
*
* Creates a new #GValue from an existing one.
- *
+ *
* Returns: (transfer full): a newly allocated #GValue with a copy of the data in @value.
*
* Free-function: gda_value_free
@@ -1435,7 +1435,7 @@ GValue *
gda_value_copy (const GValue *value)
{
GValue *copy;
-
+
g_return_val_if_fail (value, NULL);
copy = g_new0 (GValue, 1);
@@ -1479,7 +1479,7 @@ void
gda_value_set_binary (GValue *value, const GdaBinary *binary)
{
g_return_if_fail (value);
-
+
l_g_value_unset (value);
g_value_init (value, GDA_TYPE_BINARY);
if (binary)
@@ -1503,7 +1503,7 @@ gda_value_take_binary (GValue *value, GdaBinary *binary)
{
g_return_if_fail (value);
g_return_if_fail (binary);
-
+
l_g_value_unset (value);
g_value_init (value, GDA_TYPE_BINARY);
g_value_take_boxed (value, binary);
@@ -1521,7 +1521,7 @@ gda_value_set_blob (GValue *value, const GdaBlob *blob)
{
g_return_if_fail (value);
g_return_if_fail (blob);
-
+
l_g_value_unset (value);
g_value_init (value, GDA_TYPE_BLOB);
g_value_set_boxed (value, blob);
@@ -1559,7 +1559,7 @@ gda_value_take_blob (GValue *value, GdaBlob *blob)
{
g_return_if_fail (value);
g_return_if_fail (blob);
-
+
l_g_value_unset (value);
g_value_init (value, GDA_TYPE_BLOB);
g_value_take_boxed (value, blob);
@@ -1592,7 +1592,7 @@ gda_value_set_geometric_point (GValue *value, const GdaGeometricPoint *val)
g_return_if_fail (value);
g_return_if_fail (val);
- l_g_value_unset (value);
+ l_g_value_unset (value);
g_value_init (value, GDA_TYPE_GEOMETRIC_POINT);
g_value_set_boxed (value, val);
}
@@ -1786,21 +1786,21 @@ gda_value_set_timestamp (GValue *value, const GdaTimestamp *val)
* <listitem><para>GDA_TYPE_TIMESTAMP: see <link linkend="gda-parse-iso8601-timestamp">gda_parse_iso8601_timestamp()</link></para></listitem>
* </itemizedlist>
*
- * This function is typically used when reading configuration files or other non-user input that should be locale
+ * This function is typically used when reading configuration files or other non-user input that should be locale
* independent.
*
* Returns: %TRUE if the value has been converted to @type from
- * its string representation; it not means that the value is converted
+ * its string representation; it not means that the value is converted
* successfully, just that the transformation is available. %FALSE otherwise.
*/
gboolean
-gda_value_set_from_string (GValue *value,
+gda_value_set_from_string (GValue *value,
const gchar *as_string,
GType type)
{
g_return_val_if_fail (value, FALSE);
g_return_val_if_fail (as_string, FALSE);
-
+
/* REM: glib does not register any transform function from G_TYPE_STRING to any other
* type except to a G_TYPE_STRING, so we can't use g_value_type_transformable (G_TYPE_STRING, type) */
gda_value_reset_with_type (value, type);
@@ -1856,7 +1856,7 @@ gda_value_set_from_value (GValue *value, const GValue *from)
*
* Dates are converted in a YYYY-MM-DD format.
*
- * Returns: (transfer full): a new string, or %NULL if the conversion cannot be done. Free the value with a g_free() when you've finished using it.
+ * Returns: (transfer full): a new string, or %NULL if the conversion cannot be done. Free the value with a g_free() when you've finished using it.
*/
gchar *
gda_value_stringify (const GValue *value)
@@ -1895,7 +1895,7 @@ gda_value_stringify (const GValue *value)
return g_strdup ("");
}
}
-
+
/**
* gda_value_differ:
* @value1: a #GValue to compare.
@@ -1954,7 +1954,7 @@ gda_value_differ (const GValue *value1, const GValue *value2)
const GdaBlob *blob2 = gda_value_get_blob (value2);
if (blob1 && blob2 && (((GdaBinary *)blob1)->binary_length == ((GdaBinary *)blob2)->binary_length)) {
if (blob1->op == blob2->op)
- return bcmp (((GdaBinary *)blob1)->data, ((GdaBinary *)blob2)->data,
+ return bcmp (((GdaBinary *)blob1)->data, ((GdaBinary *)blob2)->data,
((GdaBinary *)blob1)->binary_length);
}
return 1;
@@ -1994,7 +1994,7 @@ gda_value_differ (const GValue *value1, const GValue *value2)
return strcmp (num1->number, num2->number);
return 1;
}
-
+
else if (type == G_TYPE_STRING) {
const gchar *str1, *str2;
str1 = g_value_get_string (value1);
@@ -2003,7 +2003,7 @@ gda_value_differ (const GValue *value1, const GValue *value2)
return strcmp (str1, str2);
return 1;
}
-
+
else if (type == GDA_TYPE_TIME) {
const GdaTime *t1, *t2;
t1 = gda_value_get_time (value1);
@@ -2079,7 +2079,7 @@ gda_value_compare (const GValue *value1, const GValue *value2)
g_return_val_if_fail (value1 && value2, -1);
type = G_VALUE_TYPE (value1);
-
+
if (value1 == value2)
return 0;
@@ -2102,7 +2102,7 @@ gda_value_compare (const GValue *value1, const GValue *value2)
gint64 i2 = g_value_get_int64 (value2);
return (i1 > i2) ? 1 : ((i1 == i2) ? 0 : -1);
}
-
+
else if (type == G_TYPE_UINT64) {
guint64 i1 = g_value_get_uint64 (value1);
guint64 i2 = g_value_get_uint64 (value2);
@@ -2126,7 +2126,7 @@ gda_value_compare (const GValue *value1, const GValue *value2)
const GdaBlob *blob2 = gda_value_get_blob (value2);
if (blob1 && blob2 && (((GdaBinary *)blob1)->binary_length == ((GdaBinary *)blob2)->binary_length)) {
if (blob1->op == blob2->op)
- return memcmp (((GdaBinary *)blob1)->data, ((GdaBinary *)blob2)->data,
+ return memcmp (((GdaBinary *)blob1)->data, ((GdaBinary *)blob2)->data,
((GdaBinary *)blob1)->binary_length);
else
return -1;
@@ -2159,7 +2159,7 @@ gda_value_compare (const GValue *value1, const GValue *value2)
v1 = g_value_get_double (value1);
v2 = g_value_get_double (value2);
-
+
if (v1 == v2)
return 0;
else
@@ -2232,13 +2232,13 @@ gda_value_compare (const GValue *value1, const GValue *value2)
glong i2 = g_value_get_long (value2);
return (i1 > i2) ? 1 : ((i1 == i2) ? 0 : -1);
}
-
+
else if (type == GDA_TYPE_USHORT) {
gushort i1 = gda_value_get_ushort (value1);
gushort i2 = gda_value_get_ushort (value2);
return (i1 > i2) ? 1 : ((i1 == i2) ? 0 : -1);
}
-
+
else if (type == G_TYPE_STRING) {
const gchar *str1, *str2;
str1 = g_value_get_string (value1);
@@ -2255,10 +2255,10 @@ gda_value_compare (const GValue *value1, const GValue *value2)
return 0;
}
}
-
+
return retval;
}
-
+
else if (type == GDA_TYPE_TIME) {
const GdaTime *t1, *t2;
t1 = gda_value_get_time (value1);
@@ -2325,7 +2325,7 @@ gda_value_compare (const GValue *value1, const GValue *value2)
/*
* to_string
- *
+ *
* The exact reverse process of set_from_string(), almost the same as gda_value_stingify ()
* because of some localization with gda_value_stingify ().
*/
@@ -2344,7 +2344,7 @@ to_string (const GValue *value)
}
else
retval = gda_value_stringify (value);
-
+
return retval;
}
@@ -2381,21 +2381,21 @@ gda_value_to_xml (const GValue *value)
/* Gda gshort type */
/* Transform a String GValue to a gshort*/
-static void
+static void
string_to_short(const GValue *src, GValue *dest)
{
-
+
const gchar *as_string;
long int lvalue;
gchar *endptr;
g_return_if_fail (G_VALUE_HOLDS_STRING (src) &&
(GDA_VALUE_HOLDS_SHORT (dest) || GDA_VALUE_HOLDS_USHORT (dest)));
-
+
as_string = g_value_get_string ((GValue *) src);
-
+
lvalue = strtol (as_string, &endptr, 10);
-
+
if (*as_string != '\0' && *endptr == '\0') {
if (GDA_VALUE_HOLDS_SHORT (dest))
gda_value_set_short (dest, (gshort) lvalue);
@@ -2404,25 +2404,25 @@ string_to_short(const GValue *src, GValue *dest)
}
}
-static void
-short_to_string (const GValue *src, GValue *dest)
+static void
+short_to_string (const GValue *src, GValue *dest)
{
gchar *str;
-
+
g_return_if_fail (G_VALUE_HOLDS_STRING (dest) &&
(GDA_VALUE_HOLDS_SHORT (src) || GDA_VALUE_HOLDS_USHORT (src)));
-
+
if (GDA_VALUE_HOLDS_SHORT (src))
str = g_strdup_printf ("%d", gda_value_get_short ((GValue *) src));
else
str = g_strdup_printf ("%d", gda_value_get_ushort ((GValue *) src));
-
+
g_value_take_string (dest, str);
}
GType
-gda_short_get_type (void)
+gda_short_get_type (void)
{
static GType type = 0;
@@ -2439,20 +2439,20 @@ gda_short_get_type (void)
NULL, /* instance_init */
NULL /* value_table */
};
-
- type = g_type_register_static (G_TYPE_INT, "GdaShort", &type_info, 0);
+
+ type = g_type_register_static (G_TYPE_INT, "GdaShort", &type_info, 0);
g_value_register_transform_func(G_TYPE_STRING,
type,
string_to_short);
-
- g_value_register_transform_func(type,
+
+ g_value_register_transform_func(type,
G_TYPE_STRING,
- short_to_string);
+ short_to_string);
}
-
-
-
+
+
+
return type;
}
@@ -2473,18 +2473,18 @@ gda_ushort_get_type (void) {
NULL, /* instance_init */
NULL /* value_table */
};
-
- type = g_type_register_static (G_TYPE_UINT, "GdaUShort", &type_info, 0);
-
+
+ type = g_type_register_static (G_TYPE_UINT, "GdaUShort", &type_info, 0);
+
g_value_register_transform_func (G_TYPE_STRING,
type,
string_to_short);
-
- g_value_register_transform_func (type,
+
+ g_value_register_transform_func (type,
G_TYPE_STRING,
short_to_string);
}
-
+
return type;
}
@@ -2515,7 +2515,7 @@ gda_binary_to_string (const GdaBinary *bin, guint maxlen)
{
gint nb_rewrites = 0;
gchar *sptr, *rptr;
- gulong realsize = MYMIN (bin->binary_length, maxlen);
+ gulong realsize = MYMIN ((gulong)(bin->binary_length), maxlen);
gchar *retval;
gulong offset = 0;
@@ -2524,13 +2524,13 @@ gda_binary_to_string (const GdaBinary *bin, guint maxlen)
return g_strdup ("");
/* compute number of char rewrites */
- for (offset = 0, sptr = (gchar*) bin->data;
- offset < realsize;
+ for (offset = 0, sptr = (gchar*) bin->data;
+ offset < realsize;
offset ++, sptr++) {
if ((*sptr != '\n') && ((*sptr == '\\') || !g_ascii_isprint (*sptr)))
nb_rewrites++;
}
-
+
/* mem allocation and copy */
retval = g_malloc0 (realsize + nb_rewrites * 4 + 1);
rptr = retval;
diff --git a/libgda/handlers/gda-handler-numerical.c b/libgda/handlers/gda-handler-numerical.c
index f097e1e..7f9644c 100644
--- a/libgda/handlers/gda-handler-numerical.c
+++ b/libgda/handlers/gda-handler-numerical.c
@@ -74,7 +74,7 @@ gda_handler_numerical_get_type (void)
0,
(GInstanceInitFunc) gda_handler_numerical_init,
0
- };
+ };
static const GInterfaceInfo data_entry_info = {
(GInterfaceInitFunc) gda_handler_numerical_data_handler_init,
@@ -109,7 +109,7 @@ static void
gda_handler_numerical_class_init (GdaHandlerNumericalClass * class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
-
+
parent_class = g_type_class_peek_parent (class);
object_class->dispose = gda_handler_numerical_dispose;
@@ -195,7 +195,7 @@ gda_handler_numerical_get_sql_from_value (GdaDataHandler *iface, const GValue *v
setlocale (LC_NUMERIC, "C");
str = gda_value_stringify ((GValue *) value);
setlocale (LC_NUMERIC, gda_numeric_locale);
- if (str)
+ if (str)
retval = str;
else
retval = g_strdup ("0");
@@ -266,7 +266,7 @@ gda_handler_numerical_get_value_from_str (GdaDataHandler *iface, const gchar *st
const gchar *p = str;
gboolean ok = TRUE;
gboolean hasdot = FALSE;
-
+
numeric.precision = 0;
numeric.width = 0;
while (p && *p && ok) {
@@ -314,7 +314,7 @@ gda_handler_numerical_get_value_from_str (GdaDataHandler *iface, const gchar *st
}
}
else if (type == G_TYPE_UINT64) {
- if (!*endptr && (llint >= 0) && (llint <= G_MAXUINT64)) {
+ if (!*endptr && (llint >= 0) && (llint <= G_MAXINT64)) {
value = g_value_init (g_new0 (GValue, 1), G_TYPE_UINT64);
g_value_set_uint64 (value, (guint64) llint);
}
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index e0423b8..19d3caa 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -102,13 +102,13 @@ make_pending_blob (GdaConnection *cnc, GdaStatement *stmt, GdaHolder *holder, GE
for (vll = istmt->values_list; vll && (pos == -1); vll = vll->next) {
GSList *vlist;
gint p;
- for (p = 0, vlist = (GSList *) vll->data;
- vlist;
+ for (p = 0, vlist = (GSList *) vll->data;
+ vlist;
p++, vlist = vlist->next) {
GdaSqlExpr *expr = (GdaSqlExpr *) vlist->data;
if (!expr->param_spec)
continue;
- if (expr->param_spec->name &&
+ if (expr->param_spec->name &&
!strcmp (expr->param_spec->name, hname)) {
pos = p;
break;
@@ -153,7 +153,7 @@ make_pending_blob (GdaConnection *cnc, GdaStatement *stmt, GdaHolder *holder, GE
goto out;
}
}
-
+
break;
}
case GDA_SQL_STATEMENT_UPDATE: {
@@ -161,13 +161,13 @@ make_pending_blob (GdaConnection *cnc, GdaStatement *stmt, GdaHolder *holder, GE
gint pos = -1;
GSList *vlist;
gint p;
- for (p = 0, vlist = ustmt->expr_list;
- vlist;
+ for (p = 0, vlist = ustmt->expr_list;
+ vlist;
p++, vlist = vlist->next) {
GdaSqlExpr *expr = (GdaSqlExpr *) vlist->data;
if (!expr->param_spec)
continue;
- if (expr->param_spec->name &&
+ if (expr->param_spec->name &&
!strcmp (expr->param_spec->name, hname)) {
pos = p;
break;
@@ -262,7 +262,7 @@ static GObjectClass *parent_class = NULL;
/* connection management */
static gboolean gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection *cnc,
GdaQuarkList *params, GdaQuarkList *auth,
- guint *task_id,
+ guint *task_id,
GdaServerProviderAsyncCallback async_cb, gpointer cb_data);
static gboolean gda_sqlite_provider_close_connection (GdaServerProvider *provider, GdaConnection *cnc);
static const gchar *gda_sqlite_provider_get_server_version (GdaServerProvider *provider, GdaConnection *cnc);
@@ -278,8 +278,8 @@ static gchar *gda_sqlite_provider_render_operation (GdaServerProvid
GdaServerOperation *op, GError **error);
static gboolean gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnection *cnc,
- GdaServerOperation *op, guint *task_id,
- GdaServerProviderAsyncCallback async_cb,
+ GdaServerOperation *op, guint *task_id,
+ GdaServerProviderAsyncCallback async_cb,
gpointer cb_data, GError **error);
/* transactions */
static gboolean gda_sqlite_provider_begin_transaction (GdaServerProvider *provider, GdaConnection *cnc,
@@ -311,16 +311,16 @@ static const gchar* gda_sqlite_provider_get_default_dbms_type (GdaServerP
/* statements */
static GdaSqlParser *gda_sqlite_provider_create_parser (GdaServerProvider *provider, GdaConnection *cnc);
static gchar *gda_sqlite_provider_statement_to_sql (GdaServerProvider *provider, GdaConnection *cnc,
- GdaStatement *stmt, GdaSet *params,
+ GdaStatement *stmt, GdaSet *params,
GdaStatementSqlFlag flags,
GSList **params_used, GError **error);
static gboolean gda_sqlite_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *cnc,
GdaStatement *stmt, GError **error);
static GObject *gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnection *cnc,
GdaStatement *stmt, GdaSet *params,
- GdaStatementModelUsage model_usage,
- GType *col_types, GdaSet **last_inserted_row,
- guint *task_id, GdaServerProviderExecCallback async_cb,
+ GdaStatementModelUsage model_usage,
+ GType *col_types, GdaSet **last_inserted_row,
+ guint *task_id, GdaServerProviderExecCallback async_cb,
gpointer cb_data, GError **error);
static GdaSqlStatement *gda_sqlite_statement_rewrite (GdaServerProvider *provider, GdaConnection *cnc,
GdaStatement *stmt, GdaSet *params, GError **error);
@@ -331,12 +331,12 @@ static gchar *gda_sqlite_provider_escape_string (GdaServerProvider
static gchar *gda_sqlite_provider_unescape_string (GdaServerProvider *provider, GdaConnection *cnc,
const gchar *string);
-/*
- * private connection data destroy
+/*
+ * private connection data destroy
*/
static void gda_sqlite_free_cnc_data (SqliteConnectionData *cdata);
-/*
+/*
* extending SQLite with our own functions and collations
*/
static void scalar_gda_file_exists_func (sqlite3_context *context, int argc, sqlite3_value **argv);
@@ -553,7 +553,7 @@ gda_sqlite_provider_class_init (GdaSqliteProviderClass *klass)
provider_class->meta_funcs._indexes_tab = _gda_sqlite_meta__indexes_tab;
provider_class->meta_funcs.indexes_tab = _gda_sqlite_meta_indexes_tab;
provider_class->meta_funcs._index_cols = _gda_sqlite_meta__index_cols;
- provider_class->meta_funcs.index_cols = _gda_sqlite_meta_index_cols;
+ provider_class->meta_funcs.index_cols = _gda_sqlite_meta_index_cols;
/* SQLite doe not support distributed transactions */
provider_class->xa_funcs = NULL;
@@ -586,14 +586,14 @@ gda_sqlite_provider_init (GdaSqliteProvider *sqlite_prv, G_GNUC_UNUSED GdaSqlite
internal_stmt = g_new0 (GdaStatement *, sizeof (internal_sql) / sizeof (gchar*));
for (i = INTERNAL_PRAGMA_INDEX_LIST; i < sizeof (internal_sql) / sizeof (gchar*); i++) {
internal_stmt[i] = gda_sql_parser_parse_string (parser, internal_sql[i], NULL, NULL);
- if (!internal_stmt[i])
+ if (!internal_stmt[i])
g_error ("Could not parse internal statement: %s\n", internal_sql[i]);
}
}
/* meta data init */
_gda_sqlite_provider_meta_init ((GdaServerProvider*) sqlite_prv);
-
+
g_static_mutex_unlock (&init_mutex);
}
@@ -625,7 +625,7 @@ gda_sqlite_provider_get_type (void)
#else
#ifdef HAVE_SQLITE
GModule *module2;
-
+
module2 = find_sqlite_library ("libsqlite3");
if (module2)
load_symbols (module2);
@@ -654,7 +654,7 @@ gda_sqlite_provider_get_name (G_GNUC_UNUSED GdaServerProvider *provider)
return PNAME;
}
-/*
+/*
* Get provider's version
*/
static const gchar *
@@ -712,7 +712,7 @@ remove_diacritics_and_change_case (const gchar *str, gssize len, CaseModif cmod)
}
-/*
+/*
* Open connection request
*/
static gboolean
@@ -758,7 +758,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
if (! is_virtual) {
if (!dbname) {
const gchar *str;
-
+
str = gda_quark_list_find (params, "URI");
if (!str) {
gda_connection_add_event_string (cnc,
@@ -769,17 +769,17 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
else {
gint len = strlen (str);
gint elen = strlen (FILE_EXTENSION);
-
+
if (g_str_has_suffix (str, FILE_EXTENSION)) {
gchar *ptr;
-
+
dup = g_strdup (str);
dup [len-elen] = 0;
for (ptr = dup + (len - elen - 1); (ptr >= dup) && (*ptr != G_DIR_SEPARATOR); ptr--);
dbname = ptr;
if (*ptr == G_DIR_SEPARATOR)
dbname ++;
-
+
if ((*ptr == G_DIR_SEPARATOR) && (ptr > dup)) {
dirname = dup;
while ((ptr >= dup) && (*ptr != G_DIR_SEPARATOR))
@@ -801,8 +801,8 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
"DB_DIR (the path to the database file) and DB_NAME "
"(the database file without the '%s' at the end)."), FILE_EXTENSION);
}
- }
-
+ }
+
if (! g_ascii_strcasecmp (dbname,":memory:"))
/* we have an in memory database */
filename = g_strdup (":memory:");
@@ -818,7 +818,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
g_static_rec_mutex_unlock (&cnc_mutex);
return FALSE;
}
-
+
/* try first without the file extension */
filename = g_build_filename (dirname, dbname, NULL);
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
@@ -827,7 +827,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
tmp = g_strdup_printf ("%s%s", dbname, FILE_EXTENSION);
filename = g_build_filename (dirname, tmp, NULL);
g_free (tmp);
-
+
}
g_free (dup);
}
@@ -845,12 +845,13 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
if (errmsg != SQLITE_OK) {
gda_connection_add_event_string (cnc, SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
gda_sqlite_free_cnc_data (cdata);
-
+
g_static_rec_mutex_unlock (&cnc_mutex);
return FALSE;
}
#ifdef SQLITE_HAS_CODEC
+ /* TODO Fix this compiler warning: the address of 'sqlite3_key' will always evaluate as 'true' */
if (passphrase && *passphrase && SQLITE3_CALL (sqlite3_key)) {
errmsg = SQLITE3_CALL (sqlite3_key) (cdata->connection, (void*) passphrase, strlen (passphrase));
if (errmsg != SQLITE_OK) {
@@ -866,13 +867,13 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
/* use extended result codes */
SQLITE3_CALL (sqlite3_extended_result_codes) (cdata->connection, 1);
-
+
/* allow a busy timeout of 500 ms */
SQLITE3_CALL (sqlite3_busy_timeout) (cdata->connection, 500);
/* try to prepare all the internal statements */
InternalStatementItem i;
- for (i = INTERNAL_PRAGMA_INDEX_LIST; i < sizeof (internal_sql) / sizeof (gchar*); i++)
+ for (i = INTERNAL_PRAGMA_INDEX_LIST; i < sizeof (internal_sql) / sizeof (gchar*); i++)
gda_connection_statement_prepare (cnc, internal_stmt[i], NULL);
/* set SQLite library options */
@@ -896,7 +897,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
gint nrows;
gint status;
gchar *errmsg;
-
+
status = SQLITE3_CALL (sqlite3_get_table) (cdata->connection, "SELECT name"
" FROM (SELECT * FROM sqlite_master UNION ALL "
" SELECT * FROM sqlite_temp_master)",
@@ -904,7 +905,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
&nrows,
&ncols,
&errmsg);
- if (status == SQLITE_OK)
+ if (status == SQLITE_OK)
SQLITE3_CALL (sqlite3_free_table) (data);
else {
gda_connection_add_event_string (cnc, errmsg);
@@ -968,9 +969,9 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
for (i = 0; i < sizeof (scalars) / sizeof (ScalarFunction); i++) {
ScalarFunction *func = (ScalarFunction *) &(scalars [i]);
- gint res = SQLITE3_CALL (sqlite3_create_function) (cdata->connection,
+ gint res = SQLITE3_CALL (sqlite3_create_function) (cdata->connection,
func->name, func->nargs,
- SQLITE_UTF8, func->user_data,
+ SQLITE_UTF8, func->user_data,
func->xFunc, NULL, NULL);
if (res != SQLITE_OK) {
gda_connection_add_event_string (cnc, _("Could not register function '%s'"),
@@ -988,9 +989,9 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
for (i = 0; i < sizeof (regexp_functions) / sizeof (ScalarFunction); i++) {
ScalarFunction *func = (ScalarFunction *) &(regexp_functions [i]);
- gint res = SQLITE3_CALL (sqlite3_create_function) (cdata->connection,
+ gint res = SQLITE3_CALL (sqlite3_create_function) (cdata->connection,
func->name, func->nargs,
- SQLITE_UTF8, func->user_data,
+ SQLITE_UTF8, func->user_data,
func->xFunc, NULL, NULL);
if (res != SQLITE_OK) {
gda_connection_add_event_string (cnc, _("Could not register function '%s'"),
@@ -1002,7 +1003,7 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
}
}
}
-
+
if (! locale_collate || ((*locale_collate == 't') || (*locale_collate == 'T'))) {
gsize i;
for (i = 0; i < sizeof (collation_functions) / sizeof (CollationFunction); i++) {
@@ -1061,7 +1062,7 @@ dcase_collate_func (G_GNUC_UNUSED void *pArg,
return res;
}
-/*
+/*
* Close connection request
*/
static gboolean
@@ -1106,7 +1107,7 @@ gda_sqlite_provider_get_database (GdaServerProvider *provider, GdaConnection *cn
g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
- if (!cdata)
+ if (!cdata)
return NULL;
return cdata->file;
}
@@ -1286,14 +1287,14 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
gint errmsg;
gchar *filename, *tmp;
gboolean retval = TRUE;
-
+
value = gda_server_operation_get_value_at (op, "/DB_DEF_P/DB_NAME");
if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value))
dbname = g_value_get_string (value);
value = gda_server_operation_get_value_at (op, "/DB_DEF_P/DB_DIR");
if (value && G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value))
dir = g_value_get_string (value);
-
+
tmp = g_strdup_printf ("%s%s", dbname, FILE_EXTENSION);
filename = g_build_filename (dir, tmp, NULL);
g_free (tmp);
@@ -1303,7 +1304,7 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
g_free (filename);
if (errmsg != SQLITE_OK) {
- g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
+ g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
retval = FALSE;
}
@@ -1317,7 +1318,7 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
errmsg = SQLITE3_CALL (sqlite3_key) (cdata->connection, (void*) passphrase,
strlen (passphrase));
if (errmsg != SQLITE_OK) {
- g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
+ g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
retval = FALSE;
}
else {
@@ -1405,10 +1406,10 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
"%s", _("Missing database name or directory"));
retval = FALSE;
}
-
+
return retval;
}
- default:
+ default:
/* use the SQL from the provider to perform the action */
return gda_server_provider_perform_operation_default (provider, cnc, op, error);
}
@@ -1440,14 +1441,14 @@ gda_sqlite_provider_begin_transaction (GdaServerProvider *provider, GdaConnectio
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (! gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN_NAMED],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN_NAMED],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
}
else {
- if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN],
- NULL, NULL, error) == -1)
+ if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_BEGIN],
+ NULL, NULL, error) == -1)
status = FALSE;
}
@@ -1475,14 +1476,14 @@ gda_sqlite_provider_commit_transaction (GdaServerProvider *provider, GdaConnecti
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (!gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT_NAMED],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT_NAMED],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
}
else {
- if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT],
- NULL, NULL, error) == -1)
+ if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_COMMIT],
+ NULL, NULL, error) == -1)
status = FALSE;
}
@@ -1511,14 +1512,14 @@ gda_sqlite_provider_rollback_transaction (GdaServerProvider *provider,
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (! gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_NAMED],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_NAMED],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
}
else {
- if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK],
- NULL, NULL, error) == -1)
+ if (gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK],
+ NULL, NULL, error) == -1)
status = FALSE;
}
@@ -1543,8 +1544,8 @@ gda_sqlite_provider_add_savepoint (GdaServerProvider *provider, GdaConnection *c
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (! gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ADD_SAVEPOINT],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ADD_SAVEPOINT],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
@@ -1569,8 +1570,8 @@ gda_sqlite_provider_rollback_savepoint (GdaServerProvider *provider, GdaConnecti
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (! gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_SAVEPOINT],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_ROLLBACK_SAVEPOINT],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
@@ -1595,8 +1596,8 @@ gda_sqlite_provider_delete_savepoint (GdaServerProvider *provider, GdaConnection
params_set = gda_set_new_inline (1, "name", G_TYPE_STRING, name);
else if (! gda_set_set_holder_value (params_set, error, "name", name))
status = FALSE;
- if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_RELEASE_SAVEPOINT],
- params_set, NULL, error) == -1)
+ if (status && gda_connection_statement_execute_non_select (cnc, internal_stmt[INTERNAL_RELEASE_SAVEPOINT],
+ params_set, NULL, error) == -1)
status = FALSE;
g_static_mutex_unlock (&mutex);
@@ -1628,7 +1629,7 @@ gda_sqlite_provider_supports (GdaServerProvider *provider,
return TRUE;
case GDA_CONNECTION_FEATURE_MULTI_THREADING:
return SQLITE3_CALL (sqlite3_threadsafe) () ? TRUE : FALSE;
- default:
+ default:
return FALSE;
}
}
@@ -1699,7 +1700,7 @@ gda_sqlite_provider_get_data_handler (GdaServerProvider *provider, GdaConnection
else
dh = gda_server_provider_get_data_handler_default (provider, cnc, type, dbms_type);
- return dh;
+ return dh;
}
/*
@@ -1725,7 +1726,7 @@ gda_sqlite_provider_get_default_dbms_type (G_GNUC_UNUSED GdaServerProvider *prov
if (type == G_TYPE_BOOLEAN)
return "boolean";
-
+
if ((type == GDA_TYPE_GEOMETRIC_POINT) ||
(type == G_TYPE_OBJECT) ||
(type == G_TYPE_STRING) ||
@@ -1736,14 +1737,14 @@ gda_sqlite_provider_get_default_dbms_type (G_GNUC_UNUSED GdaServerProvider *prov
(type == GDA_TYPE_NUMERIC) ||
(type == G_TYPE_FLOAT))
return "real";
-
+
if (type == GDA_TYPE_TIME)
return "time";
if (type == GDA_TYPE_TIMESTAMP)
return "timestamp";
if (type == G_TYPE_DATE)
return "date";
-
+
if ((type == GDA_TYPE_NULL) ||
(type == G_TYPE_GTYPE))
return NULL;
@@ -1765,7 +1766,7 @@ gda_sqlite_provider_create_parser (G_GNUC_UNUSED GdaServerProvider *provider, G_
* GdaStatement to SQL request
*/
static gchar *sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, GError **error);
-static gchar *sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
+static gchar *sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
gboolean *is_default, gboolean *is_null,
GError **error);
static gchar *
@@ -1826,8 +1827,8 @@ sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, G
g_return_val_if_fail (op, NULL);
g_return_val_if_fail (GDA_SQL_ANY_PART (op)->type == GDA_SQL_ANY_SQL_OPERATION, NULL);
- /* can't have:
- * - op->operands == NULL
+ /* can't have:
+ * - op->operands == NULL
* - incorrect number of operands
*/
if (!gda_sql_any_part_check_structure (GDA_SQL_ANY_PART (op), error)) return NULL;
@@ -1851,7 +1852,7 @@ sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, G
str = NULL;
switch (op->operator_type) {
case GDA_SQL_OPERATOR_TYPE_EQ:
- if (SQL_OPERAND (sql_list->next->data)->is_null)
+ if (SQL_OPERAND (sql_list->next->data)->is_null)
str = g_strdup_printf ("%s IS NULL", SQL_OPERAND (sql_list->data)->sql);
else
str = g_strdup_printf ("%s = %s", SQL_OPERAND (sql_list->data)->sql, SQL_OPERAND (sql_list->next->data)->sql);
@@ -1907,7 +1908,7 @@ sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, G
str = g_strdup_printf ("%s | %s", SQL_OPERAND (sql_list->data)->sql, SQL_OPERAND (sql_list->next->data)->sql);
break;
case GDA_SQL_OPERATOR_TYPE_BETWEEN:
- str = g_strdup_printf ("%s BETWEEN %s AND %s", SQL_OPERAND (sql_list->data)->sql,
+ str = g_strdup_printf ("%s BETWEEN %s AND %s", SQL_OPERAND (sql_list->data)->sql,
SQL_OPERAND (sql_list->next->data)->sql,
SQL_OPERAND (sql_list->next->next->data)->sql);
break;
@@ -2012,7 +2013,7 @@ sqlite_render_operation (GdaSqlOperation *op, GdaSqlRenderingContext *context, G
}
static gchar *
-sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
+sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
gboolean *is_default, gboolean *is_null,
GError **error)
{
@@ -2027,8 +2028,8 @@ sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
if (is_null)
*is_null = FALSE;
- /* can't have:
- * - expr->cast_as && expr->param_spec
+ /* can't have:
+ * - expr->cast_as && expr->param_spec
*/
if (!gda_sql_any_part_check_structure (GDA_SQL_ANY_PART (expr), error)) return NULL;
@@ -2048,7 +2049,7 @@ sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
g_object_get (G_OBJECT (context->cnc), "options", &cncoptions, NULL);
ids_array = gda_sql_identifier_split (g_value_get_string (expr->value));
- if (!ids_array)
+ if (!ids_array)
str = g_value_dup_string (expr->value);
else if (!(ids_array[0])) goto err;
else {
@@ -2073,7 +2074,7 @@ sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
if (!str) goto err;
if (is_null && gda_value_is_null (expr->value))
*is_null = TRUE;
- else if (is_default && (G_VALUE_TYPE (expr->value) == G_TYPE_STRING) &&
+ else if (is_default && (G_VALUE_TYPE (expr->value) == G_TYPE_STRING) &&
!g_ascii_strcasecmp (g_value_get_string (expr->value), "default"))
*is_default = TRUE;
else if (!g_ascii_strcasecmp (str, "FALSE")) {
@@ -2125,7 +2126,7 @@ sqlite_render_expr (GdaSqlExpr *expr, GdaSqlRenderingContext *context,
str = g_strdup ("[...]");
}
- if (expr->cast_as)
+ if (expr->cast_as)
g_string_append_printf (string, "CAST (%s AS %s)", str, expr->cast_as);
else
g_string_append (string, str);
@@ -2206,7 +2207,7 @@ add_oid_columns (GdaStatement *stmt, GHashTable **out_hash, gint *out_nb_cols_ad
g_assert (sqlst);
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
sst = (GdaSqlStatementSelect*) sqlst->contents;
-
+
if (!sst->from || sst->distinct) {
gda_sql_statement_free (sqlst);
return g_object_ref (stmt);
@@ -2216,7 +2217,7 @@ add_oid_columns (GdaStatement *stmt, GHashTable **out_hash, gint *out_nb_cols_ad
if (sst->order_by) {
for (list = sst->order_by; list; list = list->next) {
GdaSqlSelectOrder *order = (GdaSqlSelectOrder*) list->data;
- if (order->expr && order->expr->value &&
+ if (order->expr && order->expr->value &&
(G_VALUE_TYPE (order->expr->value) != G_TYPE_STRING)) {
gda_sql_statement_free (sqlst);
return g_object_ref (stmt);
@@ -2235,21 +2236,21 @@ add_oid_columns (GdaStatement *stmt, GHashTable **out_hash, gint *out_nb_cols_ad
/* add a field */
field = gda_sql_select_field_new (GDA_SQL_ANY_PART (sst));
sst->expr_list = g_slist_insert (sst->expr_list, field, add_index);
-
+
field->expr = gda_sql_expr_new (GDA_SQL_ANY_PART (field));
-
+
gchar *str, *tmp;
const gchar *name;
if (target->as)
name = target->as;
else
name = target->table_name;
-
+
tmp = gda_sql_identifier_quote (name, NULL, NULL, FALSE, FALSE);
str = g_strdup_printf ("%s.rowid", tmp);
g_free (tmp);
g_value_take_string ((field->expr->value = gda_value_new (G_TYPE_STRING)), str);
-
+
/* add to hash table */
add_index++;
g_hash_table_insert (hash, gda_sql_identifier_prepare_for_compare (g_strdup (name)),
@@ -2280,12 +2281,12 @@ add_oid_columns (GdaStatement *stmt, GHashTable **out_hash, gint *out_nb_cols_ad
}
}
}
-
+
/* prepare return */
nstmt = (GdaStatement*) g_object_new (GDA_TYPE_STATEMENT, "structure", sqlst, NULL);
gda_sql_statement_free (sqlst);
/*g_print ("%s(): Added %d columns: %s\n", __FUNCTION__, nb_cols_added, gda_statement_to_sql (nstmt, NULL, NULL));*/
-
+
*out_hash = hash;
*out_nb_cols_added = nb_cols_added;
@@ -2303,14 +2304,14 @@ real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stm
GdaSqlitePStmt *ps;
GdaSet *params = NULL;
GSList *used_params = NULL;
-
+
GdaStatement *real_stmt;
GHashTable *hash;
gint nb_rows_added;
/* get SQLite's private data */
cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
- if (!cdata)
+ if (!cdata)
return NULL;
/* render as SQL understood by SQLite */
@@ -2320,7 +2321,7 @@ real_prepare (GdaServerProvider *provider, GdaConnection *cnc, GdaStatement *stm
real_stmt = add_oid_columns (stmt, &hash, &nb_rows_added);
sql = gda_sqlite_provider_statement_to_sql (provider, cnc, real_stmt, params, GDA_STATEMENT_SQL_PARAMS_AS_QMARK,
&used_params, error);
- if (!sql)
+ if (!sql)
goto out_err;
/* prepare statement */
@@ -2405,36 +2406,36 @@ make_last_inserted_set (GdaConnection *cnc, GdaStatement *stmt, sqlite3_int64 la
g_object_get (G_OBJECT (stmt), "structure", &sql_insert, NULL);
g_assert (sql_insert);
insert = (GdaSqlStatementInsert *) sql_insert->contents;
-
+
/* build corresponding SELECT statement */
GdaSqlStatementSelect *select;
GdaSqlSelectTarget *target;
GdaSqlStatement *sql_statement = gda_sql_statement_new (GDA_SQL_STATEMENT_SELECT);
-
+
select = (GdaSqlStatementSelect*) sql_statement->contents;
-
+
/* FROM */
select->from = gda_sql_select_from_new (GDA_SQL_ANY_PART (select));
target = gda_sql_select_target_new (GDA_SQL_ANY_PART (select->from));
gda_sql_select_from_take_new_target (select->from, target);
-
+
/* Filling in the target */
GValue *value;
g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), insert->table->table_name);
gda_sql_select_target_take_table_name (target, value);
gda_sql_statement_free (sql_insert);
-
+
/* selected fields */
GdaSqlSelectField *field;
GSList *fields_list = NULL;
-
+
field = gda_sql_select_field_new (GDA_SQL_ANY_PART (select));
g_value_set_string ((value = gda_value_new (G_TYPE_STRING)), "*");
gda_sql_select_field_take_star_value (field, value);
fields_list = g_slist_append (fields_list, field);
-
+
gda_sql_statement_select_take_expr_list (sql_statement, fields_list);
-
+
/* WHERE */
GdaSqlExpr *where, *expr;
GdaSqlOperation *cond;
@@ -2455,9 +2456,9 @@ make_last_inserted_set (GdaConnection *cnc, GdaStatement *stmt, sqlite3_int64 la
expr = gda_sql_expr_new (GDA_SQL_ANY_PART (cond));
expr->param_spec = pspec;
cond->operands = g_slist_append (cond->operands, expr);
-
+
gda_sql_statement_select_take_where_cond (sql_statement, where);
-
+
if (gda_sql_statement_check_structure (sql_statement, &lerror) == FALSE) {
g_warning (_("Can't build SELECT statement to get last inserted row: %s)"),
lerror && lerror->message ? lerror->message : _("No detail"));
@@ -2510,7 +2511,7 @@ make_last_inserted_set (GdaConnection *cnc, GdaStatement *stmt, sqlite3_int64 la
return NULL;
}
else if (nrows > 1) {
- g_warning (_("SELECT statement to get last inserted row returned too many (%d) rows"),
+ g_warning (_("SELECT statement to get last inserted row returned too many (%d) rows"),
nrows);
return NULL;
}
@@ -2550,14 +2551,14 @@ make_last_inserted_set (GdaConnection *cnc, GdaStatement *stmt, sqlite3_int64 la
}
}
-/*
+/*
* This function opens any blob which has been inserted or updated as a ZERO blob (the blob currently
* only contains zeros) and fills its contents with the blob passed as parameter when executing the statement.
*
* @blobs_list is freed here
*/
static GdaConnectionEvent *
-fill_blob_data (GdaConnection *cnc, GdaSet *params,
+fill_blob_data (GdaConnection *cnc, GdaSet *params,
SqliteConnectionData *cdata, GdaSqlitePStmt *pstmt, GSList *blobs_list, GError **error)
{
if (!blobs_list)
@@ -2585,7 +2586,7 @@ fill_blob_data (GdaConnection *cnc, GdaSet *params,
GdaSqlStatement *sel_stmt;
GdaSqlStatementSelect *sst;
sel_stmt = gda_compute_select_statement_from_update (stmt, &lerror);
- if (!sel_stmt)
+ if (!sel_stmt)
goto blobs_out;
sst = (GdaSqlStatementSelect*) sel_stmt->contents;
GdaSqlSelectField *oidfield;
@@ -2609,7 +2610,7 @@ fill_blob_data (GdaConnection *cnc, GdaSet *params,
GSList *list;
for (list = blobs_list; list; list = list->next) {
PendingBlob *pb = (PendingBlob*) list->data;
-
+
if (rowid >= 0) {
/*g_print ("Filling BLOB @ %s.%s.%s, rowID %ld\n", pb->db, pb->table, pb->column, rowid);*/
GdaSqliteBlobOp *bop;
@@ -2669,7 +2670,7 @@ fill_blob_data (GdaConnection *cnc, GdaSet *params,
else
cstr = _("Can't identify the ROWID of the blob to fill");
}
-
+
blobs_out:
pending_blobs_free_list (blobs_list);
@@ -2697,9 +2698,9 @@ fill_blob_data (GdaConnection *cnc, GdaSet *params,
static GObject *
gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnection *cnc,
GdaStatement *stmt, GdaSet *params,
- GdaStatementModelUsage model_usage,
- GType *col_types, GdaSet **last_inserted_row,
- guint *task_id, GdaServerProviderExecCallback async_cb,
+ GdaStatementModelUsage model_usage,
+ GType *col_types, GdaSet **last_inserted_row,
+ guint *task_id, GdaServerProviderExecCallback async_cb,
gpointer cb_data, GError **error)
{
GdaSqlitePStmt *ps;
@@ -2727,7 +2728,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
/* get SQLite's private data */
cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data (cnc);
- if (!cdata)
+ if (!cdata)
return NULL;
/* get/create new prepared statement */
@@ -2796,7 +2797,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
}
/* reset prepared stmt */
- if ((SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt) != SQLITE_OK) ||
+ if ((SQLITE3_CALL (sqlite3_reset) (ps->sqlite_stmt) != SQLITE_OK) ||
(SQLITE3_CALL (sqlite3_clear_bindings) (ps->sqlite_stmt) != SQLITE_OK)) {
GdaConnectionEvent *event;
const char *errmsg;
@@ -2812,7 +2813,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
g_object_unref (ps);
return NULL;
}
-
+
/* bind statement's parameters */
GSList *list;
GdaConnectionEvent *event = NULL;
@@ -2821,7 +2822,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
for (i = 1, list = _GDA_PSTMT (ps)->param_ids; list; list = list->next, i++) {
const gchar *pname = (gchar *) list->data;
- GdaHolder *h = NULL;
+ GdaHolder *h = NULL;
if (!params) {
event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
@@ -2885,13 +2886,13 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
if (!sqlst) {
event = gda_connection_point_available_event (cnc,
GDA_CONNECTION_EVENT_ERROR);
- gda_connection_event_set_description (event, lerror && lerror->message ?
+ gda_connection_event_set_description (event, lerror && lerror->message ?
lerror->message :
_("Can't rewrite statement handle default values"));
g_propagate_error (error, lerror);
break;
}
-
+
GdaStatement *rstmt;
GObject *res;
rstmt = g_object_new (GDA_TYPE_STATEMENT, "structure", sqlst, NULL);
@@ -2909,12 +2910,12 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
return res;
}
/*g_print ("BINDING param '%s' to %p\n", pname, h);*/
-
+
const GValue *value = gda_holder_get_value (h);
if (!value || gda_value_is_null (value))
SQLITE3_CALL (sqlite3_bind_null) (ps->sqlite_stmt, i);
else if (G_VALUE_TYPE (value) == G_TYPE_STRING)
- SQLITE3_CALL (sqlite3_bind_text) (ps->sqlite_stmt, i,
+ SQLITE3_CALL (sqlite3_bind_text) (ps->sqlite_stmt, i,
g_value_get_string (value), -1, SQLITE_TRANSIENT);
else if (G_VALUE_TYPE (value) == G_TYPE_INT)
SQLITE3_CALL (sqlite3_bind_int) (ps->sqlite_stmt, i, g_value_get_int (value));
@@ -2950,7 +2951,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
blob_len = gda_blob_op_get_length (blob->op);
else
blob_len = ((GdaBinary*) blob)->binary_length;
- if (blob_len < 0)
+ if (blob_len < 0)
str = _("Can't get BLOB's length");
else if (blob_len >= G_MAXINT)
str = _("BLOB is too big");
@@ -2968,9 +2969,9 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
pb = make_pending_blob (cnc, stmt, h, &lerror);
if (!pb) {
event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
- gda_connection_event_set_description (event,
+ gda_connection_event_set_description (event,
lerror && lerror->message ? lerror->message : _("No detail"));
-
+
g_propagate_error (error, lerror);
break;
}
@@ -2980,35 +2981,35 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
if (SQLITE3_CALL (sqlite3_bind_zeroblob) (ps->sqlite_stmt, i, (int) blob_len) !=
SQLITE_OK) {
event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
- gda_connection_event_set_description (event,
+ gda_connection_event_set_description (event,
lerror && lerror->message ? lerror->message : _("No detail"));
-
+
g_propagate_error (error, lerror);
- break;
+ break;
}
}
else if (G_VALUE_TYPE (value) == GDA_TYPE_BINARY) {
GdaBinary *bin = (GdaBinary *) gda_value_get_binary (value);
- SQLITE3_CALL (sqlite3_bind_blob) (ps->sqlite_stmt, i,
+ SQLITE3_CALL (sqlite3_bind_blob) (ps->sqlite_stmt, i,
bin->data, bin->binary_length, SQLITE_TRANSIENT);
}
else if (G_VALUE_TYPE (value) == GDA_TYPE_TIME) {
gchar *str;
const GdaTime *ts;
-
+
ts = gda_value_get_time (value);
if (ts->fraction != 0)
- str = g_strdup_printf ("%02d:%02d:%02d.%ld",
+ str = g_strdup_printf ("%02d:%02d:%02d.%ld",
ts->hour, ts->minute, ts->second, ts->fraction);
else
- str = g_strdup_printf ("%02d:%02d:%02d",
+ str = g_strdup_printf ("%02d:%02d:%02d",
ts->hour, ts->minute, ts->second);
SQLITE3_CALL (sqlite3_bind_text) (ps->sqlite_stmt, i, str, -1, g_free);
}
else if (G_VALUE_TYPE (value) == G_TYPE_DATE) {
gchar *str;
const GDate *ts;
-
+
ts = g_value_get_boxed (value);
str = g_strdup_printf ("%4d-%02d-%02d", g_date_get_year (ts),
g_date_get_month (ts), g_date_get_day (ts));
@@ -3017,25 +3018,25 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
else if (G_VALUE_TYPE (value) == GDA_TYPE_TIMESTAMP) {
gchar *str;
const GdaTimestamp *ts;
-
+
ts = gda_value_get_timestamp (value);
if (ts->fraction != 0)
- str = g_strdup_printf ("%4d-%02d-%02d %02d:%02d:%02d.%ld", ts->year, ts->month, ts->day,
+ str = g_strdup_printf ("%4d-%02d-%02d %02d:%02d:%02d.%ld", ts->year, ts->month, ts->day,
ts->hour, ts->minute, ts->second, ts->fraction);
else
- str = g_strdup_printf ("%4d-%02d-%02d %02d:%02d:%02d", ts->year, ts->month, ts->day,
+ str = g_strdup_printf ("%4d-%02d-%02d %02d:%02d:%02d", ts->year, ts->month, ts->day,
ts->hour, ts->minute, ts->second);
SQLITE3_CALL (sqlite3_bind_text) (ps->sqlite_stmt, i, str, -1, g_free);
}
else if (G_VALUE_TYPE (value) == GDA_TYPE_NUMERIC) {
const GdaNumeric *gdan;
-
+
gdan = gda_value_get_numeric (value);
SQLITE3_CALL (sqlite3_bind_text) (ps->sqlite_stmt, i, gdan->number, -1, SQLITE_TRANSIENT);
}
else {
gchar *str;
- str = g_strdup_printf (_("Non handled data type '%s'"),
+ str = g_strdup_printf (_("Non handled data type '%s'"),
g_type_name (G_VALUE_TYPE (value)));
event = gda_connection_point_available_event (cnc, GDA_CONNECTION_EVENT_ERROR);
gda_connection_event_set_description (event, str);
@@ -3045,7 +3046,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
break;
}
}
-
+
if (event) {
gda_connection_add_event (cnc, event);
if (new_ps)
@@ -3053,12 +3054,12 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
pending_blobs_free_list (blobs_list);
return NULL;
}
-
+
/* 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);
-
+
/* treat prepared and bound statement */
if (! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "SELECT", 6) ||
! g_ascii_strncasecmp (_GDA_PSTMT (ps)->sql, "PRAGMA", 6) ||
@@ -3175,7 +3176,7 @@ gda_sqlite_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
}
else if (transaction_started)
gda_connection_commit_transaction (cdata->gdacnc, NULL, NULL);
-
+
gchar *str = NULL;
gboolean count_changes = FALSE;
@@ -3260,7 +3261,7 @@ gda_sqlite_statement_rewrite (GdaServerProvider *provider, GdaConnection *cnc,
return gda_statement_rewrite_for_default_values (stmt, params, TRUE, error);
}
-/*
+/*
* SQLite's extra functions' implementations
*/
static void
@@ -3514,7 +3515,7 @@ scalar_regexp_func (sqlite3_context *context, int argc, sqlite3_value **argv)
if (argc == 3)
options = (gchar*) SQLITE3_CALL (sqlite3_value_text) (argv [2]);
-
+
if (options) {
const gchar *ptr;
for (ptr = options; *ptr; ptr++) {
@@ -3540,7 +3541,7 @@ scalar_regexp_func (sqlite3_context *context, int argc, sqlite3_value **argv)
g_string_append_c (sig, 0x01);
if (options && *options)
g_string_append (sig, options);
-
+
if (re_hash)
regex = g_hash_table_lookup (re_hash, sig->str);
if (regex) {
@@ -3622,10 +3623,10 @@ gda_sqlite_free_cnc_data (SqliteConnectionData *cdata)
{
if (!cdata)
return;
-
+
if (cdata->gdacnc)
g_object_remove_weak_pointer (G_OBJECT (cdata->gdacnc), (gpointer*) &(cdata->gdacnc));
- if (cdata->connection)
+ if (cdata->connection)
SQLITE3_CALL (sqlite3_close) (cdata->connection);
g_free (cdata->file);
if (cdata->types_hash)
@@ -3643,7 +3644,7 @@ gda_sqlite_provider_escape_string (G_GNUC_UNUSED GdaServerProvider *provider, G_
if (!string)
return NULL;
-
+
/* determination of the new string size */
ptr = (gchar *) string;
size = 1;
@@ -3682,10 +3683,10 @@ gda_sqlite_provider_unescape_string (G_GNUC_UNUSED GdaServerProvider *provider,
gchar *ptr;
gchar *retval;
glong offset = 0;
-
- if (!string)
+
+ if (!string)
return NULL;
-
+
total = strlen (string);
retval = g_memdup (string, total+1);
ptr = (gchar *) retval;
diff --git a/libgda/sqlite/virtual/gda-vconnection-hub.c b/libgda/sqlite/virtual/gda-vconnection-hub.c
index dbe2d8b..eeb518b 100644
--- a/libgda/sqlite/virtual/gda-vconnection-hub.c
+++ b/libgda/sqlite/virtual/gda-vconnection-hub.c
@@ -116,7 +116,7 @@ gda_vconnection_hub_get_type (void)
(GInstanceInitFunc) gda_vconnection_hub_init,
0
};
-
+
g_static_mutex_lock (®istering);
if (type == 0)
type = g_type_register_static (GDA_TYPE_VCONNECTION_DATA_MODEL, "GdaVconnectionHub", &info, 0);
@@ -143,7 +143,7 @@ gda_vconnection_hub_get_type (void)
* Returns: TRUE if no error occurred
*/
gboolean
-gda_vconnection_hub_add (GdaVconnectionHub *hub,
+gda_vconnection_hub_add (GdaVconnectionHub *hub,
GdaConnection *cnc, const gchar *ns, GError **error)
{
HubConnection *hc;
@@ -154,7 +154,7 @@ gda_vconnection_hub_add (GdaVconnectionHub *hub,
/* check for constraints */
hc = get_hub_cnc_by_ns (hub, ns);
if (hc && (hc->cnc != cnc)) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Namespace must be specified"));
return FALSE;
}
@@ -163,7 +163,7 @@ gda_vconnection_hub_add (GdaVconnectionHub *hub,
return TRUE;
if (!gda_connection_is_opened (cnc)) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Connection is closed"));
return FALSE;
}
@@ -174,7 +174,7 @@ gda_vconnection_hub_add (GdaVconnectionHub *hub,
hc->cnc = cnc;
g_object_ref (cnc);
hc->ns = ns ? g_strdup (ns) : NULL;
-
+
if (!attach_hub_connection (hub, hc, error)) {
hub_connection_free (hc);
return FALSE;
@@ -204,7 +204,7 @@ gda_vconnection_hub_remove (GdaVconnectionHub *hub, GdaConnection *cnc, GError *
hc = get_hub_cnc_by_cnc (hub, cnc);
if (!hc) {
- g_set_error (error, 0, 0, "%s",
+ g_set_error (error, 0, 0, "%s",
_("Connection was not represented in hub"));
return FALSE;
}
@@ -219,7 +219,7 @@ get_hub_cnc_by_ns (GdaVconnectionHub *hub, const gchar *ns)
{
GSList *list;
for (list = hub->priv->hub_connections; list; list = list->next) {
- if ((!ns && !((HubConnection*) list->data)->ns)||
+ if ((!ns && !((HubConnection*) list->data)->ns)||
(ns && ((HubConnection*) list->data)->ns && !strcmp (((HubConnection*) list->data)->ns, ns)))
return (HubConnection*) list->data;
}
@@ -269,7 +269,7 @@ gda_vconnection_hub_get_connection (GdaVconnectionHub *hub, const gchar *ns)
* Call @func for each #GdaConnection represented in @hub.
*/
void
-gda_vconnection_hub_foreach (GdaVconnectionHub *hub,
+gda_vconnection_hub_foreach (GdaVconnectionHub *hub,
GdaVConnectionHubFunc func, gpointer data)
{
GSList *list, *next;
@@ -329,7 +329,7 @@ compute_column_specs (GdaVconnectionDataModelSpec *spec)
if (lspec->col_names)
return;
- model = gda_connection_get_meta_store_data (lspec->hc->cnc,
+ model = gda_connection_get_meta_store_data (lspec->hc->cnc,
GDA_CONNECTION_META_FIELDS, NULL, 1, "name", lspec->table_name);
if (!model)
return;
@@ -508,7 +508,7 @@ dict_table_create_filter (GdaVconnectionDataModelSpec *spec, GdaVconnectionDataM
gda_sql_builder_set_where (b, whid);
}
g_free (op_ids);
-
+
/* ORDER BY part */
info->orderByConsumed = FALSE;
for (i = 0; i < info->nOrderBy; i++) {
@@ -550,7 +550,7 @@ dict_table_create_filter (GdaVconnectionDataModelSpec *spec, GdaVconnectionDataM
lspec->filters_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify) computed_filter_free);
-
+
g_hash_table_insert (lspec->filters_hash, hash, filter);
info->idxPointer = filter->stmt;
/*g_print ("There are now %d statements in store...\n", g_hash_table_size (lspec->filters_hash));*/
@@ -717,7 +717,7 @@ create_value_from_sqlite3_gvalue (GType type, GValue *svalue, GError **error)
}
static GdaDataModel *
-dict_table_create_model_func (GdaVconnectionDataModelSpec *spec, int idxNum, const char *idxStr,
+dict_table_create_model_func (GdaVconnectionDataModelSpec *spec, G_GNUC_UNUSED int idxNum, const char *idxStr,
int argc, GValue **argv)
{
GdaDataModel *model;
@@ -732,7 +732,7 @@ dict_table_create_model_func (GdaVconnectionDataModelSpec *spec, int idxNum, con
if (! gda_statement_get_parameters (stmt, ¶ms, NULL))
return NULL;
if (argc > 0) {
- g_assert (params && (argc == g_slist_length (params->holders)));
+ g_assert (params && ((guint)argc == g_slist_length (params->holders)));
for (i = 0, list = params->holders; i < argc; i++, list = list->next) {
GdaHolder *holder = GDA_HOLDER (list->data);
GValue *value;
@@ -779,7 +779,7 @@ dict_table_create_model_func (GdaVconnectionDataModelSpec *spec, int idxNum, con
g_object_unref (stmt);
if (params)
g_object_unref (params);
- if (model)
+ if (model)
gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), NULL);
else {
gda_log_message ("Virtual table: data model error: %s",
@@ -800,7 +800,7 @@ attach_hub_connection (GdaVconnectionHub *hub, HubConnection *hc, GError **error
GdaMetaStore *store;
GdaMetaContext context;
GdaConnectionOptions options;
-
+
store = gda_connection_get_meta_store (hc->cnc);
g_assert (store);
g_object_get ((GObject*) hc->cnc, "options", &options, NULL);
@@ -876,7 +876,7 @@ meta_changed_cb (G_GNUC_UNUSED GdaMetaStore *store, GSList *changes, HubConnecti
for (list = changes; list; list = list->next) {
GdaMetaStoreChange *ch = (GdaMetaStoreChange*) list->data;
GValue *tsn, *tn;
-
+
/* we are only intsrested in changes occurring in the "_tables" table */
if (!strcmp (ch->table_name, "_tables")) {
switch (ch->c_type) {
@@ -931,7 +931,7 @@ table_add (HubConnection *hc, const GValue *table_name, GError **error)
lspec->table_name = gda_value_copy (table_name);
lspec->hc = hc;
tmp = get_complete_table_name (hc, lspec->table_name);
- if (!gda_vconnection_data_model_add (GDA_VCONNECTION_DATA_MODEL (hc->hub), (GdaVconnectionDataModelSpec*) lspec,
+ if (!gda_vconnection_data_model_add (GDA_VCONNECTION_DATA_MODEL (hc->hub), (GdaVconnectionDataModelSpec*) lspec,
(GDestroyNotify) local_spec_free, tmp, error)) {
g_free (tmp);
return FALSE;
@@ -984,7 +984,7 @@ detach_hub_connection (GdaVconnectionHub *hub, HubConnection *hc)
g_assert (stmt);
gda_connection_statement_execute_non_select (GDA_CONNECTION (hub), stmt, NULL, NULL, NULL);
g_object_unref (stmt);
- }
+ }
hub->priv->hub_connections = g_slist_remove (hub->priv->hub_connections, hc);
hub_connection_free (hc);
diff --git a/libgda/sqlite/virtual/gda-virtual-provider.c b/libgda/sqlite/virtual/gda-virtual-provider.c
index bebc453..e2f711c 100644
--- a/libgda/sqlite/virtual/gda-virtual-provider.c
+++ b/libgda/sqlite/virtual/gda-virtual-provider.c
@@ -51,7 +51,7 @@ gda_virtual_provider_class_init (GdaVirtualProviderClass *klass)
}
static void
-gda_virtual_provider_init (GdaVirtualProvider *vprov, G_GNUC_UNUSED GdaVirtualProviderClass *klass)
+gda_virtual_provider_init (G_GNUC_UNUSED GdaVirtualProvider *vprov, G_GNUC_UNUSED GdaVirtualProviderClass *klass)
{
}
@@ -92,7 +92,7 @@ gda_virtual_provider_get_type (void)
(GInstanceInitFunc) gda_virtual_provider_init,
0
};
-
+
g_static_mutex_lock (®istering);
if (type == 0)
type = g_type_register_static (PARENT_TYPE, "GdaVirtualProvider", &info, G_TYPE_FLAG_ABSTRACT);
diff --git a/tests/providers/prov-test-common.h b/tests/providers/prov-test-common.h
index f8e130f..2a1c90b 100644
--- a/tests/providers/prov-test-common.h
+++ b/tests/providers/prov-test-common.h
@@ -23,9 +23,9 @@
#include <libgda/libgda.h>
#include "prov-test-util.h"
-#define fail(x) g_warning (x)
-#define fail_if(x,y) if (x) g_warning (y)
-#define fail_unless(x,y) if (!(x)) g_warning (y)
+#define fail(x) g_warning ("%s", x)
+#define fail_if(x,y) if (x) g_warning ("%s", y)
+#define fail_unless(x,y) if (!(x)) g_warning ("%s", y)
int prov_test_common_setup ();
int prov_test_common_load_data ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]