Hello Experts,
Trying to develop simple gui screen where in i accept some values(fields of a PostgreSQL table) and then
inserting those values into the table .

Im using GTK Glade for developing the gui screen and Libpq library of Postgresql as the database client interface.

In the callback.c file of Glade Im writing the code for a button widget (on button clicked) ,here im trying to do the

1) extract all the values of the text entry widgets into char variables
2) then connecting to the database .
3) then trying to insert the values into the database using the 'insert into table ' command.

Im facing the following problem.

While compiling the project

im getting the following error

"makefile.am required directory ./intl does not exist"

Apart from the above ...........I have some other doubts

can i combine libpq code in a glade (callback.c) file ? if this not the right way then how should i pass on the values of
the widgets into the database table.

How do i compile a glade file with libpq code involved ?

Thanx in advance.....


Following is the content of /root/Projects/cpnr/src/callbacks.c

# include <config.h>

#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <libpq-fe.h>
#include <gnome.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "cpnr.h"

void on_button_clicked (GtkButton *button,gpointer user_data)

// Initialization Code

char *fa_name,*fa_village,*fa_taluka,*fa_district

// Farmer Info Variables

GtkWidget *fname = lookup_widget(GTK_WIDGET(button),"entry1");
GtkWidget *fvillage = lookup_widget(GTK_WIDGET(button),"entry2");
GtkWidget *ftaluka = lookup_widget(GTK_WIDGET(button),"entry3");
GtkWidget *fdistrict = lookup_widget(GTK_WIDGET(button),"entry4");

//Database Code

// make a connection to the database */
conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);

// check to see that the backend connection was successfully made

if (PQstatus(conn) == CONNECTION_BAD)
fprintf(stderr, "Connection to database '%s' failed.\n", dbName);
fprintf(stderr, "%s", PQerrorMessage(conn));

fa_name = gtk_entry_get_text(fname);
fa_village = gtk_entry_get_text(fvillage);
fa_taluka = gtk_entry_get_text(ftaluka);
fa_district = gtk_entry_get_text(fdistrict);

//Inserting the above entry widget values into the table

sprintf(commd_holder,"INSERT INTO farmer1 VALUES ( nextval('farmer_ids'),'%s','%s','%s','%s') ",

res = PQexec(conn,commd_holder);

/* commit the transaction */
res = PQexec(conn, "COMMIT");

/* close the connection to the database and cleanup */

return 0;

} //EOF void on_start_weighing_clicked ()