[libgda] DbView: Adding check for missed object properties
- From: Pavlo Solntsev <psolntsev src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] DbView: Adding check for missed object properties
- Date: Sun, 12 Jul 2020 03:41:19 +0000 (UTC)
commit a690f194edd9d69fa1b16f66d013445e142b8830
Author: Pavlo Solntsev <p sun fun gmail com>
Date: Thu Jun 4 00:22:44 2020 -0500
DbView: Adding check for missed object properties
libgda/gda-db-view.c | 17 ++++++++++++++++-
libgda/gda-ddl-modifiable.h | 3 ++-
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/libgda/gda-db-view.c b/libgda/gda-db-view.c
index 0c20d7e69..ba5002fbf 100644
--- a/libgda/gda-db-view.c
+++ b/libgda/gda-db-view.c
@@ -525,11 +525,26 @@ gda_db_view_create (GdaDdlModifiable *self,
{
GdaServerProvider *provider = NULL;
GdaServerOperation *op = NULL;
+ GdaDbView *view = GDA_DB_VIEW (self);
gda_lockable_lock ((GdaLockable*)cnc);
provider = gda_connection_get_provider (cnc);
- GdaDbViewPrivate *priv = gda_db_view_get_instance_private (GDA_DB_VIEW (self));
+ GdaDbViewPrivate *priv = gda_db_view_get_instance_private (view);
+
+ if (!gda_db_base_get_name (GDA_DB_BASE (view)))
+ {
+ g_set_error (error, GDA_DDL_MODIFIABLE_ERROR, GDA_DDL_MODIFIABLE_MISSED_DATA,
+ _("View name is not set"));
+ return FALSE;
+ }
+
+ if (!priv->mp_defstring)
+ {
+ g_set_error (error, GDA_DDL_MODIFIABLE_ERROR, GDA_DDL_MODIFIABLE_MISSED_DATA,
+ _("View definition is not set"));
+ return FALSE;
+ }
op = gda_server_provider_create_operation (provider,
cnc,
diff --git a/libgda/gda-ddl-modifiable.h b/libgda/gda-ddl-modifiable.h
index 08390966b..abb52e1d4 100644
--- a/libgda/gda-ddl-modifiable.h
+++ b/libgda/gda-ddl-modifiable.h
@@ -53,7 +53,8 @@ struct _GdaDdlModifiableInterface
typedef enum {
GDA_DDL_MODIFIABLE_NOT_IMPLEMENTED,
- GDA_DDL_MODIFIABLE_CONNECTION_NOT_OPENED
+ GDA_DDL_MODIFIABLE_CONNECTION_NOT_OPENED,
+ GDA_DDL_MODIFIABLE_MISSED_DATA
} GdaDdlModifiableError;
#define GDA_DDL_MODIFIABLE_ERROR gda_ddl_modifiable_error_quark()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]