Questions tagged [libpqxx]

Libpqxx is a C++ client API for PostgreSQL, the enterprise-strength open-source database software.

Libpqxx is a C++ client API for PostgreSQL, the enterprise-strength open-source database software.

homepage: http://pqxx.org/development/libpqxx/

Other PostgreSQL C++ clients: https://wiki.postgresql.org/wiki/Client_Libraries#C.2B.2B

235 questions
43
votes
14 answers

Problems instaling libpq-dev in ubuntu 20.04

I am currently trying to install libpq-dev to install psycopg2. The problem is, when I try to install it, an error occurs saying I don't have the latest libpq5 version. However when I try to download the newer version of libpq5 the system says that…
lhmmendes
  • 433
  • 1
  • 4
  • 4
12
votes
5 answers

How to insert binary data into a PostgreSQL BYTEA column using the C++ libpqxx API?

I'd like to insert some binary data into a BYTEA column, but I find the Doxygen output is lacking in details, and http://pqxx.org/ has been down for the past few days. How would I go about inserting the contents of somefile.bin into a table with a…
Stéphane
  • 19,459
  • 24
  • 95
  • 136
9
votes
1 answer

pqxx reuse / reactivate a work transaction

I want to use a pqxx::work for multiple queries AND commitments, while the commit function prevents me from using it again. Here is a simple example : pqxx::connection G_connexion("dbname=basetest user=usertest password=1234"); pqxx::work…
alexis
  • 129
  • 2
  • 2
  • 12
8
votes
1 answer

pqxx return id of just inserted row

i am using c++ 4.8 ( available 4.9) and pqxx driver ver. 4.0.1. postgresdb is latest stable. My problem is all about complexity and resource balance: I need to execute insert to database (and there is optionally pqxx::result) and id in that table id…
esavier
  • 423
  • 4
  • 13
7
votes
3 answers

Connection to Postgres Database using libpqxx

I am using libpqxx to connect to a postgres database by creating a class. class databaseConnection { public: pqxx::connection* conn; void SetConnection(){ conn=new pqxx::connection( "username=temp " …
Gaurav
  • 193
  • 1
  • 1
  • 12
7
votes
2 answers

How to prepare statements and bind parameters in Postgresql for C++

I'm quite new to C++ and know a little bit about pqxx library. What I want to implement is to prepare statements and bind parameters. In PHP I'm used to doing this in such a nice and concise manner: $s = $db->prepare("SELECT id FROM mytable WHERE id…
Jacobian
  • 10,122
  • 29
  • 128
  • 221
7
votes
1 answer

using notify_listener - libpqxx

I'm trying to listen for notify events using libpqxx. I started by going off an example that extended pqxx::notify_listener. #include #include #include class Foo : public pqxx::notify_listener { public: …
Ilia Choly
  • 18,070
  • 14
  • 92
  • 160
5
votes
3 answers

Problem compiling program with pqxx

I'm trying to compile a very simple program (sample that does nothing) with pqxx, but cannot do it. Here's the 'program': $ cat xx.cpp #include…
Luis
  • 1,236
  • 5
  • 22
  • 31
5
votes
2 answers

How to perform IN in sql query using pqxx in c++ for postgresql?

How to perform IN in sql query using pqxx in c++ for postgresql ? I have vector of ids and I need to update every row in table students ( to set faculty_id to some new value). I want to avoid loop, new value (faculty_id) I get when I insert…
Damir
  • 54,277
  • 94
  • 246
  • 365
5
votes
2 answers

Inserting NULL/empty string using libpqxx library

In the following code snippet, the std::string object with name mac is sometimes an empty string (i.e. "") and I want the prepared statement to treat this variable automatically as null. I wonder how this can be achieved in the below code. In my…
F. Aydemir
  • 2,665
  • 5
  • 40
  • 60
5
votes
0 answers

Using COPY in pqxx

Now that tablestreams are deprecated, is there a different way to COPY large amounts of data into a database using pqxx? I'm currently using a prepared statement but am only getting about 4k inserts per second, which is not enough to keep up with…
ty.
  • 10,924
  • 9
  • 52
  • 71
5
votes
3 answers

How to use pqxx::stateless_cursor class from libpqxx?

I'm learning libpqxx, the C++ API to PostgreSQL. I'd like to use the pqxx::stateless_cursor class, but 1) I find the Doxygen output unhelpful in this case, and 2) the pqxx.org website has been down for some time now. Anyone know how to use it? I…
Stéphane
  • 19,459
  • 24
  • 95
  • 136
4
votes
2 answers

COPY csv file with additionnal datas

I have the following table : persons(id,id_tech,name,nationality,id_list) And a CSV file containing the datas for the column id_tech, name, and nationality. Importing the data like so is working : \copy persons(id_tech,name,nationality) FROM…
grunk
  • 14,718
  • 15
  • 67
  • 108
4
votes
1 answer

How to use perform a select on table under schema in postgres Database?

I'm trying to perform a select operation on postgres DB table and I'm getting below error: [etb@centos etbtest]$ ./a.out Opened database successfully: ETBDB ERROR: relation "etb_reference.etb_member" does not exist LINE 1: SELECT * FROM…
ramesh.metta
  • 139
  • 1
  • 1
  • 11
4
votes
2 answers

How to add libpqxx library to cmake?

I am working on my C++ simple project. I faced a crucial problem in CMakelists.txt. I cannot link libpqxx library correctly. I am using C++17 CMake 3.10 Ubuntu 16.04 CLion This my CMakelists.txt: cmake_minimum_required(VERSION…
user name
  • 165
  • 1
  • 8
1
2 3
15 16