[gnome-db] A patch for nothing in particular
- From: Paisa Seeluangsawat <paisa unt edu>
- To: gnome-db-list gnome org
- Subject: [gnome-db] A patch for nothing in particular
- Date: Thu, 13 Nov 2003 00:58:12 -0600
I'm trying to work on parts that are not dependent on update syntax
for now. Here's an errand patch. This weekend, I'll work on,
- remove const from GdaRow* and GdaValue*, and other glib/libgda structs
I see along the way.
- implement is_null
If anyone objects to these two ideas, please speak NOW. You hear
it...now, not after the patch come...please.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgda/ChangeLog,v
retrieving revision 1.587
diff -u -r1.587 ChangeLog
--- ChangeLog 12 Nov 2003 15:56:14 -0000 1.587
+++ ChangeLog 13 Nov 2003 06:20:35 -0000
@@ -1,3 +1,21 @@
+2003-11-12 Paisa Seeluangsawat <paisa users sf net>
+
+ * libgda/gda-blob.c:
+ * libgda/gda-connection.c:
+ * libgda/gda-log.c:
+ * libgda/gda-select.[ch]:
+ * libgda/gda-util.c:
+ trivial fixes to stop some compiler warnings (gcc 3.2.2)
+
+ * libgda/gda-row.c:
+ (gda_row_new_from_list): updated doc comment.
+
+ * libgda/gda-data-model.c: updated a doc comment.
+ (gda_data_model_foreach): stop the loop when user function returns
+ FALSE (as advertised in the spec). No longer clones the GdaRows
+ sent to user's callback.
+
+
2003-11-12 Gonzalo Paniagua Javier <gonzalo gnome-db org>
* libgda/gda-value.c: fixed gda_value_copy for GdaNumeric. Patch by
Index: libgda/gda-blob.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-blob.c,v
retrieving revision 1.2
diff -u -r1.2 gda-blob.c
--- libgda/gda-blob.c 16 Aug 2003 20:38:55 -0000 1.2
+++ libgda/gda-blob.c 13 Nov 2003 06:20:35 -0000
@@ -158,9 +158,9 @@
void
gda_blob_free_data (GdaBlob *blob)
{
- g_return_val_if_fail (blob != NULL, -1);
+ g_return_if_fail (blob != NULL);
g_return_if_fail (blob->free_data != NULL);
- return blob->free_data (blob);
+ blob->free_data (blob);
}
Index: libgda/gda-connection.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-connection.c,v
retrieving revision 1.51
diff -u -r1.51 gda-connection.c
--- libgda/gda-connection.c 18 Oct 2003 23:03:52 -0000 1.51
+++ libgda/gda-connection.c 13 Nov 2003 06:20:36 -0000
@@ -207,7 +207,7 @@
GdaDataSourceInfo *dsn_info;
GdaQuarkList *params;
const char *real_username = NULL;
- const char *real_password = NULL;
+ char *real_password = NULL;
g_return_val_if_fail (GDA_IS_CLIENT (client), NULL);
g_return_val_if_fail (GDA_IS_SERVER_PROVIDER (provider), NULL);
@@ -228,7 +228,7 @@
if (dsn_info->username)
real_username = g_strdup (dsn_info->username);
else {
- gchar *s;
+ const gchar *s;
s = gda_quark_list_find (params, "USER");
if (s) {
real_username = g_strdup (s);
@@ -243,7 +243,7 @@
if (dsn_info->password)
real_password = g_strdup (dsn_info->password);
else {
- gchar *s;
+ const gchar *s;
s = gda_quark_list_find (params, "PASSWORD");
if (s) {
real_password = g_strdup (s);
Index: libgda/gda-data-model.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-data-model.c,v
retrieving revision 1.39
diff -u -r1.39 gda-data-model.c
--- libgda/gda-data-model.c 26 Oct 2003 20:39:37 -0000 1.39
+++ libgda/gda-data-model.c 13 Nov 2003 06:20:36 -0000
@@ -555,7 +555,9 @@
/**
* gda_data_model_append_row
* @model: a #GdaDataModel object.
- * @values: the row to add.
+ * @values: #GList of #GdaValue* representing the row to add. The
+ * length must match model's column count. These #GdaValue
+ * are value-copied. The user is still responsible for freeing them.
*
* Appends a row to the given data model.
*
@@ -634,29 +636,20 @@
GdaDataModelForeachFunc func,
gpointer user_data)
{
- gint cols;
gint rows;
- gint c, r;
+ gint r;
GdaRow *row;
+ gboolean more;
g_return_if_fail (GDA_IS_DATA_MODEL (model));
g_return_if_fail (func != NULL);
rows = gda_data_model_get_n_rows (model);
- cols = gda_data_model_get_n_columns (model);
-
- for (r = 0; r < rows; r++) {
- row = gda_row_new (model, cols);
- for (c = 0; c < cols; c++) {
- GdaValue *value;
- value = gda_value_copy (gda_data_model_get_value_at (model, c, r));
- memcpy (gda_row_get_value (row, c), value, sizeof (GdaValue));
- }
-
+ more = TRUE;
+ for (r = 0; more && r < rows ; r++) {
+ row = gda_data_model_get_row (model, r);
/* call the callback function */
- func (model, row, user_data);
-
- gda_row_free (row);
+ more = func (model, row, user_data);
}
}
Index: libgda/gda-log.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-log.c,v
retrieving revision 1.8
diff -u -r1.8 gda-log.c
--- libgda/gda-log.c 18 Oct 2003 23:03:52 -0000 1.8
+++ libgda/gda-log.c 13 Nov 2003 06:20:36 -0000
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <syslog.h>
#include <time.h>
+#include <glib/gmem.h>
#include <glib/gmessages.h>
#include <glib/gstrfuncs.h>
#include <glib/gutils.h>
Index: libgda/gda-row.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-row.c,v
retrieving revision 1.36
diff -u -r1.36 gda-row.c
--- libgda/gda-row.c 11 Nov 2003 16:48:36 -0000 1.36
+++ libgda/gda-row.c 13 Nov 2003 06:20:36 -0000
@@ -48,7 +48,7 @@
* @model: the #GdaDataModel this row belongs to.
* @count: number of #GdaValue in the new #GdaRow.
*
- * Creates a #GdaRow which can hold @count #GdaValue.
+ * Creates a #GdaRow from a list of #GdaValue's.
*
* Returns: the newly allocated #GdaRow.
*/
@@ -74,7 +74,8 @@
* @model: a #GdaDataModel.
* @values: a list of #GdaValue's.
*
- * Creates a #GdaRow from a list of #GdaValue's.
+ * Creates a #GdaRow from a list of #GdaValue's. These GdaValue's are
+ * value-copied and the user are still resposible for freeing them.
*
* Returns: the newly created row.
*/
Index: libgda/gda-select.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-select.c,v
retrieving revision 1.12
diff -u -r1.12 gda-select.c
--- libgda/gda-select.c 18 Oct 2003 23:03:52 -0000 1.12
+++ libgda/gda-select.c 13 Nov 2003 06:20:36 -0000
@@ -233,7 +233,7 @@
* and get the required data from the source data models.
*/
void
-gda_select_add_source (GdaSelect *sel, const gchar *name, const GdaDataModel *source)
+gda_select_add_source (GdaSelect *sel, const gchar *name, GdaDataModel *source)
{
gpointer key, value;
Index: libgda/gda-select.h
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-select.h,v
retrieving revision 1.5
diff -u -r1.5 gda-select.h
--- libgda/gda-select.h 10 Oct 2002 23:06:14 -0000 1.5
+++ libgda/gda-select.h 13 Nov 2003 06:20:36 -0000
@@ -48,7 +48,7 @@
GType gda_select_get_type (void);
GdaDataModel *gda_select_new (void);
-void gda_select_add_source (GdaSelect *sel, const gchar *name, const GdaDataModel *source);
+void gda_select_add_source (GdaSelect *sel, const gchar *name, GdaDataModel *source);
void gda_select_set_sql (GdaSelect *sel, const gchar *sql);
gboolean gda_select_run (GdaSelect *sel);
Index: libgda/gda-util.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-util.c,v
retrieving revision 1.15
diff -u -r1.15 gda-util.c
--- libgda/gda-util.c 18 Oct 2003 23:03:52 -0000 1.15
+++ libgda/gda-util.c 13 Nov 2003 06:20:36 -0000
@@ -143,7 +143,6 @@
gchar *
gda_sql_replace_placeholders (const gchar *sql, GdaParameterList *params)
{
- GString *str;
sql_statement *sql_stmt;
g_return_val_if_fail (sql != NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]