[libgda] Using GdaDdlModifiable interface



commit 6930541cdedc0d90d3c198376860c0190d6940f5
Author: Pavlo Solntsev <p sun fun gmail com>
Date:   Thu May 28 09:41:59 2020 -0500

    Using GdaDdlModifiable interface

 libgda/gda-db-catalog.c                  |  5 +++--
 tests/db/check-db-catalog-postgresql.c   |  6 +++---
 tests/test-server-operation-postgresql.c | 17 +++++++++--------
 3 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/libgda/gda-db-catalog.c b/libgda/gda-db-catalog.c
index 0f0c0503e..2b8fd268d 100644
--- a/libgda/gda-db-catalog.c
+++ b/libgda/gda-db-catalog.c
@@ -36,6 +36,7 @@
 #include "gda-server-provider.h"
 #include <libgda/gda-lockable.h>
 #include "gda-meta-struct.h"
+#include "gda-ddl-modifiable.h"
 
 G_DEFINE_QUARK (gda_db_catalog_error, gda_db_catalog_error)
 
@@ -905,7 +906,7 @@ gda_db_catalog_perform_operation (GdaDbCatalog *self,
                                }
                        else
                                {
-                                       st = gda_db_table_create (it->data,priv->cnc, TRUE, error);
+                                       st = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (it->data), 
priv->cnc, NULL, error);
 
                                        if (!st)
                                                break;
@@ -919,7 +920,7 @@ gda_db_catalog_perform_operation (GdaDbCatalog *self,
   if (st) {
   /*TODO: add update option for views */
     for (it = priv->mp_views; it; it = it->next) {
-        st = gda_db_view_create (it->data, priv->cnc, TRUE, error);
+        st = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (it->data), priv->cnc, NULL, error);
         if (!st) {
           break;
         }
diff --git a/tests/db/check-db-catalog-postgresql.c b/tests/db/check-db-catalog-postgresql.c
index 6d81bb818..0e46b1550 100644
--- a/tests/db/check-db-catalog-postgresql.c
+++ b/tests/db/check-db-catalog-postgresql.c
@@ -86,7 +86,7 @@ static void create_users_table (CheckDbObject *self) {
   gda_db_table_append_column (table, column_ts);
 
   gda_db_catalog_append_table (self->catalog, table);
-  res = gda_db_table_create (table, self->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (table), self->cnc, NULL, &error);
 
   g_object_unref (table);
   g_object_unref (column_id);
@@ -154,7 +154,7 @@ static void create_companies_table (CheckDbObject *self) {
   gda_db_table_append_column (table, column_ts);
 
   gda_db_catalog_append_table (self->catalog, table);
-  res = gda_db_table_create (table, self->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (table), self->cnc, NULL, &error);
 
   g_object_unref (table);
   g_object_unref (column_id);
@@ -223,7 +223,7 @@ static void create_countries_table (CheckDbObject *self) {
   gda_db_table_append_column (table, column_ts);
 
   gda_db_catalog_append_table (self->catalog, table);
-  res = gda_db_table_create (table, self->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (table), self->cnc, NULL, &error);
 
   g_object_unref (table);
   g_object_unref (column_id);
diff --git a/tests/test-server-operation-postgresql.c b/tests/test-server-operation-postgresql.c
index 22d5aa417..83dd89037 100644
--- a/tests/test-server-operation-postgresql.c
+++ b/tests/test-server-operation-postgresql.c
@@ -1145,7 +1145,7 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
   g_object_unref (pname);
 
 /* Create table */
-  gboolean res = gda_db_table_create (tproject, fixture->cnc, TRUE, &error);
+  gboolean res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (tproject), fixture->cnc, NULL, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
@@ -1207,7 +1207,7 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
 
   g_object_unref (fkey);
 
-  res = gda_db_table_create (temployee, fixture->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (temployee), fixture->cnc, NULL, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
@@ -1222,7 +1222,7 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
   gda_db_column_set_scale (cost, 2);
   gda_db_column_set_nnul (cost, FALSE);
 
-  res = gda_db_table_add_column (tproject, cost, fixture->cnc, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (tproject), fixture->cnc, cost, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
@@ -1236,7 +1236,7 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
   GdaDbTable *new_table = gda_db_table_new ();
   gda_db_base_set_name (GDA_DB_BASE (new_table), "NewEmployee");
 
-  res = gda_db_table_rename (temployee, new_table, fixture->cnc, &error);
+  res = gda_ddl_modifiable_rename (GDA_DDL_MODIFIABLE (temployee), fixture->cnc, new_table, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
@@ -1248,13 +1248,14 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
   gda_db_view_set_istemp (myview, FALSE);
   gda_db_view_set_defstring (myview, "SELECT name, project_id FROM NewEmployee");
 
-  res = gda_db_view_create (myview, fixture->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_create (GDA_DDL_MODIFIABLE (myview), fixture->cnc, NULL, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
 
   /* DROP_VIEW operation. We will reuse the  view */
-  res = gda_db_view_drop (myview, fixture->cnc, TRUE, GDA_DB_VIEW_RESTRICT, &error);
+  GdaDbViewRefAction action = GDA_DB_VIEW_RESTRICT;
+  res = gda_ddl_modifiable_drop (GDA_DDL_MODIFIABLE (myview), fixture->cnc, &action, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
@@ -1286,14 +1287,14 @@ test_server_operation_operations_db (TestObjectFixture *fixture,
 
   g_assert_true (res);
 
-  res = gda_db_index_drop (index, fixture->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_drop (GDA_DDL_MODIFIABLE (index), fixture->cnc, NULL, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);
 
   g_assert_true (res);
 
-  res = gda_db_table_drop (new_table, fixture->cnc, TRUE, &error);
+  res = gda_ddl_modifiable_drop (GDA_DDL_MODIFIABLE (new_table), fixture->cnc, NULL, &error);
 
   if (!res)
     GDA_PGSQL_ERROR_HANDLE (error);


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