How to get the Last Inserted Id from this lib? #357
-
Hi, OCCI lib supports getting the last inserted ID as below But The Statment::Register() method in this library has not option to get the same. Can you please guide how to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi, OCCI does not provide automatic retrieval of the last inserted ID. For that you must use a returning into clause that is also supported by OCILIB. See OCILIB documentation: C Demo sample : C++ Demo sample : Regards, Vincent |
Beta Was this translation helpful? Give feedback.
-
Hi @vrogier, thank you very much for the answer. I have another question related to ResultSet. The example below works fine. Statement st(con); I am writing a wrapper for ResultSet class ResultSetWrapper private: Statment stm(conn); //Now the SmartHandler pointer inside ResultSet(m_result) is null and I am not able to use the result set. The wrapper is required in my project, cannot use ResultSet class directly. Please help. |
Beta Was this translation helpful? Give feedback.
-
Now I am getting linker error when I use Bind() method Statement st(con); The lib and include files are configured correctly, But only when I use Bind() method I can see this linker error. This linker error occurs only when I pass 2nd parameter as ostring in the bind() method. 1>ocilibTest.obj : error LNK2019: unresolved external symbol "public: void __cdecl ocilib::Statement::Bind<char const [11]>(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const (&)[11],class ocilib::core::Enum)" (??$Bind@$$BY0L@$$CBD@Statement@ocilib@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@AEAY0L@$$CBDV?$Enum@W4BindDirectionValues@BindInfo@ocilib@@@core@1@@z) referenced in function main |
Beta Was this translation helpful? Give feedback.
Hi,
OCCI does not provide automatic retrieval of the last inserted ID.
For that you must use a returning into clause that is also supported by OCILIB.
See OCILIB documentation:
https://vrogier.github.io/ocilib/doc/html/group___ocilib_c_api_feature_returning_into.html
C Demo sample :
https://github.com/vrogier/ocilib/blob/master/demo/returning.c
C++ Demo sample :
https://github.com/vrogier/ocilib/blob/master/demo/returning.cpp
Regards,
Vincent