[GENERAL] conditional IF statements in postgresql

2014-07-06 Thread Madhurima Das
Hi, I am writing a C program to access a PostgreSQL database, where I add a column if it doesn't exists in the table or, update the column, if the column already exits. Please suggest how to work with the conditional statements. Thanks! N.B. I wrote the following: res = PQexec(conn, "IF COL_

[GENERAL] memory leak while trying to update/alter column in postgresql

2014-07-04 Thread Madhurima Das
I am trying to update/alter two columns-comment and id in a table called xxx using postgresql. Though the compiler does not show any errors but Valgrind gives major memory leak errors. The code is: int main() { PGconn *conn; PGresult *res; int i=0,nFields=0,row=0,col=0; conn = PQconnectdb

[GENERAL] help on using C for postgresql

2014-02-03 Thread Madhurima Das
I am a beginner in Postgresql and trying to write a C++ program to connect a database and retrieve information from a database. I have downloaded Postgresql 9.3 in my MAC laptop and could create a database XXX with a user YYY and password ZZZ. I can create, modify etc using the pgAdmin3 tool. Nex