1 /*
2  * Copyright (C) 2008 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __GDA_DDL_CREATOR_H_
20 #define __GDA_DDL_CREATOR_H_
21 
22 #include <glib-object.h>
23 #include <libgda/gda-enums.h>
24 #include <libgda/gda-data-model.h>
25 #include <libgda/gda-decl.h>
26 
27 G_BEGIN_DECLS
28 
29 typedef struct _GdaDDLCreator        GdaDDLCreator;
30 typedef struct _GdaDDLCreatorClass   GdaDDLCreatorClass;
31 typedef struct _GdaDDLCreatorPrivate GdaDDLCreatorPrivate;
32 typedef struct _GdaDDLCreatorClassPrivate GdaDDLCreatorClassPrivate;
33 
34 #define GDA_TYPE_DDL_CREATOR          (gda_ddl_creator_get_type())
35 #define GDA_DDL_CREATOR(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, gda_ddl_creator_get_type(), GdaDDLCreator)
36 #define GDA_DDL_CREATOR_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, gda_ddl_creator_get_type (), GdaDDLCreatorClass)
37 #define GDA_IS_DDL_CREATOR(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, gda_ddl_creator_get_type ())
38 
39 /* error reporting */
40 extern GQuark gda_ddl_creator_error_quark (void);
41 #define GDA_DDL_CREATOR_ERROR gda_ddl_creator_error_quark ()
42 
43 typedef enum {
44 	GDA_DDL_CREATOR_SPECFILE_NOT_FOUND_ERROR,
45 	GDA_DDL_CREATOR_INCORRECT_SCHEMA_ERROR,
46 	GDA_DDL_CREATOR_NO_CONNECTION_ERROR
47 } GdaDDLCreatorError;
48 
49 
50 /* struct for the object's data */
51 struct _GdaDDLCreator
52 {
53 	GObject               object;
54 	GdaDDLCreatorPrivate  *priv;
55 };
56 
57 /* struct for the object's class */
58 struct _GdaDDLCreatorClass
59 {
60 	GObjectClass              parent_class;
61 };
62 
63 GType             gda_ddl_creator_get_type             (void) G_GNUC_CONST;
64 GdaDDLCreator    *gda_ddl_creator_new                  (void);
65 
66 gboolean          gda_ddl_creator_set_dest_from_file   (GdaDDLCreator *ddlc, const gchar *xml_spec_file,
67 							GError **error);
68 //gboolean          gda_ddl_creator_set_dest_from_meta   (GdaDDLCreator *ddlc, GdaMetaStruct *struct, GError **error);
69 
70 void              gda_ddl_creator_set_connection       (GdaDDLCreator *ddlc, GdaConnection *cnc);
71 
72 
73 gchar            *gda_ddl_creator_get_sql              (GdaDDLCreator *ddlc, GError **error);
74 gboolean          gda_ddl_creator_execute              (GdaDDLCreator *ddlc, GError **error);
75 
76 G_END_DECLS
77 
78 #endif
79