From: Andrea Zagli Date: Sun, 22 Dec 2019 08:45:23 +0000 (+0100) Subject: Use of gdaex_init instead of gdaex_new_. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=cf2862e596bf78d11d93e9a5f5c6d1bb4fef47d4;p=libgdaex Use of gdaex_init instead of gdaex_new_. --- diff --git a/src/gdaex.c b/src/gdaex.c index 3463659..7e729a8 100644 --- a/src/gdaex.c +++ b/src/gdaex.c @@ -130,21 +130,15 @@ gdaex_class_init (GdaExClass *klass) static void gdaex_init (GdaEx *gdaex) { + gchar *localedir; + GdaExPrivate *priv = GDAEX_GET_PRIVATE (gdaex); + g_message ("Init"); + priv->tables_name_prefix = NULL; priv->debug = 0; - priv->log_file = 0; -} - -static GdaEx -*gdaex_new_ () -{ - gchar *localedir; - - GdaEx *gdaex = GDAEX (g_object_new (gdaex_get_type (), NULL)); - - GdaExPrivate *priv = GDAEX_GET_PRIVATE (gdaex); + priv->log_file = NULL; setlocale (LC_ALL, ""); gda_locale_changed (); @@ -189,8 +183,6 @@ static GdaEx gtk_builder_set_translation_domain (priv->gtkbuilder, GETTEXT_PACKAGE); g_free (localedir); - - return gdaex; } /** @@ -222,7 +214,7 @@ GdaEx return NULL; } - gdaex = gdaex_new_ (); + gdaex = GDAEX (g_object_new (gdaex_get_type (), NULL)); if (gdaex == NULL) { /* TO DO */ @@ -315,7 +307,7 @@ GdaEx return NULL; } - gdaex = gdaex_new_ (); + gdaex = GDAEX (g_object_new (gdaex_get_type (), NULL)); if (gdaex == NULL) { /* TO DO */ @@ -360,7 +352,7 @@ GdaEx g_return_val_if_fail (GDA_IS_CONNECTION (conn), NULL); - gdaex = gdaex_new_ (); + gdaex = GDAEX (g_object_new (gdaex_get_type (), NULL)); priv = GDAEX_GET_PRIVATE (gdaex); diff --git a/tests/select.c b/tests/select.c index b48f3fb..9330052 100644 --- a/tests/select.c +++ b/tests/select.c @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include int @@ -28,15 +30,20 @@ main (int argc, char **argv) gtk_init (&argc, &argv); - gdaex = gdaex_new_from_string (g_strdup_printf ("SQLite://DB_DIR=%s;DB_NAME=grid.db", TESTSDIR)); + //gdaex = gdaex_new_from_string (g_strdup_printf ("SQLite://DB_DIR=%s;DB_NAME=grid.db", TESTSDIR)); + gdaex = g_object_new (TYPE_GDAEX, NULL); if (gdaex == NULL) { g_error ("Unable to connect to the db."); } - sql = g_strdup_printf ("SELECT * FROM clientssss"); + sql = g_strdup_printf ("SELECT * FROM clients"); dm = gdaex_query (gdaex, sql); g_free (sql); + + sql = gda_data_model_dump_as_string (dm); + g_printf ("%s\n", sql); + g_object_unref (dm); return 0;