[libgda] DbTable: Property set removing unneeded code



commit 193fedbb1907d3cdb7bd94853c730a88c1a58feb
Author: Pavlo Solntsev <p sun fun gmail com>
Date:   Wed Jun 3 22:44:15 2020 -0500

    DbTable: Property set removing unneeded code
    
    Property "table" for GdaDbColumn will be set when the column is added
    to the table.
    Removed check guards that will be added to the interface implementation.

 libgda/gda-db-table.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/libgda/gda-db-table.c b/libgda/gda-db-table.c
index 10a0c7aec..f1e36eeca 100644
--- a/libgda/gda-db-table.c
+++ b/libgda/gda-db-table.c
@@ -767,8 +767,6 @@ gda_db_table_create (GdaDdlModifiable *self,
                      GError **error)
 {
   g_return_val_if_fail (GDA_IS_DB_TABLE (self), FALSE);
-  g_return_val_if_fail (GDA_IS_CONNECTION (cnc) && gda_connection_is_opened (cnc), FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
   gda_lockable_lock (GDA_LOCKABLE(cnc));
 
@@ -824,6 +822,7 @@ gda_db_table_append_column (GdaDbTable *self,
 
   GdaDbTablePrivate *priv = gda_db_table_get_instance_private (self);
 
+  g_object_set (column, "table", self, NULL);
   priv->mp_columns = g_list_append (priv->mp_columns, g_object_ref (column));
 }
 
@@ -873,17 +872,9 @@ gda_db_table_rename (GdaDdlModifiable *old_name,
 
   g_return_val_if_fail(GDA_IS_DB_TABLE (old_name), FALSE);
   g_return_val_if_fail(new_name, FALSE);
-  g_return_val_if_fail(GDA_IS_CONNECTION (cnc), FALSE);
-  g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
 
   new_name_table = GDA_DB_TABLE (new_name);
 
-  if (!gda_connection_is_opened (cnc))
-    {
-      g_warning ("Connection is not opened");
-      return FALSE;
-    }
-
   gda_lockable_lock (GDA_LOCKABLE (cnc));
   provider = gda_connection_get_provider (cnc);
 
@@ -945,15 +936,6 @@ gda_db_table_drop (GdaDdlModifiable *self,
   GdaServerOperation *op = NULL;
 
   g_return_val_if_fail (GDA_IS_DB_TABLE (self), FALSE);
-  g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
-  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-  if (!gda_connection_is_opened (cnc))
-    {
-      g_set_error (error, GDA_DB_TABLE_ERROR,  GDA_DB_TABLE_CONNECTION_NOT_OPENED,
-                   _("Connection is not opened"));
-      return FALSE;
-    }
 
   gda_lockable_lock (GDA_LOCKABLE (cnc));
 
@@ -998,7 +980,7 @@ on_error:
  * @self: a #GdaDbTable instance
  * @constr a constraint string to append
  *
- * Adds globat table constraint. It will be added to the sql string by the provider implementation
+ * Adds global table constraint. It will be added to the sql string by the provider implementation
  * if it supports it. Usually, table constraint is very complex and the current method just append
  * a list of constraints to the sql string.
  *


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