From roberto.minarelli.de at gmail.com Thu Jun 8 04:29:16 2023 From: roberto.minarelli.de at gmail.com (roberto minarelli) Date: Thu Jun 8 08:38:43 2023 Subject: [odb-users] mapping C++ std::string type to Oracle DATE type and viceversa Message-ID: dear odb-users, I cannot figure how to map the C++ std::string to Oracle DATE type and viceversa I already went through the archive but sincerely I could not find anything that responds to my issue Could you help me please? Thank you Best Regards Roberto Minarelli Della Valle From boris at codesynthesis.com Thu Jun 8 08:56:09 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 8 08:47:13 2023 Subject: [odb-users] mapping C++ std::string type to Oracle DATE type and viceversa In-Reply-To: References: Message-ID: roberto minarelli writes: > I cannot figure how to map the C++ std::string to Oracle DATE type and > viceversa > > I already went through the archive but sincerely I could not find anything > that responds to my issue Have you read through these two articles: https://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ https://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/ From 52932688 at qq.com Sun Jun 11 23:29:18 2023 From: 52932688 at qq.com (=?gb18030?B?srvD99Xmz+A=?=) Date: Sun Jun 11 23:20:49 2023 Subject: [odb-users] The right way to set the sqlite into WAL mode? Message-ID: Hi Boris, I want to get the WAL mode support of SQLITE in ODB,? ? and I use the below code piece: ?? QScopedPointer Hello odb-users I report the following situation: I got this simple class #include #pragma db object table("myschema.myTable") class myClass { public: myClass() {} virtual ~myClass() {} void setIdT(unsigned long value) {ulId=value;} void setGroup(unsigned short value) {usGroup=value;} void setDate(std::string& value) {strDate=value;} unsigned long getId() const {return ulId;} unsigned short getGroup() const {return usGroup;} std::string getUpdateDate() const {return strUpdateDate;} private: friend class odb::access; #pragma db id column("idtable") type("number") unsigned long ulId; #pragma db column("group") type("number") unsigned short usGroup; #pragma db column("updateDate") type("date") std::string strDate; }; I generated the odb classes and wrote the following simple test program #include #include #include #include #include #include #include "myClass-odb.hxx" using namespace std; using namespace odb; unique_ptr getConnection(unique_ptr& f) { unique_ptr res=move(f); return res; } int main(void) { myClass object; string strDate("20230516120506"); string strUser("tiger"); string strPwd("scott"); string strDBname("db"); try { unique_ptr f (new oracle::connection_pool_factory (1, 20)); shared_ptr db (new oracle::database (strUser, strPwd, strDBname,0, 0, 0, getConnection(f) )); transaction t(db->begin()); object.setId(200); object.setGroup(0); object.seteDate(strDate); db->persist(object); t.commit(); } catch(std::exception& e) { std::cout<::id_type odb::database::persist_(myClass&)': test.cpp:(.text._ZN3odb8database8persist_I20myClassLNS_11database_idE3EEENS_13object_traitsIT_E7id_typeERS5_[_ZN3odb8database8persist_I20myClassLNS_11database_idE3EEENS_13object_traitsIT_E7id_typeERS5_]+0x1f): undefined reference to `odb::access::object_traits_impl::persist(odb::database&, myClass const&)' collect2: error: ld returned 1 exit status where is the error? Or if there is no error why it does not compile? I am currently using gcc 8 on OL8.7 and odb 2.5.0-b.23 Thanks a lot Best Regards Roberto Minarelli Della Valle From boris at codesynthesis.com Fri Jun 16 04:41:18 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 16 04:32:16 2023 Subject: [odb-users] The right way to set the sqlite into WAL mode? In-Reply-To: References: Message-ID: ???? <52932688@qq.com> writes: > QScopedPointer db(new odb::sqlite::database(DB_FILE, SQLITE_OPEN_READWRITE)); > ?? > > // Position 1: db->execute("PRAGMA journal_mode=WAL"); > ? > > odb::transaction t(db->begin()); > > > //Position 2: db->execute("PRAGMA journal_mode=WAL"); > > > If I use the pragama at position 1, it will give me the error: operation can only be performed in transaction > If I use the pragma at position 2, I will get the error: cannot change into wal mode from within a transaction The correct way is to first get the connection and then execute the pragma on that: db->connection ()->execute ("PRAGMA journal_mode=WAL"); From boris at codesynthesis.com Fri Jun 16 04:54:24 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 16 04:45:18 2023 Subject: [odb-users] simple test program does not compile In-Reply-To: References: Message-ID: roberto minarelli writes: > g++ -std=c++1z test.cpp -I -lodb -lodb-oracle You need to compile and link myClass-odb.cxx with your application: g++ -std=c++1z test.cpp myClass-odb.cxx -I. -lodb -lodb-oracle Also, that `-I -lodb` part in your command line looks wrong, probably should be -I. or some such. On a more general note, you should be able to solve such basic issues on your own and by asking for help you are essentially asking me to write your software for you, which I don't view as fair. As a result, I will no longer be replying with solutions to issues that any competent C++ developer should be able to solve themselves. Instead, I suggest that you look for help/mentoring/training within your organization. From javier.gutierrez at web.de Thu Jun 29 04:10:44 2023 From: javier.gutierrez at web.de (Javier Gutierrez) Date: Thu Jun 29 04:01:53 2023 Subject: [odb-users] Insert into select Message-ID: <002301d9aa61$3404a6d0$9c0df470$@web.de> Hello Boris, Is there any way to run an "INSERT INTO SELECT blah, blah FROM "? Thanks, Javier Gutierrez