1 /*
2  * Copyright (C) 2006 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  * Copyright (C) 2007 Armin Burgmeier <armin@openismus.com>
4  * Copyright (C) 2007 Murray Cumming <murrayc@murrayc.com>
5  * Copyright (C) 2009 Bas Driessen <bas.driessen@xobas.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA  02110-1301, USA.
21  */
22 
23 #ifndef __GDA_SERVER_PROVIDER_EXTRA__
24 #define __GDA_SERVER_PROVIDER_EXTRA__
25 
26 #include <libgda/gda-decl.h>
27 #include <libgda/gda-value.h>
28 #include <libgda/gda-connection.h>
29 
30 G_BEGIN_DECLS
31 
32 /**
33  * SECTION:provider-support
34  * @short_description: Methods dedicated to implementing providers
35  * @title: Misc API for database providers
36  * @stability: Stable
37  * @see_also:
38  *
39  * The methods mentioned in this section are reserved for database providers implementations and should
40  * not bu used by developers outside that scope.
41  */
42 
43 /*
44  * GdaSqlParser associated to each provider
45  */
46 GdaSqlParser *gda_server_provider_internal_get_parser (GdaServerProvider *prov);
47 
48 /*
49  * Default perform operation
50  */
51 gboolean gda_server_provider_perform_operation_default (GdaServerProvider *provider, GdaConnection *cnc,
52 							GdaServerOperation *op, GError **error);
53 
54 /* default data handler method */
55 GdaDataHandler *gda_server_provider_handler_use_default (GdaServerProvider *provider, GType type);
56 GdaDataHandler *gda_server_provider_get_data_handler_default (GdaServerProvider *provider, GdaConnection *cnc,
57 							      GType type, const gchar *dbms_type);
58 
59 /* Convert a SELECT statement with potentially some parameters to another SELECT statement
60  * where all the parameters are removed and where the WHERE condition is set to "0 = 1"
61  * to make sure no row will ever be returned
62  */
63 GdaStatement *gda_select_alter_select_for_empty (GdaStatement *stmt, GError **error);
64 
65 /*
66  * Help to implement the GdaDataHandler retrieving for the providers
67  */
68 typedef struct {
69 	GdaConnection *cnc;
70 	GType          g_type;
71 	gchar         *dbms_type;
72 } GdaServerProviderHandlerInfo;
73 
74 GdaDataHandler *gda_server_provider_handler_find            (GdaServerProvider *prov, GdaConnection *cnc,
75 							     GType g_type, const gchar *dbms_type);
76 void            gda_server_provider_handler_declare         (GdaServerProvider *prov, GdaDataHandler *dh,
77 							     GdaConnection *cnc,
78 							     GType g_type, const gchar *dbms_type);
79 void            _gda_server_provider_handlers_clear_for_cnc (GdaServerProvider *prov, GdaConnection *cnc);
80 
81 /*
82  * misc
83  */
84 gchar         *gda_server_provider_find_file                (GdaServerProvider *prov, const gchar *inst_dir, const gchar *filename);
85 gchar         *gda_server_provider_load_file_contents       (const gchar *inst_dir, const gchar *data_dir, const gchar *filename);
86 
87 G_END_DECLS
88 
89 #endif
90 
91 
92 
93