0

I'm new in PostgreSQL and pqxx. I code in C++. I've just written an exemple program. Everythig is alright but when I execute my program I see an error :

Started nontransaction while transaction still active.

Here's the code : http://pastebin.com/p8CJ6Eaz

If someone knows how to use those transactional objects please explain me. Greetings to all and thanks for help.

Marcello Bardus
  • 365
  • 2
  • 4
  • 13

1 Answers1

0

Message Started nontransaction while transaction still active actually is not an error. pqxx is not designed to handle nested transactions and it can handle only one transaction at a time. You can read the details here; pqxx reuse / reactivate a work transaction

Your code is actually working OK provided that you commit the transaction before issuing a non-transaction sql command, So I would change;

uncomment the commit on line 49 to finish the transaction; W.commit();

and change line 69 W.exec(sql); to non-transaction work; N.exec(sql);

Hope that helps.

Community
  • 1
  • 1
share
  • 315
  • 2
  • 6