From saigut at qq.com Mon Sep 2 04:06:45 2019 From: saigut at qq.com (=?ISO-8859-1?B?c2FpZ3V0?=) Date: Mon Sep 2 04:10:32 2019 Subject: [odb-users] How to qeury one column (or some columns) in a table? Message-ID: Hi all, I am using odb 2.4.0, I want to query one column of a table, but don't know how to do that. Say I have such table: user_info: int user_id, vchar user_name, int user_age I want do a query like "SELECT user_id FROM user_info", but I cannot find any method to do this with odb. And after I searched on google and the odb documentation I still don't know how to do. Can any one tell me how to qeury one column (or some columns) in a table with odb? Thanks. ------------------ Tony Saigut saigut@qq.com From saigut at qq.com Mon Sep 2 05:40:22 2019 From: saigut at qq.com (=?gb18030?B?c2FpZ3V0?=) Date: Mon Sep 2 05:44:12 2019 Subject: =?gb18030?B?u9i4tKO6IFtvZGItdXNlcnNdIEhvdyB0byBxZXVy?= =?gb18030?B?eSBvbmUgY29sdW1uIChvciBzb21lIGNvbHVtbnMp?= =?gb18030?B?IGluIGEgdGFibGU/?= In-Reply-To: References: Message-ID: It works as I expected by using table view, thank you Per! ------------------ Tony Saigut saigut@qq.com ------------original mail--------------------- Hi! I'm pretty sure Table Views can be used to accomplish what you want, see section 10.3 Table Views in the ODB documentation. https://codesynthesis.com/products/odb/doc/manual.xhtml#10.3 // Per On Mon, Sep 2, 2019 at 10:07 AM saigut wrote: > > Hi all, > > > I am using odb 2.4.0, I want to query one column of a table, but don't know how to do that. > > > Say I have such table: > user_info: > int user_id, vchar user_name, int user_age > > > I want do a query like "SELECT user_id FROM user_info", but I cannot find any method to do this with odb. And after I searched on google and the odb documentation I still don't know how to do. > > > Can any one tell me how to qeury one column (or some columns) in a table with odb? > > > Thanks. > > > ------------------ > Tony Saigut > saigut@qq.com From saigut at qq.com Mon Sep 2 05:58:48 2019 From: saigut at qq.com (=?ISO-8859-1?B?c2FpZ3V0?=) Date: Mon Sep 2 06:02:29 2019 Subject: [odb-users] How to make an object map to another table (same table structure) ? Message-ID: Hi all: Is it possible map a object to another table which has same table structure as the original one? Say I have a object class named "user_info": #pragram ...... calss user_info { int user_id; vchar user_name; int user_age; } And have such two table: user_info_01: int user_id, vchar user_name, int user_age user_info_02: int user_id, vchar user_name, int user_age Can I set object of class 'user_info' map to 'user_info_01' or to 'user_info_02' ? In my actual case, my program is going to create one table everyday which have the same table structure, those tables are only different in table name. So I want to operate those talbes with one class, because the names of all those tables are generate dynamically, I can't create classes for every table. Any help is appreciated. Thanks. ------------------ Tony Saigut saigut@qq.com From per.edin at sequence-point.se Mon Sep 2 04:46:59 2019 From: per.edin at sequence-point.se (Per Edin) Date: Mon Sep 2 09:14:47 2019 Subject: [odb-users] How to qeury one column (or some columns) in a table? In-Reply-To: References: Message-ID: Hi! I'm pretty sure Table Views can be used to accomplish what you want, see section 10.3 Table Views in the ODB documentation. https://codesynthesis.com/products/odb/doc/manual.xhtml#10.3 // Per On Mon, Sep 2, 2019 at 10:07 AM saigut wrote: > > Hi all, > > > I am using odb 2.4.0, I want to query one column of a table, but don't know how to do that. > > > Say I have such table: > user_info: > int user_id, vchar user_name, int user_age > > > I want do a query like "SELECT user_id FROM user_info", but I cannot find any method to do this with odb. And after I searched on google and the odb documentation I still don't know how to do. > > > Can any one tell me how to qeury one column (or some columns) in a table with odb? > > > Thanks. > > > ------------------ > Tony Saigut > saigut@qq.com From icewill9999 at vip.qq.com Tue Sep 3 03:37:05 2019 From: icewill9999 at vip.qq.com (=?gb18030?B?srvD99Xmz+A=?=) Date: Tue Sep 3 14:07:45 2019 Subject: [odb-users] how to perform query_one on object view Message-ID: Hi guys: i have a view defined like below: #pragma db view object... struct SingleWellQuery { std::tr1::shared_ptr well; }; and if i use query_one : shared_ptr wellq(db->query_one(....)); This line will give a compiler error Error C2440 'initializing': cannot convert from 'std::shared_ptr' to 'pointer_type'. query works fine, but with this situation i only get one record, is query_one work for object view? Best Regards From moni.idzik at gmail.com Tue Sep 3 16:31:30 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Wed Sep 4 08:44:20 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships Message-ID: Dear ODB-Users, I encountered a problem trying to make a one-to-many relationship in odb, I get the following error: src/experiment_configuration/experiment_configuration.hpp:218:43: error: unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ::performance_test::AnalysisResult > >::value_type' used in data member 'results' to a SQLite database type src/experiment_configuration/experiment_configuration.hpp:218:43: info: use '#pragma db value_type' to specify the database type I have one class called ExeprimentConfiguration and one class AnalysisResult. I want to have one (ExeprimentConfiguration) to many (AnalysisResult) relationship between them. These 2 classes are in two separate files: src/experiment_configuration/experiment_configuration.hpp and src/experiment_execution/analysis_result.hpp Here basic code from the files: //experiment_configuration.hpp #include class AnalysisResult; #pragma db object class ExperimentConfiguration { public: ... private: ... friend class odb::access; #pragma db id boost::uuids::uuid m_id; #pragma db value_not_null inverse(configuration) std::vector> results; }; //analysis_result.hpp #include #include "../experiment_configuration/experiment_configuration.hpp" #pragma db object class AnalysisResult { public: ... private: ... friend class odb::access; ... #pragma db id unsigned long id_; #pragma db not_null std::shared_ptr configuration; }; I followed here section 6.2.2. One-to-Many Relationships in the odb manual. I use ODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.16 and gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Could you help me figuring out what I'm doing wrong? Thank you, Monika From boris at codesynthesis.com Wed Sep 4 10:00:32 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 4 10:04:10 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships In-Reply-To: References: Message-ID: Monika Idzik writes: > I have one class called ExeprimentConfiguration and one class > AnalysisResult. I want to have one (ExeprimentConfiguration) to many > (AnalysisResult) relationship between them. These 2 classes are in two > separate files [...] That's most likely where the problem is, as discussed in Section 6.3, "Circular Relationships". From boris at codesynthesis.com Wed Sep 4 10:36:46 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 4 10:40:25 2019 Subject: [odb-users] How to make an object map to another table (same table structure) ? In-Reply-To: References: Message-ID: saigut writes: > #pragram ...... > calss user_info { > int user_id; > vchar user_name; > int user_age; > } > > > And have such two table: > user_info_01: > int user_id, vchar user_name, int user_age > > user_info_02: > int user_id, vchar user_name, int user_age > > > Can I set object of class 'user_info' map to 'user_info_01' or to > 'user_info_02' ? No, the best you can do is make user_info a template and then have two instantiations (using something like a tag to make sure they are different) mapped to the two tables. But it still has to be all mapped at compile time. > In my actual case, my program is going to create one table everyday > which have the same table structure, those tables are only different > in table name. So I want to operate those talbes with one class, > because the names of all those tables are generate dynamically, > I can't create classes for every table. No, this will be difficult to achieve. You could probably come up with a view to read from such tables but not an object. If you can change your approach, for example, by adding a column that indicates a day rather than creating a table, then it will be easier to map this to ODB. From moni.idzik at gmail.com Thu Sep 5 12:07:34 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Thu Sep 5 12:11:33 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships In-Reply-To: References: Message-ID: I read this section and added #include "analysis_result.hpp" at the end of experiment_configuration.hpp file, what was mentioned in the section. However, it didn't resolve the: unable to map C++ type error... Can it be a different reason for such behavior other than "circular relationships"? That's most likely where the problem is, as discussed in Section 6.3, > "Circular Relationships". > From moni.idzik at gmail.com Thu Sep 5 12:48:23 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Thu Sep 5 12:52:22 2019 Subject: [odb-users] issue while working with MySQL database Message-ID: Dear ODB users, I have an issue with adding MySQL support into my odb project - I previously used SQLite and had no problems at all, now I'm adding MySQL option and getting a loong list of errors starting with this one in odb_gen/*_odb .hpp and .cpp files: /usr/local/include/odb/mysql/binding.hxx:28:26: error: expected ?)? before ?*? token binding (MYSQL_BIND* b, std::size_t n) ^/usr/local/include/odb/mysql/binding.hxx:33:7: error: ?MYSQL_BIND? does not name a type; did you mean ?MYSQL_TIME?? MYSQL_BIND* bind; ^~~~~~~~~~ MYSQL_TIME/usr/local/include/odb/mysql/binding.hxx: In constructor ?odb::mysql::binding::binding()?:/usr/local/include/odb/mysql/binding.hxx:26:19: error: class ?odb::mysql::binding? does not have any field named ?bind? binding (): bind (0), count (0), version (0) {} ^~~~/usr/local/include/mysql/mysql/client_plugin.h: At global scope::0:7: error: expected identifier before numeric constant:0:7: error: expected unqualified-id before numeric constant:0:7: error: expected identifier before numeric constant:0:7: error: expected ?,? or ?...? before numeric constant I assume I don't include some library...? I have libodb-mysql installed, added mysql to -d option, included where I create new odb::mysql::database... do I miss something? Thank you, Monika From moni.idzik at gmail.com Thu Sep 5 18:12:16 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Thu Sep 5 18:16:16 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships In-Reply-To: References: Message-ID: Actually, I tried some more things: 1. I put those two classes into one file -> still the same error. 2. I just copied relationship example into my project from examples provided on the website -> still the same error. I'm kind of confused now, I use the same code as in an example, the same options for odb compilation, so what's wrong? czw., 5 wrz 2019 o 09:07 Monika Idzik napisa?(a): > I read this section and added > > #include "analysis_result.hpp" at the end of experiment_configuration.hpp > file, what was mentioned in the section. > > However, it didn't resolve the: unable to map C++ type error... > Can it be a different reason for such behavior other than "circular > relationships"? > > > That's most likely where the problem is, as discussed in Section 6.3, >> "Circular Relationships". >> > From boris at codesynthesis.com Fri Sep 6 07:59:19 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 6 08:03:02 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships In-Reply-To: References: Message-ID: Monika Idzik writes: > 1. I put those two classes into one file -> still the same error. > 2. I just copied relationship example into my project from examples > provided on the website -> still the same error. I copied the two classes from the manual to test.hpp and adjusted it to match your example: //--------------------------------------------------- #include #include class employee; #pragma db object class position { public: #pragma db id unsigned long id_; #pragma db inverse(position_) std::vector> employee_; }; #pragma db object class employee { public: #pragma db id unsigned long id_; #pragma db not_null std::shared_ptr position_; }; //--------------------------------------------------- I could then successfully compile it like this: $ odb -d mysql --std c++11 test.hpp $ odb --version ODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.16 From boris at codesynthesis.com Fri Sep 6 08:04:17 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 6 08:08:00 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: Message-ID: Monika Idzik writes: > ^/usr/local/include/odb/mysql/binding.hxx:33:7: error: > ?MYSQL_BIND? does not name a type; did you mean ?MYSQL_TIME?? Are you using MySQL or MariaDB and which version? Look into odb/mysql/mysql-types.hxx and see if you can figure out what's going on. From moni.idzik at gmail.com Fri Sep 6 14:14:57 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Fri Sep 6 14:19:02 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: Message-ID: I'm using odb 2.5.0-b.15, installed by following the instructions from https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#linux for odb and runtime libraries including mysql. So I have libodb-mysql-2.5.0-b.15 and libmysqlclient-8.0.15+1. in odb/mysql/mysql-types.hxx I see that "Starting with 8.0.11 MySQL renamed st_mysql_bind to MYSQL_BIND" but I have mysql 8.0.15 so it should be fine. Not sure what to search for here? Are you using MySQL or MariaDB and which version? > > Look into odb/mysql/mysql-types.hxx and see if you can figure out > what's going on. > From moni.idzik at gmail.com Fri Sep 6 14:37:51 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Fri Sep 6 14:41:42 2019 Subject: [odb-users] unable to map C++ type '::__gnu_cxx::new_allocator< ::std::weak_ptr< ... error in One-to-Many relationships In-Reply-To: References: Message-ID: What helped me compile, was to add "pointer(std::shared_ptr) to #pragma db object" in both classes, so like this: #pragma db object pointer(std::shared_ptr) class ExperimentCconfiguration Anyway, thank you for help! pt., 6 wrz 2019 o 04:59 Boris Kolpackov napisa?(a): > Monika Idzik writes: > > > 1. I put those two classes into one file -> still the same error. > > 2. I just copied relationship example into my project from examples > > provided on the website -> still the same error. > > I copied the two classes from the manual to test.hpp and adjusted > it to match your example: > > //--------------------------------------------------- > #include > #include > > class employee; > > #pragma db object > class position > { > public: > #pragma db id > unsigned long id_; > > #pragma db inverse(position_) > std::vector> employee_; > }; > > #pragma db object > class employee > { > public: > #pragma db id > unsigned long id_; > > #pragma db not_null > std::shared_ptr position_; > }; > //--------------------------------------------------- > > I could then successfully compile it like this: > > $ odb -d mysql --std c++11 test.hpp > > $ odb --version > ODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.16 > From saigut at qq.com Sat Sep 7 21:56:56 2019 From: saigut at qq.com (=?gb18030?B?yPy/wsTQXl5e?=) Date: Sat Sep 7 22:02:13 2019 Subject: [odb-users] How to make an object map to another table (same table structure) ? In-Reply-To: References: Message-ID: > No, this will be difficult to achieve. You could probably come > up with a view to read from such tables but not an object. If you > can change your approach, for example, by adding a column that > indicates a day rather than creating a table, then it will be > easier to map this to ODB. Thanks. It seems the only way is to redesign the db table to use only one table rather than using a table every day. ------------------ Tony Saigut saigut@qq.com From boris at codesynthesis.com Mon Sep 9 06:42:02 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 9 06:45:54 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: Message-ID: Monika Idzik writes: > I'm using odb 2.5.0-b.15, installed by following the instructions from > https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#linux > for odb and runtime libraries including mysql. > So I have libodb-mysql-2.5.0-b.15 and libmysqlclient-8.0.15+1. > > in odb/mysql/mysql-types.hxx I see that > "Starting with 8.0.11 MySQL renamed st_mysql_bind to MYSQL_BIND" but I have > mysql 8.0.15 so it should be fine. That is enabled based on the MYSQL_VERSION_ID macro check which comes from . I suspect that you have mysql_version.h somewhere else in your system that happened to get included before the file installed from libmysqlclient-8.0.15+1. Can you search your system for other mysql_version.h? From moni.idzik at gmail.com Tue Sep 10 14:13:21 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Tue Sep 10 14:17:37 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: Message-ID: I indeed had other mysql_version.h file. But I deleted it, actually the whole mysql folder where this file was, reinstalled all the mysql libodb and I still get the same error. > Can you search your system for other mysql_version.h? > From karen at codesynthesis.com Wed Sep 11 08:44:52 2019 From: karen at codesynthesis.com (Karen Arutyunov) Date: Wed Sep 11 08:48:51 2019 Subject: [odb-users] issue while working with MySQL database Message-ID: <4b49b933-21e6-a5a8-f16e-a284c273fa6c@codesynthesis.com> > now I'm adding MySQL option and getting a loong list of errors > starting with this one in odb_gen/*_odb .hpp and .cpp files Yes, there is a bug in the latest libodb-mysql that may pop up when build your project against libmysqlclient >= 8.0.11. The fix is pushed to the git repository but is not released. Could you give it a try? Given you have installed ODB by following instructions at https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#linux and still have the odb-build directory around, run the following commands to upgrade libodb-mysql from the git repository: $ cd odb-build/gcc-X $ bpkg build libodb-mysql@https://git.codesynthesis.com/odb/libodb-mysql.git#fix-bind-decl $ bpkg install libodb-mysql And thanks for the report. From moni.idzik at gmail.com Wed Sep 11 14:31:03 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Wed Sep 11 14:35:22 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: <4b49b933-21e6-a5a8-f16e-a284c273fa6c@codesynthesis.com> References: <4b49b933-21e6-a5a8-f16e-a284c273fa6c@codesynthesis.com> Message-ID: Thank you for the answer! However, when executing $ bpkg build libodb-mysql@ https://git.codesynthesis.com/odb/libodb-mysql.git#fix-bind-decl I get the following error: disfigured libodb-mysql/2.5.0-b.15 distributing libodb-mysql/2.5.0-b.16.20190911114344.119470bf7a34 error: prerequisite .bpkg/tmp/libodb-mysql/odb/mysql/:details/hxx{options} is not existing source file nor known output target warning: repository state is now broken info: run 'bpkg rep-fetch' to repair Can you double check it? $ bpkg build > libodb-mysql@ > https://git.codesynthesis.com/odb/libodb-mysql.git#fix-bind-dec > From karen at codesynthesis.com Wed Sep 11 15:29:18 2019 From: karen at codesynthesis.com (Karen Arutyunov) Date: Wed Sep 11 15:33:19 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: <4b49b933-21e6-a5a8-f16e-a284c273fa6c@codesynthesis.com> Message-ID: > I get the following error: > > disfigured libodb-mysql/2.5.0-b.15 > distributing libodb-mysql/2.5.0-b.16.20190911114344.119470bf7a34 > error: prerequisite > .bpkg/tmp/libodb-mysql/odb/mysql/:details/hxx{options} is not existing > source file nor known output target > warning: repository state is now broken > ? info: run 'bpkg rep-fetch' to repair Yeah, making libodb-mysql buildable from git repository is a bit tricky. I pushed a fix. Could you retry: $ cd odb-build/gcc-X $ bpkg build libodb-mysql@https://git.codesynthesis.com/odb/libodb-mysql.git#fix-bind-decl $ bpkg install libodb-mysql From moni.idzik at gmail.com Wed Sep 11 16:45:39 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Wed Sep 11 16:49:58 2019 Subject: [odb-users] issue while working with MySQL database In-Reply-To: References: <4b49b933-21e6-a5a8-f16e-a284c273fa6c@codesynthesis.com> Message-ID: It compiles now fine! Thank you for the support and fast response! Could you retry: > $ cd odb-build/gcc-X > > $ bpkg build > libodb-mysql@ > https://git.codesynthesis.com/odb/libodb-mysql.git#fix-bind-decl > > $ bpkg install libodb-mysql > From moni.idzik at gmail.com Wed Sep 11 20:06:20 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Wed Sep 11 20:10:40 2019 Subject: [odb-users] unable to map C++ type '::std::chrono::duration< double >' Message-ID: Dear odb Users, I'm getting an error: error: unable to map C++ type '::std::chrono::duration< double >' used in data member 'test_chrono' to a MySQL database type when trying to declare the variable of type std::chrono::duration. I know I could use boost::posix_time::time_duration with boost profile, but I want to be able to add also std::chrono variables. Is there a way to do this? Thank you, Monika From PStath at jmawireless.com Thu Sep 12 12:33:11 2019 From: PStath at jmawireless.com (Paul Stath) Date: Thu Sep 12 12:37:25 2019 Subject: [odb-users] unable to map C++ type '::std::chrono::duration< double >' Message-ID: Sorry, forgot to CC mailing list. -----Original Message----- From: Paul Stath Sent: Thursday, September 12, 2019 12:31 PM To: Monika Idzik Subject: RE: [odb-users] unable to map C++ type '::std::chrono::duration< double >' Hi Monika, You should always include the definition for the class you are trying to map. (If proprietary, then create a similar test class that exhibits the same problem.) Firstly, do you really wish to store a std::chrono::duration attribute in your data object? Normally, I would have a std::chrono::time_point attribute, since I want to store a point in time. Are you really trying to store a time duration (difference between two timepoints)? The second question is what time precision do you need in your data object? If you only need 1 second precision, then I would suggest the following: Use boost::posix_time::ptime as your timestamp variable and include the boost profile. Make this a private class variable (timestamp_) and provide getter/setter class methods that allow you to get/set the attribute. You can overload the setTimestamp() method to set the value of the timestamp attribute using whatever time/date datatype you need. Getting the timestamp in different time/data datatypes would require multiple getter methods. --- Paul -----Original Message----- From: Monika Idzik Sent: Wednesday, September 11, 2019 8:06 PM To: odb-users@codesynthesis.com Subject: [odb-users] unable to map C++ type '::std::chrono::duration< double >' Dear odb Users, I'm getting an error: error: unable to map C++ type '::std::chrono::duration< double >' used in data member 'test_chrono' to a MySQL database type when trying to declare the variable of type std::chrono::duration. I know I could use boost::posix_time::time_duration with boost profile, but I want to be able to add also std::chrono variables. Is there a way to do this? Thank you, Monika From moni.idzik at gmail.com Thu Sep 12 19:45:11 2019 From: moni.idzik at gmail.com (Monika Idzik) Date: Thu Sep 12 19:49:34 2019 Subject: [odb-users] unable to map C++ type '::std::chrono::duration< double >' In-Reply-To: References: Message-ID: Hi Paul, thank you for the answer. I'm integrating odb into a bigger project that's why I want to use whatever already is being used in a project (and try not to change it if I don't have to). The variable type is std::chrono::duration, that's why I want to have it also in the database. I'm just asking if it's possible, not if it's the best way to represent the time duration/time point. I need the precision of microseconds for this project. I didn't include the header cause it's a bigger project, but basically it would look something like this: #include #pragma db object class TestChonoClass { public: ... private: friend class odb::access; #pragma db id auto unsigned long id_; const std::chrono::duration test_chrono; }; If there is no easy way to have std::chrono::duration in the database. I will try with the boost library; just wanted to know if I need to change the existing code to have this particular value in the database. Firstly, do you really wish to store a std::chrono::duration attribute in > your data object? > > The second question is what time precision do you need in your data object? > From karen at codesynthesis.com Fri Sep 13 05:23:41 2019 From: karen at codesynthesis.com (Karen Arutyunov) Date: Fri Sep 13 05:27:47 2019 Subject: [odb-users] unable to map C++ type '::std::chrono::duration< double >' In-Reply-To: References: Message-ID: <915d6375-4980-8ead-6fc9-f60ff0e03747@codesynthesis.com> > The variable type is std::chrono::duration, that's why I want to have it > also in the database. I'm just asking if it's possible, not if it's the > best way to represent the time duration/time point. You can probably use the type mapping. In our build2 toolchain project we use it for mapping timestamp (aka std::chrono::system_clock::time_point) to uint64_t as a number of nanoseconds from epoch: #pragma db map type(timestamp) as(uint64_t) \ to(std::chrono::duration_cast ( \ (?).time_since_epoch ()).count ()) \ from(brep::timestamp ( \ std::chrono::duration_cast ( \ std::chrono::nanoseconds (?)))) For more details see https://git.build2.org/cgit/brep/tree/libbrep/common.hxx#n107 From cezanmeyen at gmail.com Fri Sep 13 05:36:22 2019 From: cezanmeyen at gmail.com (Cezan Meyen) Date: Fri Sep 13 05:40:45 2019 Subject: [odb-users] memSQL support Message-ID: Hello, I was wondering if memSQL is supported or can be supported with some small alterations. memSQL is a relatively new well performing RDBMS that is 100% compatible with MySQL. It should then in theory be as simple as generating code for MySQL and then linking it to the memSQL database. Since ODB provides libraries per database I was wondering if altering the library might work for memSQL or if the lib is completely depended on MySQL and altering would not work at all. Kind regards, C?zan From zongrenzhou at 163.com Wed Sep 18 05:31:55 2019 From: zongrenzhou at 163.com (=?GBK?B?ufq74Q==?=) Date: Thu Sep 19 10:05:39 2019 Subject: [odb-users] odb-bug Message-ID: <1785c77e.bf3d.16d43b6c830.Coremail.zongrenzhou@163.com> In the odb-examples-2.4.0 ZIP ?the word mysql was replaced with mssql in some file. -------------- next part -------------- A non-text attachment was scrubbed... Name: bug.png Type: image/png Size: 72332 bytes Desc: not available Url : https://codesynthesis.com/pipermail/odb-users/attachments/20190918/01f1ce03/bug-0001.png From boris at codesynthesis.com Thu Sep 19 10:13:42 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 19 10:18:10 2019 Subject: [odb-users] memSQL support In-Reply-To: References: Message-ID: Cezan Meyen writes: > I was wondering if memSQL is supported or can be supported with some small > alterations. memSQL is a relatively new well performing RDBMS that is 100% > compatible with MySQL. It should then in theory be as simple as generating > code for MySQL and then linking it to the memSQL database. Since ODB > provides libraries per database I was wondering if altering the library > might work for memSQL or if the lib is completely depended on MySQL and > altering would not work at all. We already kind of do it for the MySQL and MariaDB support. So if memSQL uses the client library from MySQL or has its own client library that is (mostly) API compatible with memSQL (MarisDB's case), then this should be doable. If you get the latest source[1] and grep for `mariadb` (case-insensitive), you can get a sense of what might need to be adjusted. If the changes are not too hairy, we may even consider upstreaming them (though we will need to first package memSQL's client library, if there is one, similar to MySQL and MariaDB[2]). [1] The git repo is here: https://git.codesynthesis.com/cgit/odb/ Or you can build the fairly recent snapshot by following these instructions: https://codesynthesis.com/products/odb/doc/install-build2.xhtml But using the staging repository: https://build2.org/community.xhtml#stage [2] https://github.com/build2-packaging/ From boris at codesynthesis.com Fri Sep 20 13:22:20 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 20 13:26:56 2019 Subject: [odb-users] odb-bug In-Reply-To: <1785c77e.bf3d.16d43b6c830.Coremail.zongrenzhou@163.com> References: <1785c77e.bf3d.16d43b6c830.Coremail.zongrenzhou@163.com> Message-ID: ?? writes: > In the odb-examples-2.4.0 ZIP ?the word mysql was replaced with mssql > in some file. No, `mssql` is the short name we use to refer to the Microsoft SQL Server and the odb-examples package works with all the databases supported by ODB. If you look up the code you refer to, you will see there is the `mysql` version of the same fragment. Also, please don't send images of the errors/issues that you are reporting. See posting guidelines, specifically item #6 for details: https://codesynthesis.com/support/posting-guidelines.xhtml