[glom] Make formatting sane.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Make formatting sane.
- Date: Sun, 1 Nov 2015 12:57:41 +0000 (UTC)
commit 1f8dfab2bdf54c632be05508b552f7243a064bf4
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Oct 30 13:42:25 2015 +0100
Make formatting sane.
docs/postgres_gda_test.c | 75 ++++++++++++++++++++++-----------------------
1 files changed, 37 insertions(+), 38 deletions(-)
---
diff --git a/docs/postgres_gda_test.c b/docs/postgres_gda_test.c
index 38bab87..fe7b612 100644
--- a/docs/postgres_gda_test.c
+++ b/docs/postgres_gda_test.c
@@ -12,58 +12,57 @@
static void
get_errors (GdaConnection *connection)
{
- GList *list;
- GList *node;
- GdaError *error;
-
- list = (GList *) gda_connection_get_errors (connection);
-
- for (node = g_list_first (list); node != NULL; node = g_list_next (node)) {
- error = (GdaError *) node->data;
- g_print ("Error no: %d\t", gda_error_get_number (error));
- g_print ("desc: %s\t", gda_error_get_description (error));
- g_print ("source: %s\t", gda_error_get_source (error));
- g_print ("sqlstate: %s\n", gda_error_get_sqlstate (error));
- }
+ GList *list;
+ GList *node;
+ GdaError *error;
+
+ list = (GList *) gda_connection_get_errors (connection);
+
+ for (node = g_list_first (list); node != NULL; node = g_list_next (node)) {
+ error = (GdaError *) node->data;
+ g_print ("Error no: %d\t", gda_error_get_number (error));
+ g_print ("desc: %s\t", gda_error_get_description (error));
+ g_print ("source: %s\t", gda_error_get_source (error));
+ g_print ("sqlstate: %s\n", gda_error_get_sqlstate (error));
+ }
}
int
main(int argc, char *argv[])
{
- const gchar* connection_string =
"HOST=localhost;USER=murrayc;PASSWORD=yourpasswordhere;DATABASE=template1";
- GdaClient *client = 0;
- GdaConnection *con = 0;
+ const gchar* connection_string =
"HOST=localhost;USER=murrayc;PASSWORD=yourpasswordhere;DATABASE=template1";
+ GdaClient *client = 0;
+ GdaConnection *con = 0;
- gboolean errors = FALSE;
- gint rows;
+ gboolean errors = FALSE;
+ gint rows;
- gda_init ("glom-gda-test", NULL, argc, argv);
+ gda_init ("glom-gda-test", NULL, argc, argv);
- /* 3. Create a gda client */
- client = gda_client_new ();
+ /* 3. Create a gda client */
+ client = gda_client_new ();
- /* 4. Open the connection */
- con = gda_client_open_connection_from_string (client, "PostgreSQL", connection_string, 0);
- if (!GDA_IS_CONNECTION (con)) {
- g_print ("** ERROR: could not open connection.\n");
- /* This cannot work because it needs a working connection: get_errors (con); */
- return 0;
- }
+ /* 4. Open the connection */
+ con = gda_client_open_connection_from_string (client, "PostgreSQL", connection_string, 0);
+ if (!GDA_IS_CONNECTION (con)) {
+ g_print ("** ERROR: could not open connection.\n");
+ /* This cannot work because it needs a working connection: get_errors (con); */
+ return 0;
+ }
- gboolean created = gda_connection_create_database(con, "glomtest");
- if(!created)
- {
- g_print("** Error: gda_connection_create_database failed.\n");
- get_errors(con);
- }
+ gboolean created = gda_connection_create_database(con, "glomtest");
+ if(!created) {
+ g_print("** Error: gda_connection_create_database failed.\n");
+ get_errors(con);
+ }
- gda_connection_close (con);
+ gda_connection_close (con);
- g_object_unref (G_OBJECT (client));
+ g_object_unref (G_OBJECT (client));
- g_print ("** Connection successfully opened, database created, and connection closed.\n");
+ g_print ("** Connection successfully opened, database created, and connection closed.\n");
- return 0;
+ return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]