Jump to content

[SOLVED] Unigine and libpqxx


photo

Recommended Posts

Hello!

I want to use libpqxx (https://github.com/jtv/libpqxx) for working with postgresql database. But when I try to use this library (dynamic link), I get a runtime error when connect to the database (string with parameters doesn't achieve function, where they use, I don't understand why). Also, if I compile the standalone console project than all works fine. Can you help me with this problem?

Link to comment

Hi Artem,

There are other C++ wrappers for SQL DB connection available on market, did you have time to check them? I believe that this post is quite useful: https://stackoverflow.com/questions/1138503/good-c-c-connector-library-for-postgresql

Some say that SOCI library is a good choice for that task: https://github.com/SOCI/soci

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

silent, hi!

I haven't enough time for testing other libraries (maybe I will have time to test SQLAPI++ or SOCI, maybe not). But what is the problem to use libpqxx in Unigine project? What's wrong?

Edited by simakov.artem
Link to comment

Artem,

It's hard to guess based on a text description. I can't see any reasons why libpqxx shouldn't work. I doubt that linking with Unigine lib can even change the library behavior in any way.

If you build libpqxx to dll, check the dependencies (some dlls can be missing in %PATH%) and in that case you will get Windows 126 error printed in a engine log file.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hmm, maybe this example may be helpful?

If I use this raw in console project all works fine:

pqxx::connection* conn = new connection(std::string("dbname = postgres user = postgres hostaddr = 127.0.0.1"));

When I use this raw in unigine project, string with parameters is corrupted, when it achieves this function:

pqxx::connectionpolicy::connectionpolicy(const std::string &opts)

in libpqxx include. All include directories set up identically.

libpqxx is the latest version (6.4.2, also tested on 6.2.5, the same result), postgresql is 9.6.11, Unigine is 2.7.2.1.

 

Link to comment

Of course. In archive the screenshots with tracing: folder console is for console project, folder unigine - for unigine project. Also I must say, that different character set is not an issue.

testdb.zip

Link to comment

Hi

Issues with passing std types (string, vector...) between two libraries can be risen from preprocessor directives values that would be inconsistent between the projects.

Particularly I have similar problems with _ITERATOR_DEBUG_LEVEL

Good luck

Edited by benoit.andrieu
Link to comment

Wow, benoit.andrieu, thx!

Change "runtime library" to /MDd for debug and now it works (release works ok too). Is it correct to use this flag for Unigine debug configuration? If yes - the problem was solved, I think.

Link to comment
  • silent changed the title to [SOLVED] Unigine and libpqxx
×
×
  • Create New...