[libgda] Gda-Sql correction



commit 9ed36f89aed2fe344af0e965f30747fb3009dfbe
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 89c465a..f6eefab 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]