[libgda] Removed the useless get_database() provider's virtual function



commit 0fcecc30cc6afb9cd3b295dc0a71c28fca0ece98
Author: Vivien Malerba <malerba gnome-db org>
Date:   Tue May 20 21:31:57 2014 +0200

    Removed the useless get_database() provider's virtual function

 doc/C/prov-writing-virtual-methods.xml             |    6 +----
 libgda/gda-server-provider-impl.h                  |    3 +-
 libgda/gda-server-provider.c                       |    2 -
 libgda/sqlite/gda-sqlite-provider.c                |   19 ---------------
 libgda/sqlite/virtual/gda-vprovider-data-model.c   |    1 -
 libgda/sqlite/virtual/gda-vprovider-hub.c          |    3 +-
 providers/firebird/gda-firebird-provider.c         |   22 ------------------
 providers/ldap/gda-ldap-provider.c                 |   19 ---------------
 providers/mysql/gda-mysql-provider.c               |   24 --------------------
 providers/oracle/gda-oracle-provider.c             |   22 ------------------
 providers/postgres/gda-postgres-provider.c         |   22 ------------------
 .../skel-implementation/capi/gda-capi-provider.c   |   22 ------------------
 testing/gda-provider-status.c                      |    1 -
 13 files changed, 3 insertions(+), 163 deletions(-)
---
diff --git a/doc/C/prov-writing-virtual-methods.xml b/doc/C/prov-writing-virtual-methods.xml
index eeb9a5c..544d59e 100644
--- a/doc/C/prov-writing-virtual-methods.xml
+++ b/doc/C/prov-writing-virtual-methods.xml
@@ -24,7 +24,7 @@
     and not the <link linkend="GdaServerProvider">GdaServerProvider</link> as "normal" providers do,
     and the number of virtual methods to implement is very limited: only the <link 
linkend="prov-get-name">get_name()</link>,
     <link linkend="prov-get-version">get_version()</link>, <link 
linkend="prov-get-server-version">get_server_version()</link>, 
-    <link linkend="prov-open-connection">open_connection()</link> and <link 
linkend="prov-get-database">get_database()</link>
+    and <link linkend="prov-open-connection">open_connection()</link>
     should be implemented, optionnally the <link linkend="prov-close-connection">close_connection()</link> 
can
     also be implemented.
   </para>
@@ -148,10 +148,6 @@
        <link 
linkend="gda-connection-internal-get-provider-data-error">gda_connection_internal_get_provider_data_error()</link>
 method.
       </para>
     </sect2>
-    <sect2>
-      <title>get_database()</title>
-      <para>This method returns the name of the database to which a connection is opened.</para>
-    </sect2>
   </sect1>
 
   <sect1>
diff --git a/libgda/gda-server-provider-impl.h b/libgda/gda-server-provider-impl.h
index a34d684..25668cf 100644
--- a/libgda/gda-server-provider-impl.h
+++ b/libgda/gda-server-provider-impl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2013 - 2014 Vivien Malerba <malerba gnome-db org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -136,7 +136,6 @@ typedef struct {
        gboolean      (* close_connection)      (GdaServerProvider *provider, GdaConnection *cnc);
        gchar        *(* escape_string)         (GdaServerProvider *provider, GdaConnection *cnc, const gchar 
*str); /* may be NULL */
        gchar        *(* unescape_string)       (GdaServerProvider *provider, GdaConnection *cnc, const gchar 
*str); /* may be NULL */
-       const gchar  *(* get_database)          (GdaServerProvider *provider, GdaConnection *cnc);
        gboolean      (* perform_operation)     (GdaServerProvider *provider, GdaConnection *cnc, /* may be 
NULL */
                                                 GdaServerOperation *op, GError **error);
        gboolean      (* begin_transaction)     (GdaServerProvider *provider, GdaConnection *cnc,
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index e1d4273..afa7187 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -219,8 +219,6 @@ gda_server_provider_constructed (GObject *object)
                        else if (!fset->escape_string && fset->unescape_string)
                                g_warning ("Internal error after creation of %s: : virtual method %s 
implemented and %s _not_ implemented",
                                           gtype_name, "unescape_string()", "escape_string()");
-                       if (! fset->get_database)
-                               g_warning ("Internal error after creation of %s: : %s() virtual function 
missing", gtype_name, "get_database");
                        if (! fset->statement_prepare)
                                g_warning ("Internal error after creation of %s: : %s() virtual function 
missing", gtype_name, "statement_prepare");
                        if (! fset->statement_execute)
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 9a82c77..0d827dd 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -262,7 +262,6 @@ static gboolean            gda_sqlite_provider_prepare_connection (GdaServerProv
                                                                   GdaConnection *cnc, GdaQuarkList *params, 
GdaQuarkList *auth);
 static gboolean            gda_sqlite_provider_close_connection (GdaServerProvider *provider, GdaConnection 
*cnc);
 static const gchar        *gda_sqlite_provider_get_server_version (GdaServerProvider *provider, 
GdaConnection *cnc);
-static const gchar        *gda_sqlite_provider_get_database (GdaServerProvider *provider, GdaConnection 
*cnc);
 
 /* DDL operations */
 static gboolean            gda_sqlite_provider_supports_operation (GdaServerProvider *provider, 
GdaConnection *cnc,
@@ -482,7 +481,6 @@ GdaServerProviderBase sqlite_base_functions = {
        gda_sqlite_provider_close_connection,
        gda_sqlite_provider_escape_string,
        gda_sqlite_provider_unescape_string,
-       gda_sqlite_provider_get_database,
        gda_sqlite_provider_perform_operation,
        gda_sqlite_provider_begin_transaction,
        gda_sqlite_provider_commit_transaction,
@@ -1128,23 +1126,6 @@ gda_sqlite_provider_get_server_version (GdaServerProvider *provider, GdaConnecti
 }
 
 /*
- * Get database request
- */
-static const gchar *
-gda_sqlite_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       SqliteConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (SqliteConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata)
-               return NULL;
-       return cdata->file;
-}
-
-/*
  * Support operation request
  */
 static gboolean
diff --git a/libgda/sqlite/virtual/gda-vprovider-data-model.c 
b/libgda/sqlite/virtual/gda-vprovider-data-model.c
index 8f92593..0823d74 100644
--- a/libgda/sqlite/virtual/gda-vprovider-data-model.c
+++ b/libgda/sqlite/virtual/gda-vprovider-data-model.c
@@ -93,7 +93,6 @@ GdaServerProviderBase data_model_base_functions = {
        NULL,
        NULL,
        NULL,
-       NULL,
        gda_vprovider_data_model_statement_execute,
 
        NULL, NULL, NULL, NULL, /* padding */
diff --git a/libgda/sqlite/virtual/gda-vprovider-hub.c b/libgda/sqlite/virtual/gda-vprovider-hub.c
index 2517d9e..447517d 100644
--- a/libgda/sqlite/virtual/gda-vprovider-hub.c
+++ b/libgda/sqlite/virtual/gda-vprovider-hub.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 - 2011 Vivien Malerba <malerba gnome-db org>
+ * Copyright (C) 2007 - 2014 Vivien Malerba <malerba gnome-db org>
  * Copyright (C) 2010 David King <davidk openismus com>
  *
  * This library is free software; you can redistribute it and/or
@@ -86,7 +86,6 @@ static GdaServerProviderBase hub_base_functions = {
        NULL,
        NULL,
        NULL,
-       NULL,
 
        NULL, NULL, NULL, NULL, /* padding */
 };
diff --git a/providers/firebird/gda-firebird-provider.c b/providers/firebird/gda-firebird-provider.c
index 22f57ec..ee98e76 100644
--- a/providers/firebird/gda-firebird-provider.c
+++ b/providers/firebird/gda-firebird-provider.c
@@ -67,7 +67,6 @@ static gboolean            gda_firebird_provider_open_connection (GdaServerProvi
                                                                  GdaQuarkList *auth);
 static gboolean            gda_firebird_provider_close_connection (GdaServerProvider *provider, 
GdaConnection *cnc);
 static const gchar        *gda_firebird_provider_get_server_version (GdaServerProvider *provider, 
GdaConnection *cnc);
-static const gchar        *gda_firebird_provider_get_database (GdaServerProvider *provider, GdaConnection 
*cnc);
 
 /* DDL operations */
 static gboolean            gda_firebird_provider_supports_operation (GdaServerProvider *provider, 
GdaConnection *cnc,
@@ -210,7 +209,6 @@ GdaServerProviderBase firebird_base_functions = {
        gda_firebird_provider_close_connection,
        NULL,
        NULL,
-       gda_firebird_provider_get_database,
        gda_firebird_provider_perform_operation,
        gda_firebird_provider_begin_transaction,
        gda_firebird_provider_commit_transaction,
@@ -564,26 +562,6 @@ gda_firebird_provider_get_server_version (GdaServerProvider *provider, GdaConnec
 }
 
 /*
- * Get database request
- *
- * Returns the server version as a string, which should be stored in @cnc's associated 
FirebirdConnectionData structure
- */
-static const gchar *
-gda_firebird_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       FirebirdConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (FirebirdConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata) 
-               return NULL;
-
-       return (const gchar *) cdata->dbname;
-}
-
-/*
  * Support operation request
  *
  * Tells what the implemented server operations are. To add support for an operation, the following steps 
are required:
diff --git a/providers/ldap/gda-ldap-provider.c b/providers/ldap/gda-ldap-provider.c
index 9f0fee1..9a2dd96 100644
--- a/providers/ldap/gda-ldap-provider.c
+++ b/providers/ldap/gda-ldap-provider.c
@@ -54,7 +54,6 @@ static GObject *gda_ldap_provider_statement_execute (GdaServerProvider *provider
                                                     GType *col_types, GdaSet **last_inserted_row, GError 
**error);
 static const gchar *gda_ldap_provider_get_server_version (GdaServerProvider *provider,
                                                          GdaConnection *cnc);
-static const gchar *gda_ldap_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc);
 
 static GObjectClass *parent_class = NULL;
 
@@ -87,7 +86,6 @@ GdaServerProviderBase ldap_base_functions = {
        NULL,
        NULL,
        NULL,
-       gda_ldap_provider_get_database,
        NULL,
        NULL,
        NULL,
@@ -771,23 +769,6 @@ gda_ldap_provider_get_server_version (GdaServerProvider *provider, GdaConnection
 }
 
 /*
- * Get database request
- */
-static const gchar *
-gda_ldap_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       LdapConnectionData *cdata;
-
-        g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-        g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-        cdata = (LdapConnectionData*) gda_virtual_connection_internal_get_provider_data 
(GDA_VIRTUAL_CONNECTION (cnc));
-        if (!cdata)
-                return NULL;
-        return cdata->base_dn;
-}
-
-/*
  * Extra SQL
  */
 typedef struct {
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index b2d6204..87bbf4c 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -100,8 +100,6 @@ static gboolean            gda_mysql_provider_close_connection (GdaServerProvide
                                                                GdaConnection      *cnc);
 static const gchar        *gda_mysql_provider_get_server_version (GdaServerProvider  *provider,
                                                                  GdaConnection      *cnc);
-static const gchar        *gda_mysql_provider_get_database (GdaServerProvider  *provider,
-                                                           GdaConnection      *cnc);
 
 /* DDL operations */
 static gboolean            gda_mysql_provider_supports_operation (GdaServerProvider       *provider,
@@ -272,7 +270,6 @@ GdaServerProviderBase mysql_base_functions = {
        gda_mysql_provider_close_connection,
        NULL,
        NULL,
-       gda_mysql_provider_get_database,
        gda_mysql_provider_perform_operation,
        gda_mysql_provider_begin_transaction,
        gda_mysql_provider_commit_transaction,
@@ -760,27 +757,6 @@ gda_mysql_provider_get_server_version (GdaServerProvider  *provider,
 }
 
 /*
- * Get database request
- *
- * Returns the server version as a string, which should be stored in @cnc's associated MysqlConnectionData 
structure
- */
-static const gchar *
-gda_mysql_provider_get_database (GdaServerProvider  *provider,
-                                GdaConnection      *cnc)
-{
-       MysqlConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (MysqlConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata) 
-               return NULL;
-       TO_IMPLEMENT;
-       return NULL;
-}
-
-/*
  * Support operation request
  *
  * Tells what the implemented server operations are. To add support for an operation, the following steps 
are required:
diff --git a/providers/oracle/gda-oracle-provider.c b/providers/oracle/gda-oracle-provider.c
index a4059ab..1535bd0 100644
--- a/providers/oracle/gda-oracle-provider.c
+++ b/providers/oracle/gda-oracle-provider.c
@@ -69,7 +69,6 @@ static gboolean            gda_oracle_provider_prepare_connection (GdaServerProv
                                                                   GdaQuarkList *params, GdaQuarkList *auth);
 static gboolean            gda_oracle_provider_close_connection (GdaServerProvider *provider, GdaConnection 
*cnc);
 static const gchar        *gda_oracle_provider_get_server_version (GdaServerProvider *provider, 
GdaConnection *cnc);
-static const gchar        *gda_oracle_provider_get_database (GdaServerProvider *provider, GdaConnection 
*cnc);
 
 /* DDL operations */
 static gboolean            gda_oracle_provider_supports_operation (GdaServerProvider *provider, 
GdaConnection *cnc,
@@ -192,7 +191,6 @@ GdaServerProviderBase oracle_base_functions = {
        gda_oracle_provider_close_connection,
        NULL,
        NULL,
-       gda_oracle_provider_get_database,
        gda_oracle_provider_perform_operation,
        gda_oracle_provider_begin_transaction,
        gda_oracle_provider_commit_transaction,
@@ -822,26 +820,6 @@ gda_oracle_provider_get_server_version (GdaServerProvider *provider, GdaConnecti
 }
 
 /*
- * Get database request
- *
- * Returns the database name as a string, which should be stored in @cnc's associated OracleConnectionData 
structure
- */
-static const gchar *
-gda_oracle_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       OracleConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (OracleConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata) 
-               return NULL;
-       TO_IMPLEMENT;
-       return NULL;
-}
-
-/*
  * Support operation request
  *
  * Tells what the implemented server operations are. To add support for an operation, the following steps 
are required:
diff --git a/providers/postgres/gda-postgres-provider.c b/providers/postgres/gda-postgres-provider.c
index 89de364..bd32f13 100644
--- a/providers/postgres/gda-postgres-provider.c
+++ b/providers/postgres/gda-postgres-provider.c
@@ -74,7 +74,6 @@ static gboolean            gda_postgres_provider_prepare_connection (GdaServerPr
                                                                     GdaQuarkList *params, GdaQuarkList 
*auth);
 static gboolean            gda_postgres_provider_close_connection (GdaServerProvider *provider, 
GdaConnection *cnc);
 static const gchar        *gda_postgres_provider_get_server_version (GdaServerProvider *provider, 
GdaConnection *cnc);
-static const gchar        *gda_postgres_provider_get_database (GdaServerProvider *provider, GdaConnection 
*cnc);
 
 /* DDL operations */
 static gboolean            gda_postgres_provider_supports_operation (GdaServerProvider *provider, 
GdaConnection *cnc,
@@ -214,7 +213,6 @@ GdaServerProviderBase postgres_base_functions = {
        gda_postgres_provider_close_connection,
        gda_postgres_provider_escape_string,
        NULL,
-       gda_postgres_provider_get_database,
        gda_postgres_provider_perform_operation,
        gda_postgres_provider_begin_transaction,
        gda_postgres_provider_commit_transaction,
@@ -769,26 +767,6 @@ gda_postgres_provider_get_server_version (GdaServerProvider *provider, GdaConnec
 }
 
 /*
- * Get database request
- *
- * Returns the database name as a string
- */
-static const gchar *
-gda_postgres_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       PostgresConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (PostgresConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata)
-               return NULL;
-
-       return (const char *) PQdb ((const PGconn *) cdata->pconn);
-}
-
-/*
  * Support operation request
  *
  * Tells what the implemented server operations are. To add support for an operation, the following steps 
are required:
diff --git a/providers/skel-implementation/capi/gda-capi-provider.c 
b/providers/skel-implementation/capi/gda-capi-provider.c
index a14048a..8ab12c4 100644
--- a/providers/skel-implementation/capi/gda-capi-provider.c
+++ b/providers/skel-implementation/capi/gda-capi-provider.c
@@ -63,7 +63,6 @@ static gchar              *gda_capi_provider_escape_string (GdaServerProvider *p
 static gchar              *gda_capi_provider_unescape_string (GdaServerProvider *provider, GdaConnection 
*cnc, const gchar *str);
 
 static const gchar        *gda_capi_provider_get_server_version (GdaServerProvider *provider, GdaConnection 
*cnc);
-static const gchar        *gda_capi_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc);
 
 /* DDL operations */
 static gboolean            gda_capi_provider_supports_operation (GdaServerProvider *provider, GdaConnection 
*cnc,
@@ -186,7 +185,6 @@ GdaServerProviderBase base_functions = {
        gda_capi_provider_close_connection,
        gda_capi_provider_escape_string,
        gda_capi_provider_unescape_string,
-       gda_capi_provider_get_database,
        gda_capi_provider_perform_operation,
        gda_capi_provider_begin_transaction,
        gda_capi_provider_commit_transaction,
@@ -487,26 +485,6 @@ gda_capi_provider_get_server_version (GdaServerProvider *provider, GdaConnection
 }
 
 /*
- * Get database request
- *
- * Returns the database name as a string, which should be stored in @cnc's associated CapiConnectionData 
structure
- */
-static const gchar *
-gda_capi_provider_get_database (GdaServerProvider *provider, GdaConnection *cnc)
-{
-       CapiConnectionData *cdata;
-
-       g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (gda_connection_get_provider (cnc) == provider, NULL);
-
-       cdata = (CapiConnectionData*) gda_connection_internal_get_provider_data_error (cnc, NULL);
-       if (!cdata) 
-               return NULL;
-       TO_IMPLEMENT;
-       return NULL;
-}
-
-/*
  * Support operation request
  *
  * Tells what the implemented server operations are. To add support for an operation, the following steps 
are required:
diff --git a/testing/gda-provider-status.c b/testing/gda-provider-status.c
index 9ade4c5..582cdff 100644
--- a/testing/gda-provider-status.c
+++ b/testing/gda-provider-status.c
@@ -265,7 +265,6 @@ report_provider_status (GdaServerProvider *prov, GdaConnection *cnc)
                {"unescape_string", TRUE, (AFunc) pclass->unescape_string},
                {"open_connection", TRUE, (AFunc) pclass->open_connection},
                {"close_connection", TRUE, (AFunc) pclass->close_connection},
-               {"get_database", TRUE, (AFunc) pclass->get_database},
                {"supports_operation", is_virt ? FALSE : TRUE, (AFunc) pclass->supports_operation},
                {"create_operation", FALSE, (AFunc) pclass->create_operation},
                {"render_operation", FALSE, (AFunc) pclass->render_operation},


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