From il1k3pepsi at gmail.com Thu Apr 6 04:13:34 2017 From: il1k3pepsi at gmail.com (Henri Schwarz) Date: Thu Apr 6 04:47:51 2017 Subject: [odb-users] UTF-8 character set issue in schema_version table Message-ID: Hi all, currently I'm encountering a bug that is similar to the issue reported here . The difference is that it first appeared after I tried to make use of the schema migration features provided with ODB. So after adding *#pragma db model version (1, 1, open) *the ODB compiler created the following SQL code in the *.sql file.. CREATE TABLE IF NOT EXISTS `schema_version` ( `name` VARCHAR(255) NOT NULL PRIMARY KEY, `version` BIGINT UNSIGNED NOT NULL, `migration` TINYINT(1) NOT NULL) ENGINE=InnoDB; When I try to apply the schema to my database I get an error on the first line of the above statement. *ERROR 1071 (42000) at line 13: Specified key was too long; max key length is 767 bytes* Using the SQL statement provided with the old issue report (*show variables like '%char%';*) I got the following. +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ How I can I solve this issue? Help is much appreciated. Regards, From boris at codesynthesis.com Thu Apr 6 12:31:29 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 6 12:31:38 2017 Subject: [odb-users] UTF-8 character set issue in schema_version table In-Reply-To: References: Message-ID: Hi Henri, Henri Schwarz writes: > `name` VARCHAR(255) NOT NULL PRIMARY KEY, > > [...] > > *ERROR 1071 (42000) at line 13: Specified key was too long; max key length > is 767 bytes* > > [...] > > | character_set_database | utf8mb4 | The utf8mb4 is the issue. This means MySQL uses 4 bytes per character instead of 3 as was the case I guess until recently (that's where 255 comes from: 767/3). I've fixed this for the next release (now the default is 128 in case MySQL folks decide to use 5 bytes next week ;-)). Your options are as follows: 1. Change the database from utf8mb4 to utf8mb3. 2. Create a suitable schema_version table manually before calling the create_schema() function (which will omit creating it because of the IF NOT EXISTS clause). 3. I can build you a pre-release version of ODB with the fix. Let me know if you are interested in #3. Boris From iyatomi at gmail.com Mon Apr 10 03:51:06 2017 From: iyatomi at gmail.com (takehiro iyatomi) Date: Mon Apr 10 03:51:29 2017 Subject: [odb-users] question: persist operation for sqlite binding Message-ID: hi, thank you for creating odb. that saves my life a lot :D I use odb compiler with following version on linux ================= # odb --version ODB object-relational mapping (ORM) compiler for C++ 2.4.0 Copyright (c) 2009-2015 Code Synthesis Tools CC This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ================= and have encounter strange problem. when I try to persist object into sqlite database, it does not seem to respect value of database id column. suppose I define object that have id_ column as #pragma db id auto and set id_ to non-zero value before persist it into sqlite database. whatever value is set to id_ , sqlite silently ignored that value and returns auto-incremented id_ value as a result. I found generated code do something like following: =========================== if (init (im, obj, statement_insert)) im.version++; im.id_null = true; =========================== seems set true to id_null, no matter what set by init. if I change [im.id_null = true] to [im.id_null = obj.id_ == 0], problem solved. this is expected behavior? if so, should I expect same behavior for other database binding like mysql? regards, Takehiro Iyatomi From ps.georgiou at gmail.com Mon Apr 10 12:10:53 2017 From: ps.georgiou at gmail.com (Panayiotis Georgiou) Date: Mon Apr 10 12:11:06 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) Message-ID: Hello, I am trying to generate an MSVC project using ODB, with the help of the cmake scripts provided by Timo Rothenpieler at: https://github.com/BtbN/OdbCmake The issue I am having is that I cannot understand from the cmake scripts provide what is the expected folder structure, and as a result, cmake is unable to locate the necessary paths. The folder structure that I am currently using is as follows: ../ExternalLibraries/ODB/cmake/Modules (includes FindODB.cmake, UseODB.cmake) ../ExternalLibraries/ODB/libodb-2.4.0 (subfolders: bin, bin64, config, lib, lib64, m4, odb ) ../ExternalLibraries/ODB/libodb-boost-2.4.0 (subfolders: bin, bin64, config, lib, lib64, m4, odb ) ../ExternalLibraries/ODB/libodb-pgsql-2.4.0 (subfolders: bin, bin64, config, lib, lib64, m4, odb ) ../ExternalLibraries/ODB/libodb-qt-2.4.0 (subfolders: bin, bin64, config, lib, lib64, m4, odb ) ../ExternalLibraries/ODB/libodb-sqlite-2.4.0 (subfolders: bin, bin64, config, etc, lib, lib64, m4, odb ) ../ExternalLibraries/ODB/odb-2.4.0-i686-windows (subfolders: bin, doc, etc, man, mingw) Using the above folder structure cmake is unable to configure ODB. I have tried adding the path "../ExternalLibraries/ODB/libodb-2.4.0" in the variables CMAKE_PREFIX_PATH and ODB_LIBRARY_PATH but did not help. Can someone please help me in setting up the appropriate folder structure so that ODB is detected, or let me know if I am doing something else wrong? Thanks a lot. PG From timo at rothenpieler.org Mon Apr 10 12:23:04 2017 From: timo at rothenpieler.org (Timo Rothenpieler) Date: Mon Apr 10 12:23:11 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: References: Message-ID: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> See the provided example in that very repository. You need to add the directory that contains the two .cmake files to your CMAKE_MODULE_PATH. In case of the example: list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") There is no requirement for that path, it can be whatever you like. For finding the library, it needs to be in The module uses pkg-config to find odb itself. So if your pkg config path is properly set up, there is nothing special you need to do. Am 10.04.2017 um 18:10 schrieb Panayiotis Georgiou: > Hello, > > I am trying to generate an MSVC project using ODB, with the help of the > cmake scripts provided by Timo Rothenpieler at: > https://github.com/BtbN/OdbCmake > > The issue I am having is that I cannot understand from the cmake scripts > provide what is the expected folder structure, and as a result, cmake is > unable to locate the necessary paths. > > The folder structure that I am currently using is as follows: > > ../ExternalLibraries/ODB/cmake/Modules (includes FindODB.cmake, > UseODB.cmake) > ../ExternalLibraries/ODB/libodb-2.4.0 (subfolders: bin, bin64, config, > lib, lib64, m4, odb ) > ../ExternalLibraries/ODB/libodb-boost-2.4.0 (subfolders: bin, bin64, > config, lib, lib64, m4, odb ) > ../ExternalLibraries/ODB/libodb-pgsql-2.4.0 (subfolders: bin, bin64, > config, lib, lib64, m4, odb ) > ../ExternalLibraries/ODB/libodb-qt-2.4.0 (subfolders: bin, bin64, config, > lib, lib64, m4, odb ) > ../ExternalLibraries/ODB/libodb-sqlite-2.4.0 (subfolders: bin, bin64, > config, etc, lib, lib64, m4, odb ) > ../ExternalLibraries/ODB/odb-2.4.0-i686-windows (subfolders: bin, doc, etc, > man, mingw) > > Using the above folder structure cmake is unable to configure ODB. I have > tried adding the path "../ExternalLibraries/ODB/libodb-2.4.0" in the > variables CMAKE_PREFIX_PATH and ODB_LIBRARY_PATH but did not help. > > Can someone please help me in setting up the appropriate folder structure > so that ODB is detected, or let me know if I am doing something else wrong? > > Thanks a lot. > PG > From s02130359 at stud.cs.msu.ru Mon Apr 10 12:30:46 2017 From: s02130359 at stud.cs.msu.ru (=?utf-8?B?0JzQuNGF0LDQuNC7INCa0L7QvNCw0YDQvtCy?=) Date: Mon Apr 10 12:30:55 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> Message-ID: <10612BD5-E32C-40DE-9CFE-54069DB5291D@stud.cs.msu.ru> Hello! In fact, I have implemented CMake build system for some of ODB libraries and would like to propose to use some of it: https://github.com/Nemo1369/libodb-boost/tree/cmake https://github.com/Nemo1369/libodb-sqlite/tree/cmake https://github.com/Nemo1369/libodb/tree/cmake It is kinda outdated, but can be merged with current ODB state. Boris, what do you think of creating a branch with CMake-based build system in every Codesynthesis ODB-related repository? Sincerely yours, Mikhail Komarov s02130359@stud.cs.msu.ru > On 10 Apr 2017, at 19:23, Timo Rothenpieler wrote: > > See the provided example in that very repository. > You need to add the directory that contains the two .cmake files to your CMAKE_MODULE_PATH. > > In case of the example: > list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") > > There is no requirement for that path, it can be whatever you like. > For finding the library, it needs to be in > > The module uses pkg-config to find odb itself. So if your pkg config path is properly set up, there is nothing special you need to do. > > > Am 10.04.2017 um 18:10 schrieb Panayiotis Georgiou: >> Hello, >> I am trying to generate an MSVC project using ODB, with the help of the >> cmake scripts provided by Timo Rothenpieler at: >> https://github.com/BtbN/OdbCmake >> The issue I am having is that I cannot understand from the cmake scripts >> provide what is the expected folder structure, and as a result, cmake is >> unable to locate the necessary paths. >> The folder structure that I am currently using is as follows: >> ../ExternalLibraries/ODB/cmake/Modules (includes FindODB.cmake, >> UseODB.cmake) >> ../ExternalLibraries/ODB/libodb-2.4.0 (subfolders: bin, bin64, config, >> lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-boost-2.4.0 (subfolders: bin, bin64, >> config, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-pgsql-2.4.0 (subfolders: bin, bin64, >> config, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-qt-2.4.0 (subfolders: bin, bin64, config, >> lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-sqlite-2.4.0 (subfolders: bin, bin64, >> config, etc, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/odb-2.4.0-i686-windows (subfolders: bin, doc, etc, >> man, mingw) >> Using the above folder structure cmake is unable to configure ODB. I have >> tried adding the path "../ExternalLibraries/ODB/libodb-2.4.0" in the >> variables CMAKE_PREFIX_PATH and ODB_LIBRARY_PATH but did not help. >> Can someone please help me in setting up the appropriate folder structure >> so that ODB is detected, or let me know if I am doing something else wrong? >> Thanks a lot. >> PG > From boris at codesynthesis.com Mon Apr 10 12:35:18 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 10 12:35:27 2017 Subject: [odb-users] question: persist operation for sqlite binding In-Reply-To: References: Message-ID: Hi Takehiro, takehiro iyatomi writes: > hi, thank you for creating odb. that saves my life a lot :D Thanks, glad to hear that! > suppose I define object that have id_ column as #pragma db id auto > and set id_ to non-zero value before persist it into sqlite database. > whatever value is set to id_ , sqlite silently ignored that value and > returns auto-incremented id_ value as a result. > > [...] > > this is expected behavior? if so, should I expect same behavior for other > database binding like mysql? Yes, the semantics of automatically assigned object id is that the database, not you, assigns it (and guarantees that it will not conflict with any existing object id). This consistent across all the supported databases. Having said that, for SQLite and MySQL we have added this extra functionality (will be available in 2.5.0): http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4fd2c107242fe9f8e6ba7ded2a789f4de2ccd040 http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=fc65c4e978759fa10fc61341d98d4dccac42a53f Boris From s02130359 at stud.cs.msu.ru Mon Apr 10 12:38:30 2017 From: s02130359 at stud.cs.msu.ru (=?utf-8?B?0JzQuNGF0LDQuNC7INCa0L7QvNCw0YDQvtCy?=) Date: Mon Apr 10 12:38:37 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> Message-ID: <466C1936-4847-4DB1-B1AE-DDE330C5B1C5@stud.cs.msu.ru> Timo, I know, you were talking about looking for prebuilt libraries with CMake, but why don?t you just use the proposed libraries as a CMake submodule? Sincerely yours, Mikhail Komarov s02130359@stud.cs.msu.ru > On 10 Apr 2017, at 19:23, Timo Rothenpieler wrote: > > See the provided example in that very repository. > You need to add the directory that contains the two .cmake files to your CMAKE_MODULE_PATH. > > In case of the example: > list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") > > There is no requirement for that path, it can be whatever you like. > For finding the library, it needs to be in > > The module uses pkg-config to find odb itself. So if your pkg config path is properly set up, there is nothing special you need to do. > > > Am 10.04.2017 um 18:10 schrieb Panayiotis Georgiou: >> Hello, >> I am trying to generate an MSVC project using ODB, with the help of the >> cmake scripts provided by Timo Rothenpieler at: >> https://github.com/BtbN/OdbCmake >> The issue I am having is that I cannot understand from the cmake scripts >> provide what is the expected folder structure, and as a result, cmake is >> unable to locate the necessary paths. >> The folder structure that I am currently using is as follows: >> ../ExternalLibraries/ODB/cmake/Modules (includes FindODB.cmake, >> UseODB.cmake) >> ../ExternalLibraries/ODB/libodb-2.4.0 (subfolders: bin, bin64, config, >> lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-boost-2.4.0 (subfolders: bin, bin64, >> config, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-pgsql-2.4.0 (subfolders: bin, bin64, >> config, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-qt-2.4.0 (subfolders: bin, bin64, config, >> lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/libodb-sqlite-2.4.0 (subfolders: bin, bin64, >> config, etc, lib, lib64, m4, odb ) >> ../ExternalLibraries/ODB/odb-2.4.0-i686-windows (subfolders: bin, doc, etc, >> man, mingw) >> Using the above folder structure cmake is unable to configure ODB. I have >> tried adding the path "../ExternalLibraries/ODB/libodb-2.4.0" in the >> variables CMAKE_PREFIX_PATH and ODB_LIBRARY_PATH but did not help. >> Can someone please help me in setting up the appropriate folder structure >> so that ODB is detected, or let me know if I am doing something else wrong? >> Thanks a lot. >> PG > From timo at rothenpieler.org Mon Apr 10 12:41:43 2017 From: timo at rothenpieler.org (Timo Rothenpieler) Date: Mon Apr 10 12:41:49 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: <466C1936-4847-4DB1-B1AE-DDE330C5B1C5@stud.cs.msu.ru> References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> <466C1936-4847-4DB1-B1AE-DDE330C5B1C5@stud.cs.msu.ru> Message-ID: <5c6675a0-d153-0c0b-3ded-21e2f80039c7@rothenpieler.org> Am 10.04.2017 um 18:38 schrieb ?????? ???????: > Timo, I know, you were talking about looking for prebuilt libraries with CMake, but why don?t you just use the proposed libraries as a CMake submodule? You mean bundling the entirety of ODB? That's not how CMake find modules work. They find libraries installed into the system or some other location CMake can find it. Bundling external libraries only leads to a lot of pain maintainance wise in the long term, as you are now responsible for keeping them up to date as well. From ps.georgiou at gmail.com Mon Apr 10 12:49:47 2017 From: ps.georgiou at gmail.com (Panayiotis Georgiou) Date: Mon Apr 10 12:49:59 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: <5c6675a0-d153-0c0b-3ded-21e2f80039c7@rothenpieler.org> References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> <466C1936-4847-4DB1-B1AE-DDE330C5B1C5@stud.cs.msu.ru> <5c6675a0-d153-0c0b-3ded-21e2f80039c7@rothenpieler.org> Message-ID: Thanks for your reply. I have tried settings CMAKE_MODULE_PATH to point to my cmake modules path but it still doesn't work i.e. CMAKE_MODULE_PATH=../ExternalLibraries/ODB/ cmake/Modules. Apologise for my naive question, but what do you mean by "pkg config path is properly set up". Which paths are you referring to? PG On Mon, Apr 10, 2017 at 5:41 PM, Timo Rothenpieler wrote: > Am 10.04.2017 um 18:38 schrieb ?????? ???????: > >> Timo, I know, you were talking about looking for prebuilt libraries with >> CMake, but why don?t you just use the proposed libraries as a CMake >> submodule? >> > > You mean bundling the entirety of ODB? > That's not how CMake find modules work. They find libraries installed into > the system or some other location CMake can find it. > Bundling external libraries only leads to a lot of pain maintainance wise > in the long term, as you are now responsible for keeping them up to date as > well. > > From iyatomi at gmail.com Tue Apr 11 22:47:35 2017 From: iyatomi at gmail.com (takehiro iyatomi) Date: Tue Apr 11 22:47:58 2017 Subject: [odb-users] question: persist operation for sqlite binding In-Reply-To: References: Message-ID: Hi, Boris, sorry for late reply, I understand persist semantics. thanks! before 2.5.0 is out, I will use own insertion code to mix auto id assignment and providing manually. 2017?4?11?(?) 1:35 Boris Kolpackov : > Hi Takehiro, > > takehiro iyatomi writes: > > > hi, thank you for creating odb. that saves my life a lot :D > > Thanks, glad to hear that! > > > > suppose I define object that have id_ column as #pragma db id auto > > and set id_ to non-zero value before persist it into sqlite database. > > whatever value is set to id_ , sqlite silently ignored that value and > > returns auto-incremented id_ value as a result. > > > > [...] > > > > this is expected behavior? if so, should I expect same behavior for other > > database binding like mysql? > > Yes, the semantics of automatically assigned object id is that the > database, not you, assigns it (and guarantees that it will not > conflict with any existing object id). This consistent across > all the supported databases. > > Having said that, for SQLite and MySQL we have added this extra > functionality (will be available in 2.5.0): > > > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4fd2c107242fe9f8e6ba7ded2a789f4de2ccd040 > > > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=fc65c4e978759fa10fc61341d98d4dccac42a53f > > Boris > From il1k3pepsi at gmail.com Wed Apr 12 09:16:29 2017 From: il1k3pepsi at gmail.com (Henri Schwarz) Date: Wed Apr 12 10:15:28 2017 Subject: [odb-users] UTF-8 character set issue in schema_version table In-Reply-To: References: Message-ID: Hi Boris, at first I want to thank you very very much for your support. I tried to switch the character set of my database but due to another error I switched to sqlite and both errors vanished. It seems like MariaDB doesn't like schema versioning and polymorphic persistent classes as well. Kind regards, Henri 2017-04-06 18:31 GMT+02:00 Boris Kolpackov : > Hi Henri, > > Henri Schwarz writes: > > > `name` VARCHAR(255) NOT NULL PRIMARY KEY, > > > > [...] > > > > *ERROR 1071 (42000) at line 13: Specified key was too long; max key > length > > is 767 bytes* > > > > [...] > > > > | character_set_database | utf8mb4 | > > The utf8mb4 is the issue. This means MySQL uses 4 bytes per character > instead of 3 as was the case I guess until recently (that's where 255 > comes from: 767/3). > > I've fixed this for the next release (now the default is 128 in case > MySQL folks decide to use 5 bytes next week ;-)). Your options are > as follows: > > 1. Change the database from utf8mb4 to utf8mb3. > > 2. Create a suitable schema_version table manually before calling the > create_schema() function (which will omit creating it because of the > IF NOT EXISTS clause). > > 3. I can build you a pre-release version of ODB with the fix. > > Let me know if you are interested in #3. > > Boris > From boris at codesynthesis.com Mon Apr 10 12:54:06 2017 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 12 10:22:55 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: <10612BD5-E32C-40DE-9CFE-54069DB5291D@stud.cs.msu.ru> References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> <10612BD5-E32C-40DE-9CFE-54069DB5291D@stud.cs.msu.ru> Message-ID: Hi Mikhail, Mikhail Komarov writes: > Boris, what do you think of creating a branch with CMake-based build > system in every Codesynthesis ODB-related repository? I am, personally, not a big fan of CMake (to put it mildly) and am working on a build toolchain, build2[1], that will hopefully end this nightmare. Having said that, I realize that there are quite a few people who like CMake and who would prefer it over build2, potentially for a long time/forever. So my position regarding adding CMake support to ODB is this (which, I think, is "strict but fair" ;-)): 1. Someone needs to explicitly and seriously commit to not only implement complete CMake support, but to also maintain it for the foreseeable future. 2. The support must be complete, including all the tests (odb-tests) for all the supported databases and major platform/compiler combinations. 3. As soon as there is a slight hint that CMake support is being neglected, it will be removed. I realize that I am asking a lot and this is not very "contributor friendly", but I don't really have any bandwidth (nor desire) to end up maintain CMake support in ODB. [1] https://build2.org Boris From ps.georgiou at gmail.com Mon Apr 24 10:57:36 2017 From: ps.georgiou at gmail.com (Panayiotis Georgiou) Date: Mon Apr 24 10:57:48 2017 Subject: [odb-users] Using CMake for ODB (libraries forlder structre) In-Reply-To: References: <7f0246d6-10a5-51f6-1bd4-4c55794c6722@rothenpieler.org> <10612BD5-E32C-40DE-9CFE-54069DB5291D@stud.cs.msu.ru> Message-ID: Hello, I was able to detect the correct paths with CMake for ODB and it's components by including the following in my CMakeLists.txt list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") #includes FindODB.cmake and UseODB.cmake list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}") list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}/libodb-2.4.0") list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}/libodb-sqlite-2.4.0") list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}/libodb-boost-2.4.0") list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}/libodb-pgsql-2.4.0") list(APPEND CMAKE_PREFIX_PATH "${ODB_ROOT}/libodb-qt-2.4.0") Note that I am using windows with MSVC 2015 so from what I understand PkgConfig does not exist on windows. I have also included at the beginning of FindODB.cmake the following: set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) so that CMake can automatically detect the correct paths for 64bit libraries. This automatically appends the "64" suffix to paths, so that lib, bin become lib64 and bin64 in the detected paths. The problem that I am currently facing is that when I switch from Release to Debug within MSVC, Visual Studio is unable to link the correct debug libraries. How can I change the cmake files so that the correct debug libraries are selected when switching to debug build? Thanks a lot. On Mon, Apr 10, 2017 at 5:54 PM, Boris Kolpackov wrote: > Hi Mikhail, > > Mikhail Komarov writes: > > > Boris, what do you think of creating a branch with CMake-based build > > system in every Codesynthesis ODB-related repository? > > I am, personally, not a big fan of CMake (to put it mildly) and am > working on a build toolchain, build2[1], that will hopefully end this > nightmare. > > Having said that, I realize that there are quite a few people who like > CMake and who would prefer it over build2, potentially for a long > time/forever. > > So my position regarding adding CMake support to ODB is this (which, > I think, is "strict but fair" ;-)): > > 1. Someone needs to explicitly and seriously commit to not only implement > complete CMake support, but to also maintain it for the foreseeable > future. > > 2. The support must be complete, including all the tests (odb-tests) for > all the supported databases and major platform/compiler combinations. > > 3. As soon as there is a slight hint that CMake support is being neglected, > it will be removed. > > I realize that I am asking a lot and this is not very "contributor > friendly", but I don't really have any bandwidth (nor desire) to > end up maintain CMake support in ODB. > > [1] https://build2.org > > Boris > > From pustovalovdmit at gmail.com Fri Apr 28 04:23:13 2017 From: pustovalovdmit at gmail.com (=?UTF-8?B?0J/Rg9GB0YLQvtCy0LDQu9C+0LIg0JTQvNC40YLRgNC40Lk=?=) Date: Fri Apr 28 04:23:37 2017 Subject: [odb-users] safe usage odb connection pool in multi threaded environment (odb 2.4.0) Message-ID: Hi! I want to figure out a proper way to manage database connection pool assuming I want to use connection in different threads. As far as I understand I should do it like this: static constexpr auto max_connections = 20; // 1) create connection pool auto pool = std::make_unique(max_connections); // 2) bind it to database passing connection pool to odb::database constructor auto db = std::make_unique(user, password, db_name, host, 0, nullptr, "utf8", 0, std::move(pool)); // 3) get available connection_ptr from pool auto conn = db->connection(); // 4) use connection_ptr (possibly on other thread) std::thread t([&conn]() { auto& db = conn1->database(); odb::transaction t{conn1->begin()}; db.load(1); t.commit(); }); Is there a right way to accomplish my goal? I have few doubts in correctness and safety of code in lambda passed to thread: 1) When I pass transaction_impl (result of odb::connection::begin) to odb::transaction constructor does queries work on that connection not on some default odb::database connection 2) If I work directly with odb::connection assigned to connection pool does all queries work on one single default (first created?) connection from this pool. 3) Is it safe to use odb::database object concurrently without mutex protection if I get reference to it from connection (from odb::connection::database function). I mean I need odb::database interface in different threads, plain query interface of odb::conenction is not enough. Thanks in advance!