[libgda] Misc. corrections



commit 100c9d78c33e941359885854ac9713103371fb71
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Nov 25 20:40:55 2009 +0100

    Misc. corrections

 libgda/gda-connection.c                            |    5 ++
 libgda/gda-value.c                                 |    6 +++
 libgda/providers-support/gda-meta-column-types.h   |   48 ++++++++++----------
 providers/jdbc/gda-jdbc-recordset.c                |    4 +-
 providers/oracle/gda-oracle-recordset.c            |    4 +-
 providers/postgres/gda-postgres-recordset.c        |    4 +-
 providers/reuseable/postgres/Makefile.am           |    4 +-
 .../skel-implementation/capi/gda-capi-recordset.c  |    4 +-
 providers/web/gda-web-provider.c                   |    1 +
 providers/web/gda-web-recordset.c                  |    4 +-
 tools/information-schema-types.c                   |    4 +-
 11 files changed, 55 insertions(+), 33 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index 359ce6f..fb135cc 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -1202,8 +1202,13 @@ gda_connection_open_sqlite (const gchar *directory, const gchar *filename, gbool
 	g_return_val_if_fail (filename && *filename, NULL);
 
 	fname = g_build_filename (directory, filename, NULL);
+#ifdef G_OS_WIN32
+	fd = g_open (fname, O_WRONLY | O_CREAT | O_TRUNC,
+		     S_IRUSR | S_IWUSR);
+#else
 	fd = g_open (fname, O_WRONLY | O_CREAT | O_NOCTTY | O_TRUNC,
 		     S_IRUSR | S_IWUSR);
+#endif
 	if (fd == -1) {
 		g_free (fname);
 		return NULL;
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index c5dcc55..797d1e7 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -71,6 +71,12 @@ set_from_string (GValue *value, const gchar *as_string)
 			g_value_set_boolean (value, FALSE);
 			retval = TRUE;
 		}
+		else {
+			gint i;
+			i = atoi (as_string);
+			g_value_set_boolean (value, i ? TRUE : FALSE);
+			retval = TRUE;
+		}
 	}
 	else if (type == G_TYPE_INT64) {
 		gint64 i64;
diff --git a/libgda/providers-support/gda-meta-column-types.h b/libgda/providers-support/gda-meta-column-types.h
index 4b2eb10..b59894b 100644
--- a/libgda/providers-support/gda-meta-column-types.h
+++ b/libgda/providers-support/gda-meta-column-types.h
@@ -14,7 +14,7 @@
  *
  * Table to store (key,value) pairs (keys starting with '_' are reserved)
  */
-GType _col_types_attributes[] = {
+static GType _col_types_attributes[] = {
   G_TYPE_STRING  /* column: att_name */
 , G_TYPE_STRING  /* column: att_value */
 , G_TYPE_NONE /* end of array marker */
@@ -27,7 +27,7 @@ GType _col_types_attributes[] = {
  *
  * Name of the current database (current catalog), has only one row
  */
-GType _col_types_information_schema_catalog_name[] = {
+static GType _col_types_information_schema_catalog_name[] = {
   G_TYPE_STRING  /* column: catalog_name */
 , G_TYPE_NONE /* end of array marker */
 };
@@ -39,7 +39,7 @@ GType _col_types_information_schema_catalog_name[] = {
  *
  * List of schemas
  */
-GType _col_types_schemata[] = {
+static GType _col_types_schemata[] = {
   G_TYPE_STRING  /* column: catalog_name */
 , G_TYPE_STRING  /* column: schema_name */
 , G_TYPE_STRING  /* column: schema_owner */
@@ -54,7 +54,7 @@ GType _col_types_schemata[] = {
  *
  * List of built-in data types such as varchar, int, ...
  */
-GType _col_types_builtin_data_types[] = {
+static GType _col_types_builtin_data_types[] = {
   G_TYPE_STRING  /* column: short_type_name */
 , G_TYPE_STRING  /* column: full_type_name */
 , G_TYPE_STRING  /* column: gtype */
@@ -71,7 +71,7 @@ GType _col_types_builtin_data_types[] = {
  *
  * User defined data types
  */
-GType _col_types_udt[] = {
+static GType _col_types_udt[] = {
   G_TYPE_STRING  /* column: udt_catalog */
 , G_TYPE_STRING  /* column: udt_schema */
 , G_TYPE_STRING  /* column: udt_name */
@@ -91,7 +91,7 @@ GType _col_types_udt[] = {
  *
  * List of components for a user defined data type for composed data types (such as a complex number data type which has real and imaginary parts)
  */
-GType _col_types_udt_columns[] = {
+static GType _col_types_udt_columns[] = {
   G_TYPE_STRING  /* column: udt_catalog */
 , G_TYPE_STRING  /* column: udt_schema */
 , G_TYPE_STRING  /* column: udt_name */
@@ -120,7 +120,7 @@ GType _col_types_udt_columns[] = {
  *
  * List of possible enumeration labels for enumerations
  */
-GType _col_types_enums[] = {
+static GType _col_types_enums[] = {
   G_TYPE_STRING  /* column: udt_catalog */
 , G_TYPE_STRING  /* column: udt_schema */
 , G_TYPE_STRING  /* column: udt_name */
@@ -136,7 +136,7 @@ GType _col_types_enums[] = {
  *
  * Array specific attributes for array data types
  */
-GType _col_types_element_types[] = {
+static GType _col_types_element_types[] = {
   G_TYPE_STRING  /* column: specific_name */
 , G_TYPE_STRING  /* column: object_catalog */
 , G_TYPE_STRING  /* column: object_schema */
@@ -156,7 +156,7 @@ GType _col_types_element_types[] = {
  *
  * List of domains
  */
-GType _col_types_domains[] = {
+static GType _col_types_domains[] = {
   G_TYPE_STRING  /* column: domain_catalog */
 , G_TYPE_STRING  /* column: domain_schema */
 , G_TYPE_STRING  /* column: domain_name */
@@ -189,7 +189,7 @@ GType _col_types_domains[] = {
  *
  * List of tables (tables, views or other objects which can contain data)
  */
-GType _col_types_tables[] = {
+static GType _col_types_tables[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -209,7 +209,7 @@ GType _col_types_tables[] = {
  *
  * List of views and their specific information
  */
-GType _col_types_views[] = {
+static GType _col_types_views[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -226,7 +226,7 @@ GType _col_types_views[] = {
  *
  * List of collations methods
  */
-GType _col_types_collations[] = {
+static GType _col_types_collations[] = {
   G_TYPE_STRING  /* column: collation_catalog */
 , G_TYPE_STRING  /* column: collation_schema */
 , G_TYPE_STRING  /* column: collation_name */
@@ -243,7 +243,7 @@ GType _col_types_collations[] = {
  *
  * List of character sets
  */
-GType _col_types_character_sets[] = {
+static GType _col_types_character_sets[] = {
   G_TYPE_STRING  /* column: character_set_catalog */
 , G_TYPE_STRING  /* column: character_set_schema */
 , G_TYPE_STRING  /* column: character_set_name */
@@ -263,7 +263,7 @@ GType _col_types_character_sets[] = {
  *
  * List of functions and stored procedures (note: the primary jey for that table is composed of (specific_catalog, specific_schema, specific_name))
  */
-GType _col_types_routines[] = {
+static GType _col_types_routines[] = {
   G_TYPE_STRING  /* column: specific_catalog */
 , G_TYPE_STRING  /* column: specific_schema */
 , G_TYPE_STRING  /* column: specific_name */
@@ -296,7 +296,7 @@ GType _col_types_routines[] = {
  *
  * List of triggers
  */
-GType _col_types_triggers[] = {
+static GType _col_types_triggers[] = {
   G_TYPE_STRING  /* column: trigger_catalog */
 , G_TYPE_STRING  /* column: trigger_schema */
 , G_TYPE_STRING  /* column: trigger_name */
@@ -320,7 +320,7 @@ GType _col_types_triggers[] = {
  *
  * List of columns composing tables
  */
-GType _col_types_columns[] = {
+static GType _col_types_columns[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -355,7 +355,7 @@ GType _col_types_columns[] = {
  *
  * List of constraints applied to tables (Check, primary or foreign key, or unique constraints)
  */
-GType _col_types_table_constraints[] = {
+static GType _col_types_table_constraints[] = {
   G_TYPE_STRING  /* column: constraint_catalog */
 , G_TYPE_STRING  /* column: constraint_schema */
 , G_TYPE_STRING  /* column: constraint_name */
@@ -376,7 +376,7 @@ GType _col_types_table_constraints[] = {
  *
  * List of foreign key constraints, along with some specific attributes
  */
-GType _col_types_referential_constraints[] = {
+static GType _col_types_referential_constraints[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -398,7 +398,7 @@ GType _col_types_referential_constraints[] = {
  *
  * List of primary key constraints and the name of the tables' columns involved
  */
-GType _col_types_key_column_usage[] = {
+static GType _col_types_key_column_usage[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -415,7 +415,7 @@ GType _col_types_key_column_usage[] = {
  *
  * List of check constraints and the name of the tables' columns involved
  */
-GType _col_types_check_column_usage[] = {
+static GType _col_types_check_column_usage[] = {
   G_TYPE_STRING  /* column: table_catalog */
 , G_TYPE_STRING  /* column: table_schema */
 , G_TYPE_STRING  /* column: table_name */
@@ -431,7 +431,7 @@ GType _col_types_check_column_usage[] = {
  *
  * List of the tables' columns involved in a view
  */
-GType _col_types_view_column_usage[] = {
+static GType _col_types_view_column_usage[] = {
   G_TYPE_STRING  /* column: view_catalog */
 , G_TYPE_STRING  /* column: view_schema */
 , G_TYPE_STRING  /* column: view_name */
@@ -449,7 +449,7 @@ GType _col_types_view_column_usage[] = {
  *
  * List of constraints applicable to domains
  */
-GType _col_types_domain_constraints[] = {
+static GType _col_types_domain_constraints[] = {
   G_TYPE_STRING  /* column: constraint_catalog */
 , G_TYPE_STRING  /* column: constraint_schema */
 , G_TYPE_STRING  /* column: constraint_name */
@@ -469,7 +469,7 @@ GType _col_types_domain_constraints[] = {
  *
  * List of routines' (functions and stored procedures) parameters (may not contain data for some routines which accept any type of parameter)
  */
-GType _col_types_parameters[] = {
+static GType _col_types_parameters[] = {
   G_TYPE_STRING  /* column: specific_catalog */
 , G_TYPE_STRING  /* column: specific_schema */
 , G_TYPE_STRING  /* column: specific_name */
@@ -488,7 +488,7 @@ GType _col_types_parameters[] = {
  *
  * List of routines' (functions and stored procedures) returned values' parts (columns) for routines returning composed values
  */
-GType _col_types_routine_columns[] = {
+static GType _col_types_routine_columns[] = {
   G_TYPE_STRING  /* column: specific_catalog */
 , G_TYPE_STRING  /* column: specific_schema */
 , G_TYPE_STRING  /* column: specific_name */
diff --git a/providers/jdbc/gda-jdbc-recordset.c b/providers/jdbc/gda-jdbc-recordset.c
index 7eb891a..8db5c33 100644
--- a/providers/jdbc/gda-jdbc-recordset.c
+++ b/providers/jdbc/gda-jdbc-recordset.c
@@ -274,9 +274,11 @@ gda_jdbc_recordset_new (GdaConnection *cnc, GdaJdbcPStmt *ps, GdaSet *exec_param
 				if (col_types [i] > 0) {
 					if (col_types [i] == G_TYPE_NONE)
 						break;
-					if (i >= _GDA_PSTMT (ps)->ncols)
+					if (i >= _GDA_PSTMT (ps)->ncols) {
 						g_warning (_("Column %d out of range (0-%d), ignoring its specified type"), i,
 							   _GDA_PSTMT (ps)->ncols - 1);
+						break;
+					}
 					else
 						_GDA_PSTMT (ps)->types [i] = col_types [i];
 				}
diff --git a/providers/oracle/gda-oracle-recordset.c b/providers/oracle/gda-oracle-recordset.c
index bbf6b18..9b0507c 100644
--- a/providers/oracle/gda-oracle-recordset.c
+++ b/providers/oracle/gda-oracle-recordset.c
@@ -230,9 +230,11 @@ gda_oracle_recordset_new (GdaConnection *cnc, GdaOraclePStmt *ps, GdaSet *exec_p
 				if (col_types [i] > 0) {
 					if (col_types [i] == G_TYPE_NONE)
 						break;
-					if (i >= _GDA_PSTMT (ps)->ncols)
+					if (i >= _GDA_PSTMT (ps)->ncols) {
 						g_warning (_("Column %d out of range (0-%d), ignoring its specified type"), i,
 							   _GDA_PSTMT (ps)->ncols - 1);
+						break;
+					}
 					else
 						_GDA_PSTMT (ps)->types [i] = col_types [i];
 				}
diff --git a/providers/postgres/gda-postgres-recordset.c b/providers/postgres/gda-postgres-recordset.c
index 5843988..be62605 100644
--- a/providers/postgres/gda-postgres-recordset.c
+++ b/providers/postgres/gda-postgres-recordset.c
@@ -273,9 +273,11 @@ finish_prep_stmt_init (PostgresConnectionData *cdata, GdaPostgresPStmt *ps, PGre
 				if (col_types [i] > 0) {
 					if (col_types [i] == G_TYPE_NONE)
 						break;
-					if (i >= _GDA_PSTMT (ps)->ncols)
+					if (i >= _GDA_PSTMT (ps)->ncols) {
 						g_warning (_("Column %d out of range (0-%d), ignoring its specified type"), i,
 							   _GDA_PSTMT (ps)->ncols - 1);
+						break;
+					}
 					else
 						_GDA_PSTMT (ps)->types [i] = col_types [i];
 				}
diff --git a/providers/reuseable/postgres/Makefile.am b/providers/reuseable/postgres/Makefile.am
index 88e3132..c6efa21 100644
--- a/providers/reuseable/postgres/Makefile.am
+++ b/providers/reuseable/postgres/Makefile.am
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir) \
 	-I$(top_srcdir)/libgda \
 	-I$(top_builddir) \
-	$(LIBGDA_CFLAGS) $(POSTGRES_CFLAGS) 
+	$(LIBGDA_CFLAGS)
 
 keyword_files=keywords_82.list keywords_83.list keywords_84.list
 pkeyword_files=$(addprefix $(top_srcdir)/providers/reuseable/postgres/,$(keyword_files))
@@ -42,7 +42,7 @@ libgda_postgres_la_SOURCES = \
 
 libgda_postgres_la_LIBADD = \
 	$(top_builddir)/libgda/libgda-4.0.la \
-	$(LIBGDA_LIBS) $(POSTGRES_LIBS)
+	$(LIBGDA_LIBS)
 
 EXTRA_DIST = parser.y gen_def.c $(keyword_files)
 CLEANFILES = parser.h parser.c parser.out postgres_token_types.h gen_def$(EXEEXT_FOR_BUILD) \
diff --git a/providers/skel-implementation/capi/gda-capi-recordset.c b/providers/skel-implementation/capi/gda-capi-recordset.c
index 6b378e9..4a02b81 100644
--- a/providers/skel-implementation/capi/gda-capi-recordset.c
+++ b/providers/skel-implementation/capi/gda-capi-recordset.c
@@ -174,9 +174,11 @@ gda_capi_recordset_new (GdaConnection *cnc, GdaCapiPStmt *ps, GdaSet *exec_param
 				if (col_types [i] > 0) {
 					if (col_types [i] == G_TYPE_NONE)
 						break;
-					if (i >= _GDA_PSTMT (ps)->ncols)
+					if (i >= _GDA_PSTMT (ps)->ncols) {
 						g_warning (_("Column %d out of range (0-%d), ignoring its specified type"), i,
 							   _GDA_PSTMT (ps)->ncols - 1);
+						break;
+					}
 					else
 						_GDA_PSTMT (ps)->types [i] = col_types [i];
 				}
diff --git a/providers/web/gda-web-provider.c b/providers/web/gda-web-provider.c
index 4841bda..b2b493f 100644
--- a/providers/web/gda-web-provider.c
+++ b/providers/web/gda-web-provider.c
@@ -1200,6 +1200,7 @@ gda_web_provider_statement_prepare (GdaServerProvider *provider, GdaConnection *
 	else if (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_UNKNOWN) {
 		if (! g_ascii_strncasecmp (sql, "select", 6) ||
 		    ! g_ascii_strncasecmp (sql, "pragma", 6) ||
+		    ! g_ascii_strncasecmp (sql, "show", 4) ||
 		    ! g_ascii_strncasecmp (sql, "describe", 8))
 			xmlSetProp (node, BAD_CAST "type", BAD_CAST "SELECT");
 	}
diff --git a/providers/web/gda-web-recordset.c b/providers/web/gda-web-recordset.c
index 910c119..6ed3450 100644
--- a/providers/web/gda-web-recordset.c
+++ b/providers/web/gda-web-recordset.c
@@ -213,9 +213,11 @@ gda_web_recordset_new (GdaConnection *cnc, GdaWebPStmt *ps, GdaSet *exec_params,
 				if (col_types [i] > 0) {
 					if (col_types [i] == G_TYPE_NONE)
 						break;
-					if (i >= _GDA_PSTMT (ps)->ncols)
+					if (i >= _GDA_PSTMT (ps)->ncols) {
 						g_warning (_("Column %d out of range (0-%d), ignoring its specified type"), i,
 							   _GDA_PSTMT (ps)->ncols - 1);
+						break;
+					}
 					else
 						_GDA_PSTMT (ps)->types [i] = col_types [i];
 				}
diff --git a/tools/information-schema-types.c b/tools/information-schema-types.c
index 311241c..bc3539e 100644
--- a/tools/information-schema-types.c
+++ b/tools/information-schema-types.c
@@ -23,7 +23,7 @@
 #include <libxml/tree.h>
 #include <glib-object.h>
 #include <libgda/binreloc/gda-binreloc.h>
-#include <libgda/gda-util.h>
+#include <libgda/libgda.h>
 #include <string.h>
 
 #define FILE_NAME "information_schema.xml"
@@ -88,7 +88,7 @@ main (int argc, char** argv)
 					g_string_append_printf (out_str, "/*\n * TABLE: %s\n */\n",
 								(gchar*) prop);
 				g_string_append_printf (out_str,
-							"GType _col_types%s[] = {\n", prop);
+							"static GType _col_types%s[] = {\n", prop);
 				xmlFree (prop);
 			}
 			else {



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