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
3
votes
0 answers

Does pqxx::pipeline support prepared statement

Can we execute Prepared statement(parametrised query) inside pqxx::pipeline, we can insert plain sql statement like: SELECT * FROM table but can we do something like given below pqxx::connection c; c.prepare("SELECT_QUERY", "SELECT * FROM…
twid
  • 6,368
  • 4
  • 32
  • 50
3
votes
0 answers

What is the fastest way to insert data into postgres using pqxx

I'm using pqxx as an api to access postgres from c++ code. I'm trying to insert a large amount of data and am finding the performance isn't good enough. I've tried several things and nothing is giving the performance that I need. I've been trying to…
dan
  • 1,525
  • 1
  • 17
  • 35
3
votes
1 answer

Using libpqxx for to store data in bulk OR how to use COPY statement in libpqxx

To insert bulk data/populate a database in PostgreSQL, the fastest way would be to use COPY. Source I have to populate a database. Right now I am getting write speeds as low as 100-200 per second. This involves sending many individual INSERTS…
digvijay91
  • 697
  • 1
  • 6
  • 21
3
votes
1 answer

Libpqxx complaining about missing references

So I have the following problem: g++ -std=c++0x -O3 -I/usr/include/scip main.cpp locations/locationreader.cpp locations/locationassigner.cpp scheduler.o optimizer.o dbmanager.o scheduleData.o exam.o -o main -L/usr/lib -lscip -lreadline -lgmp -lz…
csteifel
  • 2,854
  • 6
  • 35
  • 61
2
votes
1 answer

pqxx - prevent sql injection on table name

Is there any possible method to securely execute queries, where the table name is a parameter, like: TRUNCATE TABLE $1, table_string? Because my problem is that a user can create tables during runtime and can truncate their contents. And if I just…
mscha
  • 23
  • 3
2
votes
1 answer

libpqxx array data with prepared statements

In PostgreSQL we can store array data in columns. Lets say I have a postgres table like this: CREATE TABLE sal_emp ( name text, pay_by_quarter integer[], schedule text[][] ); Now I am using libpqxx to insert values to…
AllLuckBased
  • 157
  • 1
  • 14
2
votes
0 answers

C++ and pqxx accumulating a transaction

TL;DR - I am accumulating a transaction in postgresql (pqxx) and suspect I'm doing something overly tortuous to get where I'm going. In the first part of the question I've shown the naive way one might do a series of inserts and explain that it is…
jma
  • 3,580
  • 6
  • 40
  • 60
2
votes
2 answers

PostgreSQL: Return auto-generated ids from COPY FROM insertion

I have a non-empty PostgreSQL table with a GENERATED ALWAYS AS IDENTITY column id. I do a bulk insert with the C++ binding pqxx::stream_to, which I'm assuming uses COPY FROM. My problem is that I want to know the ids of the newly created rows, but…
2
votes
0 answers

How to get inserted/updated row also with notification

class receiver : public pqxx::notification_receiver { std::optional status; public: receiver(pqxx::connection_base & c, const std::string & channel) : pqxx::notification_receiver(c, channel) { } void operator()…
Austin
  • 29
  • 6
2
votes
2 answers

Postgresql connectors using VC++

How to add Libpqxx library in visual c++ .I googled it from past 2 days not able to get solution for the same I have downloaded and added libpqxx-4.0 but not able to add in visual studio can any give proper solution for this. Thanks in advance
2
votes
1 answer

Including libpqxx results in failed build on WSL using CMake

I'm currently in the process of upgrading a C++ application make use of a PostgreSQL database. Since we are typically running on *nix based systems I'm currently working within the Windows Subsystem for Linux (WSL) and a Ubuntu distribution in…
rjzii
  • 14,236
  • 12
  • 79
  • 119
2
votes
1 answer

How to correctly select date field using libpqxx?

I am trying to select date field from PostgreSQL database using libpqxx and C++. I would use this code, but I don't know if it is legal. I have searched in the documentation but I haven't any documented way. using time_point =…
Přemysl Šťastný
  • 1,676
  • 2
  • 18
  • 39
2
votes
1 answer

can't compile with libpqxx and xcode4 (c++)

I am trying to use libpqxx (3.1) in my C++ project in order to connect to my postgresql database. I am using the lastest version of xcode (xcode 4). I correctly made the install (./configure, make and make install) and added the library in my header…
mathieurip
  • 547
  • 1
  • 6
  • 16
2
votes
1 answer

Is there a way to insert vector into postgresql table, with bytea attribute, with no UTF8 encoding error?

I get ERROR: invalid byte sequence for encoding "UTF8": 0xe0 0x20 0x63 when i try to execute sql statement (insert into) of a std::vector into a bytea. I'm using c++ (11), and pqxx postgresql client, and posgresql 9.6 . I need to write into db a…
MrMartins
  • 93
  • 5
2
votes
1 answer

Issue with libpq.so.5 and PQencryptPasswordConn version RHPG_10 on Fedora30

I am trying to run my python script but I am getting below error. I tried to install and uninstall psycopg2 in different ways but is not working. My postgres version is 9.6 and my psycopg2 version is 2.8.2. Anyone had the same issue? Thanks in…
Joan Triay
  • 1,518
  • 6
  • 20
  • 35
1 2
3
15 16