1 /*
2  * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef __GDA_PROVIDER_REUSEABLE_H__
21 #define __GDA_PROVIDER_REUSEABLE_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 #include <libgda/gda-decl.h>
26 #include <libgda/gda-server-provider.h>
27 
28 G_BEGIN_DECLS
29 
30 typedef struct _GdaProviderReuseable GdaProviderReuseable;
31 
32 typedef GdaProviderReuseable *(*GdaProviderReuseable_NewDataFunc) (void);
33 typedef void (*GdaProviderReuseable_ResetDataFunc) (GdaProviderReuseable *rdata);
34 typedef GType (*GdaProviderReuseable_GetGTypeFunc) (GdaConnection *cnc, GdaProviderReuseable *rdata, const gchar *db_type);
35 typedef GdaSqlReservedKeywordsFunc (*GdaProviderReuseable_GetReservedKeywordsFunc) (GdaProviderReuseable *rdata);
36 typedef GdaSqlParser *(*GdaProviderReuseable_CreateParserFunc) (GdaProviderReuseable *rdata);
37 
38 /**
39  * GdaProviderReuseable: Reuseable provider part
40  *
41  * Defines the interface which a database provider has to implement to be reused
42  */
43 typedef struct {
44 	GdaProviderReuseable_NewDataFunc             re_new_data;
45 	GdaProviderReuseable_ResetDataFunc           re_reset_data;
46 
47 	GdaProviderReuseable_GetGTypeFunc            re_get_type; /* Returns GDA_TYPE_NULL if conversion failed */
48 	GdaProviderReuseable_GetReservedKeywordsFunc re_get_reserved_keyword_func;
49 
50 	GdaProviderReuseable_CreateParserFunc        re_create_parser;
51 	GdaServerProviderMeta                        re_meta_funcs;
52 } GdaProviderReuseableOperations;
53 
54 /*
55  * Declaration for provider's abstract operations
56  */
57 struct _GdaProviderReuseable {
58 	GdaProviderReuseableOperations *operations;
59 	gchar                          *server_version;
60 	guint                           major; /* major version */
61 	guint                           minor; /* minor version */
62 	guint                           micro; /* micro version */
63 };
64 
65 
66 G_END_DECLS
67 
68 #endif
69 
70