Jump to content

[SOLVED] Unigine and libpqxx


photo

Recommended Posts

Posted

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?

Posted

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:

Posted (edited)

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
Posted

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:

Posted

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.

 

Posted
15 hours ago, simakov.artem said:

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

Could you please show how string is corrupted exactly?

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

Posted

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

Posted (edited)

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
Posted

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.

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