1
/* GDA - Information schema documentation extractor
2
* Copyright (C) 2008 The GNOME Foundation.
5
* Vivien Malerba <malerba@gnome-db.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program 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
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
#include <libgda/libgda.h>
23
#include <gda-ddl-creator.h>
26
main (int argc, char** argv)
35
ddl = gda_ddl_creator_new ();
36
if (!gda_ddl_creator_set_dest_from_file (ddl, "dbstruct.xml", &error)) {
37
g_print ("Error creating GdaDDLCreator: %s\n", error && error->message ? error->message : "No detail");
42
/* open a connection */
43
cnc = gda_connection_open_from_string ("SQLite", "DB_DIR=.;DB_NAME=creator", NULL, GDA_CONNECTION_OPTIONS_NONE, &error);
45
g_print ("Error opening connection: %s\n", error && error->message ? error->message : "No detail");
49
gda_ddl_creator_set_connection (ddl, cnc);
53
str = gda_ddl_creator_get_sql (ddl, &error);
55
g_print ("Error getting SQL: %s\n", error && error->message ? error->message : "No detail");
59
g_print ("%s\n", str);
63
if (!gda_ddl_creator_execute (ddl, &error)) {
64
g_print ("Error creating database objects: %s\n", error && error->message ? error->message : "No detail");