From xuewen.ok at gmail.com Tue May 14 11:14:36 2024 From: xuewen.ok at gmail.com (xuewen wang) Date: Wed May 15 08:58:01 2024 Subject: [odb-users] Problem: Generated unfinished -odb.cxx with unimplemented pure virtual function Message-ID: Compiler version: obd 2.5.0-b.25+1 Building environment: build2 on ubuntu 22.04.4LTS GCC version: gcc 11.04 Issue: the odb compiler doesn't finish generating the -odb.cxx file it stops after generating the init functions. To reproduce the problem, compile the Persion.h with the following command line: odb --database sqlite --generate-query --generate-schema --std c++11 Persion.h The Person.h file: //============================================= class Person { public: virtual void test() = 0; }; #pragma db object class Student : public Person { public: int id; }; //============================================= The tail of generated Persion-odb.cxx: //============================================= ...... void access::object_traits_impl< ::Student, id_sqlite >:: init (object_type& o, const image_type& i, database* db) { ODB_POTENTIALLY_UNUSED (o); ODB_POTENTIALLY_UNUSED (i); ODB_POTENTIALLY_UNUSED (db); // id // { int& v = o.id; sqlite::value_traits< int, sqlite::id_integer >::set_value ( v, i.id_value, i.id_null); } } } #include //============================================== Best regards... ---- Sean Wang (Xuewen Wang), Beijing, China. From xuewen.ok at gmail.com Wed May 15 02:35:42 2024 From: xuewen.ok at gmail.com (xuewen wang) Date: Wed May 15 08:58:01 2024 Subject: [odb-users] Re: Problem: Generated unfinished -odb.cxx with unimplemented pure virtual function In-Reply-To: References: Message-ID: More details: Dear ODB Compiler Team, I hope this message finds you well. I am currently working on a project involving the ODB compiler and have encountered some issues related to the handling of pure virtual functions in inherited classes. I would appreciate your assistance in addressing these concerns. 1. **Non-Generation of Query Functions for Derived Classes with Pure Virtual Functions:** In my code, I have a base class Person with a pure virtual function test() . The derived class Student , which is also an ODB-managed object, does not seem to have query functions generated by ODB when there is a pure virtual function in the parent class. class Person { public: virtual void test() = 0; }; #pragma db object class Student : public Person { public: #pragma db id auto int id; }; 2. **Lack of Compiler Warnings or Errors for Unimplemented Pure Virtual Functions:** When I forget to implement the pure virtual function test() in the derived class Student , the ODB compiler neither issues a warning nor an error during compilation. This omission leads to compiling issues of target project that are difficult to trace back to the source. 3. **Suggestion for Improvement:** It would be highly beneficial for developers if the ODB compiler could provide a warning or error when query functions are omitted due to the presence of unimplemented pure virtual functions in derived classes. Write comments in the generated source code to tell that there are unimplemented pure functions in the base class. These features would help avoid potential runtime problems and improve code reliability. Could you please provide guidance on whether there are existing compiler options that I might have missed which address these issues? Additionally, your thoughts on the possibility of enhancing the compiler to handle such cases more transparently would be greatly appreciated. Thank you for your time and assistance. I look forward to your response. Best regards... ---- Sean Wang (Xuewen Wang), Beijing, China. On Tue, May 14, 2024 at 11:14?PM xuewen wang wrote: > Compiler version: obd 2.5.0-b.25+1 > Building environment: build2 on ubuntu 22.04.4LTS > GCC version: gcc 11.04 > > Issue: the odb compiler doesn't finish generating the -odb.cxx file > it stops after generating the init functions. > To reproduce the problem, compile the Persion.h with the following command > line: > odb --database sqlite --generate-query --generate-schema --std c++11 > Persion.h > > The Person.h file: > //============================================= > class Person { > public: > virtual void test() = 0; > }; > > > #pragma db object > class Student : public Person { > public: > int id; > }; > //============================================= > > The tail of generated Persion-odb.cxx: > //============================================= > ...... > void access::object_traits_impl< ::Student, id_sqlite >:: > init (object_type& o, > const image_type& i, > database* db) > { > ODB_POTENTIALLY_UNUSED (o); > ODB_POTENTIALLY_UNUSED (i); > ODB_POTENTIALLY_UNUSED (db); > > // id > // > { > int& v = > o.id; > > sqlite::value_traits< > int, > sqlite::id_integer >::set_value ( > v, > i.id_value, > i.id_null); > } > } > } > > #include > //============================================== > Best regards... > ---- Sean Wang (Xuewen Wang), Beijing, China. > From sunny.sun at ringcentral.com Mon May 27 05:29:19 2024 From: sunny.sun at ringcentral.com (Sunny Sun) Date: Tue Jun 25 04:54:11 2024 Subject: [odb-users] It was blocked by odb::sqlite::connection_pool_factory::create() Message-ID: Hi Boris, We encountered a problem that was the thread was blocked by odb::sqlite::connection_pool_factory::create(). We created a new db file with odb::sqlite::database, then we call db->schema_version() which will call odb::sqlite::connection_pool_factory::create(). But it was blocked. What I want to know is: 1. What will cause this block? 2. How to avoid this block? 2. Is there any approach to recover from the block? We use ODB 2.4.0 and sqlite. If you need more information, please let me know. Thank you very much. From uwe.kindler at cetoni.de Mon May 27 09:51:15 2024 From: uwe.kindler at cetoni.de (CETONI GmbH - Uwe Kindler) Date: Tue Jun 25 04:54:11 2024 Subject: [odb-users] MSVC19 link error: LNK2001: Unresolved external symbol Message-ID: <344ee50b-56e7-4e53-954c-4f84443422e1@cetoni.de> Hi, We use orm-odb now since some years with MinGW compiler on Windows. Now we decided to switch from MinGW to MSVC19 compiler from Microsoft. Whe could successfully build the ORM odb libraries following the instructions from here: https://codesynthesis.com/products/odb/doc/install-build2.xhtml#windows-odb Now,? when we link our shared library that uses ODB and that implements the databse classes, we see the following linker error: error LNK2001: Unresolved external symbol ""struct odb::details::share odb::details::shared" (?shared@details@odb@@3Ushare@12@A)" The symbol is declared in odb/details/shared_ptr/base.hxx: namespace odb { ? namespace details ? { ??? struct share ??? { ????? explicit ????? share (char id); ????? bool ????? operator== (share) const; ??? private: ????? char id_; ??? }; ??? extern LIBODB_EXPORT share shared; ??? extern LIBODB_EXPORT share exclusive; ? } } For me it looks like although the symbols are labeled properly with LIBODB_EXPORT, they are not exported properly from the DLL. The same code works fine with MinGW, because MinGW exports all symbols. I have no real idea, how to solve this issue. Has someone an idea, how this can be solved? Is this an ODB issue or an MSVC compiler issue - or maybe I'm doing something wrong: Environment: libodb-2.5.0-b.25 MSVC version: 19.29.30154 for 64 bit Qt Version: 6.5.2 Compiler invocation: cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -wd4251 -wd4996 -wd4661 -wd4244 /utf-8 -Zi -MDd -std:c++17 -w34100 -w34189 -w44456 -w44457 -w44458 -wd4577 -wd4467 -W2 -W2 -W2 -W2 -EHsc /Fddebug\qtlabb_itemsd.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DX64 -D_HAS_AUTO_PTR_ETC=1 -DBOOST_ALL_NO_LIB -DNOMINMAX -D_HAS_STD_BYTE=1 -DDEBUG -DUSL_QT -DADVANCED_DOCKING -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_STATEMACHINE_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -D_WINDL Thank you for any help.