[libgda/LIBGDA_4.2] Gda-Sql correction



commit 09ff05b5f5c9b2b488ffef713a20960118f5c8e1
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri May 27 18:29:02 2011 +0200

    Gda-Sql correction

 tools/command-exec.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/tools/command-exec.c b/tools/command-exec.c
index ddcee88..c039dbc 100644
--- a/tools/command-exec.c
+++ b/tools/command-exec.c
@@ -618,17 +618,23 @@ gda_internal_command_detail (G_GNUC_UNUSED SqlConsole *console, GdaConnection *c
 			"ORDER BY table_schema, table_name";
 		model = gda_meta_store_extract (gda_connection_get_meta_store (cnc), sql, error, NULL);
 
-		/* if no row, then return all the objects from all the schemas */
-		if (model && (gda_data_model_get_n_rows (model) == 0)) {
-			g_object_unref (model);
-			sql = "SELECT table_schema AS Schema, table_name AS Name, table_type as Type, "
-			"table_owner as Owner FROM _tables "
-			"ORDER BY table_schema, table_name";
-			model = gda_meta_store_extract (gda_connection_get_meta_store (cnc), sql, error, NULL);
+		if (model) {
+			/* if no row, then return all the objects from all the schemas */
+			if (gda_data_model_get_n_rows (model) == 0) {
+				g_object_unref (model);
+				sql = "SELECT table_schema AS Schema, table_name AS Name, table_type as Type, "
+					"table_owner as Owner FROM _tables "
+					"ORDER BY table_schema, table_name";
+				model = gda_meta_store_extract (gda_connection_get_meta_store (cnc), sql, error, NULL);
+			}
+			res = g_new0 (GdaInternalCommandResult, 1);
+			res->type = GDA_INTERNAL_COMMAND_RESULT_DATA_MODEL;
+			res->u.model = model;
+		}
+		else {
+			res = g_new0 (GdaInternalCommandResult, 1);
+			res->type = GDA_INTERNAL_COMMAND_RESULT_EMPTY;
 		}
-		res = g_new0 (GdaInternalCommandResult, 1);
-		res->type = GDA_INTERNAL_COMMAND_RESULT_DATA_MODEL;
-		res->u.model = model;
 		return res;
 	}
 



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