1 /*
2  * Copyright (C) 2008 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  * Copyright (C) 2009 Bas Driessen <bas.driessen@xobas.com>
4  * Copyright (C) 2010 David King <davidk@openismus.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA  02110-1301, USA.
20  */
21 #ifdef USING_MINGW
22 #define _NO_OLDNAMES
23 #endif
24 #include <libgda/libgda.h>
25 #define SO_NAME "libgda-jdbc." G_MODULE_SUFFIX
26 
27 int
28 main (G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
29 {
30 	GdaDataModel *providers;
31 	gint i, nrows;
32 	gboolean some_found = FALSE;
33 
34 	/* set up test environment */
35 	gda_init ();
36 
37 	providers = gda_config_list_providers ();
38 	nrows = gda_data_model_get_n_rows (providers);
39 	for (i = 0; i < nrows; i++) {
40 		const GValue *sovalue = gda_data_model_get_value_at (providers, 4, i, NULL);
41 		g_assert (sovalue);
42 		if (g_str_has_suffix (g_value_get_string (sovalue), SO_NAME)) {
43 			const GValue *namevalue = gda_data_model_get_value_at (providers, 0, i, NULL);
44 			g_assert (namevalue);
45 			if (! some_found) {
46 				some_found = TRUE;
47 				g_print ("Usable JDBC drivers:\n");
48 			}
49 			g_print ("%s\n", g_value_get_string (namevalue));
50 		}
51 	}
52 	g_object_unref (providers);
53 
54 	if (! some_found)
55 		g_print ("No usable JDBC driver\n");
56 
57 	return 0;
58 }
59