Questions tagged [libpq]

libpq is the C application programmer's interface to PostgreSQL. libpq is a set of library functions that allow client programs to pass queries to the PostgreSQL backend server and to receive the results of these queries.

libpq is also the underlying engine for several other PostgreSQL application interfaces, including those written for C++, Perl, Python, Tcl and ECPG. So some aspects of libpq's behavior will be important to you if you use one of those packages.

Client programs that use libpq must include the header file libpq-fe.h and must link with the libpq library.

345 questions
0
votes
1 answer

Get all the tables involved in a SELECT query in PostgreSQL using `libpq'

Is it possible to get the names or (Oid's) for all queried tables with libpq? If there exists a generic standard SQL way i would prefer it.
Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
0
votes
1 answer

PostgreSQL notice processing

I'm working on a C application that is suppose to talk to PostgreSQL. Right now I need to handle notices and warnings sent by the server but I'm at a loss on how to make it work. The (very unclear) documentation says we should use…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
0
votes
0 answers

psycopg2 cannot use the libpq.dylib produced by Mac Homebrew

I installed the Homebrew version of Postgres on OS X 10.8.5 via brew install postgresql And then did a cp /usr/local/Cellar/postgresql/9.2.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ to add a lunchy launcher for it. Then I pointed the…
Terrence Brannon
  • 4,760
  • 7
  • 42
  • 61
0
votes
1 answer

About the authentication when using PQconnectdb() to connect pq server in windows

I have installed postgresql9.2.4 in my win7 laptop and have wrote a simple program to test the connection in my vs2008.The code is here: #include "stdafx.h" #include #include "libpq-fe.h" int _tmain(int argc, _TCHAR* argv[]) { …
asenxu08
  • 5
  • 1
0
votes
1 answer

Randomly disappearing struct

I've created a Objective-C class to interface with PostgreSQL using libpq. It mostly works but I have one small problem - the connection seems to disappear randomly. This class is set to open a connection when a window is opened and close that…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
0
votes
1 answer

Handling PL/pgSQL function's message in C++ code

I am running a calculation in a PL/pgSQL function and I want to use the result of that calculation in my C++ code. What's the best way to do that? I can insert that result into a table and use it from there but I'm not sure how well that fares with…
Yavuz
  • 1,257
  • 1
  • 16
  • 32
0
votes
1 answer

Using libpq (PostgreSQL) library in VS 2012 project

I'm using a VS 2012 with Windows 7 x64. My friend wrote for me C++ class which is using libpq: ... #include const char* QStrToCStr(QString qstring); void ShowInfoBox(QString string); QString IToQS(int x); QString DToQS(double x); class…
0
votes
1 answer

Combining the functionality of Embedded SQL and libpq

I have written a program in C that periodically polls variables in a PostgreSQL database into host variables and listens for notifications from the database. I am wondering if there is a solution that would either let me 1. LISTEN for a notification…
Elaine B
  • 213
  • 1
  • 3
  • 14
0
votes
1 answer

psql \copy command error when executing from c++ program

ERROR: syntax error at or near "\" LINE 1: \copy mytable FROM urishFile WITH (FORMAT csv, DELIMITER ','... ^ I am getting this error when running command from c++ program. command = "\\copy mytable FROM urishFile WITH (FORMAT csv,…
Ashot
  • 10,807
  • 14
  • 66
  • 117
0
votes
1 answer

Deployment issues of Psycopg2 Python App

I have created an application in Python that is tested and runs perfectly on my computer (Mac OSX 10.8.3 Python2.7.3 Postgresql9.2.4 Psycopg2-2.5). The app is compiled using py2app, and I can see that the build successfully included all…
LouisL
  • 3
  • 1
0
votes
1 answer

Undefined reference to...function returning pointer

Making a header to connect to PostgreSQL database I'm encapsulating libpq functions into functions of my own but, in one of them, which supposedly returns a pointer of type PGconn I get an error of the type... ConexionPostgres.c:32:6: aviso: la…
Edgar Sampere
  • 263
  • 4
  • 24
0
votes
1 answer

libpq VS qpsql(QT driver for postgre)

I've been working with QT 4.8 and QT Postgresql driver in order to make a Postgresql connection header and a class, and when I finally done with it my boss tolds me to forget it and re-make it in the native libpq... He uses QT as the ide in where…
Edgar Sampere
  • 263
  • 4
  • 24
0
votes
2 answers

Creating helper function with static character array

I am using PostgreSql C library libpq, and I can fetch values from the PGresult pointer with PQgetvalue function. Now, I have a table with 10-20 columns, and I want to print them out with a simple printf call: printf("%s,%s,%s..(so on...)...%s",…
Nemanja Boric
  • 21,627
  • 6
  • 67
  • 91
0
votes
4 answers

c++ gives me standard string/corrputed data instead of binary data when i tried to write 'const char *'

In C++ (Visual C++ MFC) i have char * which is came from database. This is actually a picture. PostgreSQL returns it as char * because no byte[] in C++ (As for as i know -yet-:)) The thing is, i try to write that image like this one: ofstream myFile…
xangr
  • 879
  • 14
  • 28
0
votes
1 answer

Retrieving image file from Postgresql database returns two times bigger data inserted (by libpq library)

I'm using libpq library of Postgresql database and I have a problem about retrieving the bytea data from db. I couldn't solve my problem, so wanted to ask you. Whenever I try to insert an image file into db and get it back, the size of returning…
Horizon1710
  • 792
  • 10
  • 28
1 2 3
22
23