simakov.artem Posted March 25, 2019 Share Posted March 25, 2019 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
silent Posted March 26, 2019 Share Posted March 26, 2019 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
simakov.artem Posted March 26, 2019 Author Share Posted March 26, 2019 (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 March 26, 2019 by simakov.artem Link to comment
silent Posted March 26, 2019 Share Posted March 26, 2019 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
simakov.artem Posted March 26, 2019 Author Share Posted March 26, 2019 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
silent Posted March 27, 2019 Share Posted March 27, 2019 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
simakov.artem Posted March 27, 2019 Author Share Posted March 27, 2019 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
benoit.andrieu Posted March 27, 2019 Share Posted March 27, 2019 (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 March 27, 2019 by benoit.andrieu Link to comment
simakov.artem Posted March 27, 2019 Author Share Posted March 27, 2019 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 Posted March 27, 2019 Share Posted March 27, 2019 Artem, MD should be fine :) Especially if you everything is working fine with this flag. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts