orclib-users Mailing List for OCILIB - C and C++ Driver for Oracle (Page 3)
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
You can subscribe to this list here.
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2011 |
Jan
(1) |
Feb
(3) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
(5) |
Apr
(16) |
May
(2) |
Jun
(4) |
Jul
|
Aug
(6) |
Sep
(5) |
Oct
(4) |
Nov
|
Dec
(12) |
2013 |
Jan
(6) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
(8) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
2015 |
Jan
(18) |
Feb
(9) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
(1) |
2016 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Florian G. <spi...@gm...> - 2013-11-12 17:49:23
|
Hi Vincent Using this destroy-loop doesn't make any diffence While ( elem != Null ) { OCI_ObjectFree ( OCI_ElemGetObject( elem ) ) ; elem = OCI_IterGetNext ( iter ) ; } I still get the same error Only call OCI_xxxFree() çon object returned by OCI_xxxCreate() > Yes Thats why I thought i coul call the Function OCI_ElemFree on my elem, which I created with OCI_ElemCreate. Is it impossible to destroy the objects using only the collection-Object? Thx for your help > > Regards, > > Vincent > > > On Tue, Nov 12, 2013 at 4:12 PM, Florian Grißmer <spi...@gm...>wrote: > >> Hi Vincent >> >> Thx for you answer, I was afraid of that, I liked the package-scheme, >> It's a pity I can't use it this way. >> >> I have another question. I created and destroyed a list (collection of an >> object-type with two string-fields) with 5000 Elements as Objects and it >> still gives me this error at the end: *OCI Error 0, Found 5000 unfreed >> OCI Object handles *after the OCI_Cleanup call. What am I doing wrong, I >> create and destroy all Elements >> >> I call OCI_ElemFree ( elem ), but because of this check: >> >> if ((obj)->hstate == OCI_OBJECT_FETCHED_CLEAN) >> return (ret); >> >> This Elements object ist not destroyed. Is this an effect of my test, >> that Elements in Lists, if they are not used in a request can't be >> destroyed and in a productive environment, where I would always call a >> PL/SQL procedure with this list, this would never happen? Or sth different? >> >> Thx for your help >> >> >> OCI_Initialize ( err_handler, Null, OCI_ENV_DEFAULT) ) ; >> >> con = OCI_ConnectionCreate ( db, user, pwd ) ; >> >> list_typinf = OCI_TypeInfoGet ( con, name, OCI_TIF_TYPE ) ; >> >> column = OCI_TypeInfoGetColumn ( list_typinf, 1 ) ; >> >> col_typinf = OCI_ColumnGetTypeInfo ( column ) ; >> >> coll = OCI_CollCreate ( list_typinf ) ; >> >> obj = OCI_ObjectCreate ( con, col_typinf ) ; >> >> OCI_ObjectSetString ( obj, field_1, field_1_value ) ; >> >> OCI_ObjectSetString ( obj, field_2, field_2_value ) ; >> >> For (int i = 1; i <= 5000; i++) { >> >> elem = OCI_ElemCreate ( list_typinf ) ; >> >> OCI_ElemSetObject ( elem, obj ) ; >> >> OCI_CollAppend ( coll, elem ) ; >> } >> >> OCI_ObjectFree ( obj ) ; >> >> iter = OCI_IterCreate ( coll ) ; >> >> elem = OCI_IterGetNext ( iter ) ; >> >> While ( elem != Null ) { >> >> OCI_ElemFree ( elem ) ; >> >> elem = OCI_IterGetNext ( iter ) ; >> } >> >> OCI_IterFree ( iter ) ; >> >> OCI_CollFree ( coll ) ; >> >> OCI_ConnectionFree ( con ) ; >> >> OCI_Cleanup () ; >> >> >> >> On Mon, Nov 11, 2013 at 3:53 PM, vincent rogier <vin...@gm...>wrote: >> >>> Hello, >>> >>> PL/SQL records and tables of records cannot be used outside PL/SQL. In >>> order to use collections in PL/SQL,SQL and host programs, you must use SQL >>> collections (varrays or nested tables). >>> Thus you need to create an object type and a nested table of objects. >>> Change your record definition to an object type definition. >>> You can have a look at the ocilib demo source files for definition and >>> usage :) >>> >>> Regards, >>> >>> Vincent >>> Le 11 nov. 2013 14:13, "Florian Grißmer" <spi...@gm...> a écrit : >>> >>>> Hi >>>> >>>> I have a question about an OCI_Collection Argument of a procedure. >>>> Suppose I have a procedure defined in a package like this: >>>> >>>> CREATE OR REPLACE >>>> PACKAGE TEST_PACK AS >>>> >>>> TYPE test_rcd IS RECORD ( testnum Number(4,0) >>>> , test_varchar Varchar(14) ); >>>> >>>> TYPE list_of_rcds IS TABLE OF test_rcd; >>>> >>>> Procedure test_prc1 ( rcd IN Out list_of_rcds ) ; >>>> >>>> >>>> END TEST_PACK; >>>> >>>> Ho do I call this procedure with a binded argument? To build the >>>> "rcd"-OCI_Collection Variable i have to have an OCI_TypeInf, which I cant >>>> get, because the type is inside a package. OCI_TypeInfoGet() uses >>>> "Describe" and this can't access types inside packages. >>>> >>>> Thx in advance. >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> November Webinars for C, C++, Fortran Developers >>>> Accelerate application performance with scalable programming models. >>>> Explore >>>> techniques for threading, error checking, porting, and tuning. Get the >>>> most >>>> from the latest Intel processors and coprocessors. See abstracts and >>>> register >>>> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk >>>> _______________________________________________ >>>> Orclib-users mailing list >>>> Orc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/orclib-users >>>> >>>> >> > > > -- > Vincent Rogier > |
From: vincent r. <vin...@gm...> - 2013-11-12 15:26:37
|
Hi, OCI_ElemSetObject ( )will assign a copy ogf the object. When iterating on the collection for freeingobjects, you must call OCI_ObjectFree() using the ocject returend by OCI_ElemGetObject(). Don't call OCI_ElemFree on the element obiect returned by OCI_IterGetNext() !!! this element is owned by OCI_Iter object. Only call OCI_xxxFree() çon object returned by OCI_xxxCreate() Regards, Vincent On Tue, Nov 12, 2013 at 4:12 PM, Florian Grißmer <spi...@gm...>wrote: > Hi Vincent > > Thx for you answer, I was afraid of that, I liked the package-scheme, It's > a pity I can't use it this way. > > I have another question. I created and destroyed a list (collection of an > object-type with two string-fields) with 5000 Elements as Objects and it > still gives me this error at the end: *OCI Error 0, Found 5000 unfreed > OCI Object handles *after the OCI_Cleanup call. What am I doing wrong, I > create and destroy all Elements > > I call OCI_ElemFree ( elem ), but because of this check: > > if ((obj)->hstate == OCI_OBJECT_FETCHED_CLEAN) > return (ret); > > This Elements object ist not destroyed. Is this an effect of my test, that > Elements in Lists, if they are not used in a request can't be destroyed and > in a productive environment, where I would always call a PL/SQL procedure > with this list, this would never happen? Or sth different? > > Thx for your help > > > OCI_Initialize ( err_handler, Null, OCI_ENV_DEFAULT) ) ; > > con = OCI_ConnectionCreate ( db, user, pwd ) ; > > list_typinf = OCI_TypeInfoGet ( con, name, OCI_TIF_TYPE ) ; > > column = OCI_TypeInfoGetColumn ( list_typinf, 1 ) ; > > col_typinf = OCI_ColumnGetTypeInfo ( column ) ; > > coll = OCI_CollCreate ( list_typinf ) ; > > obj = OCI_ObjectCreate ( con, col_typinf ) ; > > OCI_ObjectSetString ( obj, field_1, field_1_value ) ; > > OCI_ObjectSetString ( obj, field_2, field_2_value ) ; > > For (int i = 1; i <= 5000; i++) { > > elem = OCI_ElemCreate ( list_typinf ) ; > > OCI_ElemSetObject ( elem, obj ) ; > > OCI_CollAppend ( coll, elem ) ; > } > > OCI_ObjectFree ( obj ) ; > > iter = OCI_IterCreate ( coll ) ; > > elem = OCI_IterGetNext ( iter ) ; > > While ( elem != Null ) { > > OCI_ElemFree ( elem ) ; > > elem = OCI_IterGetNext ( iter ) ; > } > > OCI_IterFree ( iter ) ; > > OCI_CollFree ( coll ) ; > > OCI_ConnectionFree ( con ) ; > > OCI_Cleanup () ; > > > > On Mon, Nov 11, 2013 at 3:53 PM, vincent rogier <vin...@gm...>wrote: > >> Hello, >> >> PL/SQL records and tables of records cannot be used outside PL/SQL. In >> order to use collections in PL/SQL,SQL and host programs, you must use SQL >> collections (varrays or nested tables). >> Thus you need to create an object type and a nested table of objects. >> Change your record definition to an object type definition. >> You can have a look at the ocilib demo source files for definition and >> usage :) >> >> Regards, >> >> Vincent >> Le 11 nov. 2013 14:13, "Florian Grißmer" <spi...@gm...> a écrit : >> >>> Hi >>> >>> I have a question about an OCI_Collection Argument of a procedure. >>> Suppose I have a procedure defined in a package like this: >>> >>> CREATE OR REPLACE >>> PACKAGE TEST_PACK AS >>> >>> TYPE test_rcd IS RECORD ( testnum Number(4,0) >>> , test_varchar Varchar(14) ); >>> >>> TYPE list_of_rcds IS TABLE OF test_rcd; >>> >>> Procedure test_prc1 ( rcd IN Out list_of_rcds ) ; >>> >>> >>> END TEST_PACK; >>> >>> Ho do I call this procedure with a binded argument? To build the >>> "rcd"-OCI_Collection Variable i have to have an OCI_TypeInf, which I cant >>> get, because the type is inside a package. OCI_TypeInfoGet() uses >>> "Describe" and this can't access types inside packages. >>> >>> Thx in advance. >>> >>> >>> ------------------------------------------------------------------------------ >>> November Webinars for C, C++, Fortran Developers >>> Accelerate application performance with scalable programming models. >>> Explore >>> techniques for threading, error checking, porting, and tuning. Get the >>> most >>> from the latest Intel processors and coprocessors. See abstracts and >>> register >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Orclib-users mailing list >>> Orc...@li... >>> https://lists.sourceforge.net/lists/listinfo/orclib-users >>> >>> > -- Vincent Rogier |
From: Florian G. <spi...@gm...> - 2013-11-12 15:12:45
|
Hi Vincent Thx for you answer, I was afraid of that, I liked the package-scheme, It's a pity I can't use it this way. I have another question. I created and destroyed a list (collection of an object-type with two string-fields) with 5000 Elements as Objects and it still gives me this error at the end: *OCI Error 0, Found 5000 unfreed OCI Object handles *after the OCI_Cleanup call. What am I doing wrong, I create and destroy all Elements I call OCI_ElemFree ( elem ), but because of this check: if ((obj)->hstate == OCI_OBJECT_FETCHED_CLEAN) return (ret); This Elements object ist not destroyed. Is this an effect of my test, that Elements in Lists, if they are not used in a request can't be destroyed and in a productive environment, where I would always call a PL/SQL procedure with this list, this would never happen? Or sth different? Thx for your help OCI_Initialize ( err_handler, Null, OCI_ENV_DEFAULT) ) ; con = OCI_ConnectionCreate ( db, user, pwd ) ; list_typinf = OCI_TypeInfoGet ( con, name, OCI_TIF_TYPE ) ; column = OCI_TypeInfoGetColumn ( list_typinf, 1 ) ; col_typinf = OCI_ColumnGetTypeInfo ( column ) ; coll = OCI_CollCreate ( list_typinf ) ; obj = OCI_ObjectCreate ( con, col_typinf ) ; OCI_ObjectSetString ( obj, field_1, field_1_value ) ; OCI_ObjectSetString ( obj, field_2, field_2_value ) ; For (int i = 1; i <= 5000; i++) { elem = OCI_ElemCreate ( list_typinf ) ; OCI_ElemSetObject ( elem, obj ) ; OCI_CollAppend ( coll, elem ) ; } OCI_ObjectFree ( obj ) ; iter = OCI_IterCreate ( coll ) ; elem = OCI_IterGetNext ( iter ) ; While ( elem != Null ) { OCI_ElemFree ( elem ) ; elem = OCI_IterGetNext ( iter ) ; } OCI_IterFree ( iter ) ; OCI_CollFree ( coll ) ; OCI_ConnectionFree ( con ) ; OCI_Cleanup () ; On Mon, Nov 11, 2013 at 3:53 PM, vincent rogier <vin...@gm...>wrote: > Hello, > > PL/SQL records and tables of records cannot be used outside PL/SQL. In > order to use collections in PL/SQL,SQL and host programs, you must use SQL > collections (varrays or nested tables). > Thus you need to create an object type and a nested table of objects. > Change your record definition to an object type definition. > You can have a look at the ocilib demo source files for definition and > usage :) > > Regards, > > Vincent > Le 11 nov. 2013 14:13, "Florian Grißmer" <spi...@gm...> a écrit : > >> Hi >> >> I have a question about an OCI_Collection Argument of a procedure. >> Suppose I have a procedure defined in a package like this: >> >> CREATE OR REPLACE >> PACKAGE TEST_PACK AS >> >> TYPE test_rcd IS RECORD ( testnum Number(4,0) >> , test_varchar Varchar(14) ); >> >> TYPE list_of_rcds IS TABLE OF test_rcd; >> >> Procedure test_prc1 ( rcd IN Out list_of_rcds ) ; >> >> >> END TEST_PACK; >> >> Ho do I call this procedure with a binded argument? To build the >> "rcd"-OCI_Collection Variable i have to have an OCI_TypeInf, which I cant >> get, because the type is inside a package. OCI_TypeInfoGet() uses >> "Describe" and this can't access types inside packages. >> >> Thx in advance. >> >> >> ------------------------------------------------------------------------------ >> November Webinars for C, C++, Fortran Developers >> Accelerate application performance with scalable programming models. >> Explore >> techniques for threading, error checking, porting, and tuning. Get the >> most >> from the latest Intel processors and coprocessors. See abstracts and >> register >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk >> _______________________________________________ >> Orclib-users mailing list >> Orc...@li... >> https://lists.sourceforge.net/lists/listinfo/orclib-users >> >> |
From: vincent r. <vin...@gm...> - 2013-11-11 14:53:07
|
Hello, PL/SQL records and tables of records cannot be used outside PL/SQL. In order to use collections in PL/SQL,SQL and host programs, you must use SQL collections (varrays or nested tables). Thus you need to create an object type and a nested table of objects. Change your record definition to an object type definition. You can have a look at the ocilib demo source files for definition and usage :) Regards, Vincent Le 11 nov. 2013 14:13, "Florian Grißmer" <spi...@gm...> a écrit : > Hi > > I have a question about an OCI_Collection Argument of a procedure. Suppose > I have a procedure defined in a package like this: > > CREATE OR REPLACE > PACKAGE TEST_PACK AS > > TYPE test_rcd IS RECORD ( testnum Number(4,0) > , test_varchar Varchar(14) ); > > TYPE list_of_rcds IS TABLE OF test_rcd; > > Procedure test_prc1 ( rcd IN Out list_of_rcds ) ; > > > END TEST_PACK; > > Ho do I call this procedure with a binded argument? To build the > "rcd"-OCI_Collection Variable i have to have an OCI_TypeInf, which I cant > get, because the type is inside a package. OCI_TypeInfoGet() uses > "Describe" and this can't access types inside packages. > > Thx in advance. > > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. > Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and > register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > _______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > > |
From: Florian G. <spi...@gm...> - 2013-11-11 13:14:11
|
Hi I have a question about an OCI_Collection Argument of a procedure. Suppose I have a procedure defined in a package like this: CREATE OR REPLACE PACKAGE TEST_PACK AS TYPE test_rcd IS RECORD ( testnum Number(4,0) , test_varchar Varchar(14) ); TYPE list_of_rcds IS TABLE OF test_rcd; Procedure test_prc1 ( rcd IN Out list_of_rcds ) ; END TEST_PACK; Ho do I call this procedure with a binded argument? To build the "rcd"-OCI_Collection Variable i have to have an OCI_TypeInf, which I cant get, because the type is inside a package. OCI_TypeInfoGet() uses "Describe" and this can't access types inside packages. Thx in advance. |
From: vincent r. <vin...@gm...> - 2013-09-19 13:18:56
|
Your're welcome :) Regards, Vincent On Thu, Sep 19, 2013 at 1:57 PM, Ann-Charlotte Andersson < Ann...@se...> wrote: > Hi**** > > ** ** > > Many thanks for your answer. I have experimented a bit more and it turned > out that I had not installed enough of the 32-bits client. When I removed > 64-bits Oracle from the path I got an error message that oraclscl12.dll was > missing. This Dll was present only in the 64-bits Oracle installation.**** > > I reinstalled the 32-bits client and selected “runtime” as the option > instead of “custom” as I had before. **** > > Oraclscl12.dll is now present in the 32-bits installation and my programs > are working again.**** > > ** ** > > Many thanks for putting me on the right path!**** > > Ann-Charlotte**** > -- Vincent Rogier |
From: Ann-Charlotte A. <Ann...@se...> - 2013-09-19 11:57:42
|
Hi Many thanks for your answer. I have experimented a bit more and it turned out that I had not installed enough of the 32-bits client. When I removed 64-bits Oracle from the path I got an error message that oraclscl12.dll was missing. This Dll was present only in the 64-bits Oracle installation. I reinstalled the 32-bits client and selected "runtime" as the option instead of "custom" as I had before. Oraclscl12.dll is now present in the 32-bits installation and my programs are working again. Many thanks for putting me on the right path! Ann-Charlotte |
From: vincent r. <vin...@gm...> - 2013-09-18 18:52:28
|
Hi, Oracle 12c is supported as it does not introduce any backward compatibility breaks. The error "Cannot create OCI environment" has usually 2 common roots; - 32/64 bits binaries mismatch - ORACLE_HOME environment variable not/wrongly set. Regards, Vincent On Wed, Sep 18, 2013 at 5:33 PM, Ann-Charlotte Andersson < Ann...@se...> wrote: > Hi,**** > > ** ** > > I have been using ocilib on Windows 2012 with Oracle 11.2.**** > > We now want to upgrade to Oracle 12c.**** > > ** ** > > I have tried ocilib 3.12.1 but when I call OCI_Initialize, I get the error > Cannot create OCI environment.**** > > Are there any plans to support Oracle 12?**** > > ** ** > > Thank you in advance for your help!**** > > /Ann-Charlotte* Andersson* > > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, > SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack > includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > > -- Vincent Rogier |
From: Ann-Charlotte A. <Ann...@se...> - 2013-09-18 15:55:15
|
Hi, I have been using ocilib on Windows 2012 with Oracle 11.2. We now want to upgrade to Oracle 12c. I have tried ocilib 3.12.1 but when I call OCI_Initialize, I get the error Cannot create OCI environment. Are there any plans to support Oracle 12? Thank you in advance for your help! /Ann-Charlotte Andersson |
From: vincent r. <vin...@ya...> - 2013-08-12 13:11:27
|
can you provide the prototype of the stored proc ? and and example ofaParameterString ? On Mon, Aug 12, 2013 at 2:06 PM, xavier lhomme <lho...@gm...>wrote: > Hi > I'd some trouble converting some part of the code using OCCI to OCILIB. > Especially the setNumber function and registeroutParam... > I replace these functions by a binding on a long and a RefGetObjet... > Is is the right choice ? > > ///------------------------------------------------ > /// OLD Syntax with OCCI > > strcpy(aParameterString,"("); > int i=1; > while(i<anIdIndex+1) > { > sprintf(aNumParameterString,":%d,",i); > strcat(aParameterString,aNumParameterString); > ++i; > } > aParameterString[strlen(aParameterString)-1]=')'; // remplace la dernière > ',' > sprintf(aRequest,"BEGIN %s%s; END;",aStoredProcedureName,aParameterString); > > std::string aQuery = std::string(aRequest); > > > oracle::occi::Statement* stmt = getConnection()->createStatement(aQuery); > oracle::occi::Connection* aConnectionPt = getConnection(); > > ... > aStatementPt->setNumber(1, aValueLong); > ... > > stmt->registerOutParam(anIdIndex,OCCIINT,sizeof(aNewElementId)); > > unsigned int aNbLine = stmt->executeUpdate(); > > aNewElementId = stmt->getInt(anIdIndex); > > getConnection()->commit(); > > getConnection()->terminateStatement(stmt); > > ///----------------------------------------------------------------- > /// New Syntax With OCILIB > aParameterString[0]='('; > while(i<anIdIndex+1) > { > sprintf(aNumParameterString,":%d,",i); > strcat(aParameterString,aNumParameterString); > ++i; > } > aParameterString[strlen(aParameterString)-1]=')'; // remplace la dernière > ',' > sprintf(aRequest,"BEGIN %s%s; END;",aStoredProcedureName,aParameterString); > > OCI_Connection* cnPt= getConnection(); > OCI_Statement * stmt = OCI_StatementCreate(cnPt); > OCI_Prepare(stmt,aRequest); > > OCI_BindLong(stmt,":1", (OCI_Long*)&aValueLong,sizeof(long)); > > OCI_Ref *ref; > > OCI_BindRef(stmt, ":r", ref); > OCI_Execute(stmt); > > OCI_Object *obj= OCI_RefGetObject(ref); > aNewElementId =OCI_ObjectGetInt(obj, ":r"); > > OCI_Commit(cnPt); > > OCI_RefFree(ref); > OCI_StatementFree(stmt); > > > 2013/8/10 vincent rogier <vin...@ya...> > >> Hi Xavier, >> >> You've pointered out the weakness of OCCI that explains why it has never >> been a great Oracle success ! >> Another major issue with OCCI is that you've have to deal with object >> pointers in C++ and is not the best C++ design and not STL like oriented. >> >> OCILIB is compatible with all C compilers and all Oracle plaforms, in >> their 32/64 flavours. >> >> Another thing is Version 4.0 of OCILIB introduces a new C++ API : >> OCILIB++ : full C++ design, based on templates, using right design patterns. >> No user dynamic object allocation (that is a pain for using exceptions >> with effectiveness). Instead, the library uses stack objects that >> implements internally references counting, raii, and so on. >> >> OCILIB++ is a single C++ header (ocilib.hhpp) ! >> It is already available on the SF.NET repository under the include >> folder. It hasn't been released because i'm missing a bit of time for >> completing the user documentation. You'll also find most of the c demo >> files under the demo folder ported to their c++ counterparts :) >> >> Give it a try ! >> >> It will be much easier to port OCCI code to OCILIB++ than porting to raw >> C code ! >> >> Regards, >> >> >> Vincent >> >> >> On Tue, Aug 6, 2013 at 8:59 PM, xavier lhomme <lho...@gm...>wrote: >> >>> Hi >>> >>> We wrote a software few years ago which use OCCI to connect to oracle >>> 9.x. The software was written with visual c++ 2005 on win32... >>> I tryed to build a new version with oracle 11.2, visual studio 2012 on >>> x64, and OCCI but I encounter heap corruption after calling getString(apparently it's a famous problem due to >>> inconsistency between version of the compiler used and the OCCI sdk see >>> on google OCCI getString). >>> I'm disappointed with OCCI because I can't obtain a version compliant >>> with my environment (visual studio 2012,x64,oracle 11.2.0.1) >>> Then I wonder If I would have more chance using OCILIB with visual >>> studio 2012,x64,oracle 11.2.0.1 and if anybody has experience porting code >>> from OCCI to OCILIB ? >>> >>> best regards >>> xlhomme >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Get 100% visibility into Java/.NET code with AppDynamics Lite! >>> It's a free troubleshooting tool designed for production. >>> Get down to code-level detail for bottlenecks, with <2% overhead. >>> Download for free and get started troubleshooting in minutes. >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Orclib-users mailing list >>> Orc...@li... >>> https://lists.sourceforge.net/lists/listinfo/orclib-users >>> >>> >> >> >> -- >> Vincent Rogier >> > > -- Vincent Rogier |
From: xavier l. <lho...@gm...> - 2013-08-12 12:07:03
|
Hi I'd some trouble converting some part of the code using OCCI to OCILIB. Especially the setNumber function and registeroutParam... I replace these functions by a binding on a long and a RefGetObjet... Is is the right choice ? ///------------------------------------------------ /// OLD Syntax with OCCI strcpy(aParameterString,"("); int i=1; while(i<anIdIndex+1) { sprintf(aNumParameterString,":%d,",i); strcat(aParameterString,aNumParameterString); ++i; } aParameterString[strlen(aParameterString)-1]=')'; // remplace la dernière ',' sprintf(aRequest,"BEGIN %s%s; END;",aStoredProcedureName,aParameterString); std::string aQuery = std::string(aRequest); oracle::occi::Statement* stmt = getConnection()->createStatement(aQuery); oracle::occi::Connection* aConnectionPt = getConnection(); ... aStatementPt->setNumber(1, aValueLong); ... stmt->registerOutParam(anIdIndex,OCCIINT,sizeof(aNewElementId)); unsigned int aNbLine = stmt->executeUpdate(); aNewElementId = stmt->getInt(anIdIndex); getConnection()->commit(); getConnection()->terminateStatement(stmt); ///----------------------------------------------------------------- /// New Syntax With OCILIB aParameterString[0]='('; while(i<anIdIndex+1) { sprintf(aNumParameterString,":%d,",i); strcat(aParameterString,aNumParameterString); ++i; } aParameterString[strlen(aParameterString)-1]=')'; // remplace la dernière ',' sprintf(aRequest,"BEGIN %s%s; END;",aStoredProcedureName,aParameterString); OCI_Connection* cnPt= getConnection(); OCI_Statement * stmt = OCI_StatementCreate(cnPt); OCI_Prepare(stmt,aRequest); OCI_BindLong(stmt,":1", (OCI_Long*)&aValueLong,sizeof(long)); OCI_Ref *ref; OCI_BindRef(stmt, ":r", ref); OCI_Execute(stmt); OCI_Object *obj= OCI_RefGetObject(ref); aNewElementId =OCI_ObjectGetInt(obj, ":r"); OCI_Commit(cnPt); OCI_RefFree(ref); OCI_StatementFree(stmt); 2013/8/10 vincent rogier <vin...@ya...> > Hi Xavier, > > You've pointered out the weakness of OCCI that explains why it has never > been a great Oracle success ! > Another major issue with OCCI is that you've have to deal with object > pointers in C++ and is not the best C++ design and not STL like oriented. > > OCILIB is compatible with all C compilers and all Oracle plaforms, in > their 32/64 flavours. > > Another thing is Version 4.0 of OCILIB introduces a new C++ API : > OCILIB++ : full C++ design, based on templates, using right design patterns. > No user dynamic object allocation (that is a pain for using exceptions > with effectiveness). Instead, the library uses stack objects that > implements internally references counting, raii, and so on. > > OCILIB++ is a single C++ header (ocilib.hhpp) ! > It is already available on the SF.NET repository under the include > folder. It hasn't been released because i'm missing a bit of time for > completing the user documentation. You'll also find most of the c demo > files under the demo folder ported to their c++ counterparts :) > > Give it a try ! > > It will be much easier to port OCCI code to OCILIB++ than porting to raw C > code ! > > Regards, > > > Vincent > > > On Tue, Aug 6, 2013 at 8:59 PM, xavier lhomme <lho...@gm...>wrote: > >> Hi >> >> We wrote a software few years ago which use OCCI to connect to oracle >> 9.x. The software was written with visual c++ 2005 on win32... >> I tryed to build a new version with oracle 11.2, visual studio 2012 on >> x64, and OCCI but I encounter heap corruption after calling getString(apparently it's a famous problem due to >> inconsistency between version of the compiler used and the OCCI sdk see >> on google OCCI getString). >> I'm disappointed with OCCI because I can't obtain a version compliant >> with my environment (visual studio 2012,x64,oracle 11.2.0.1) >> Then I wonder If I would have more chance using OCILIB with visual >> studio 2012,x64,oracle 11.2.0.1 and if anybody has experience porting code >> from OCCI to OCILIB ? >> >> best regards >> xlhomme >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Get 100% visibility into Java/.NET code with AppDynamics Lite! >> It's a free troubleshooting tool designed for production. >> Get down to code-level detail for bottlenecks, with <2% overhead. >> Download for free and get started troubleshooting in minutes. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk >> _______________________________________________ >> Orclib-users mailing list >> Orc...@li... >> https://lists.sourceforge.net/lists/listinfo/orclib-users >> >> > > > -- > Vincent Rogier > |
From: vincent r. <vin...@ya...> - 2013-08-10 13:19:44
|
Hi Xavier, You've pointered out the weakness of OCCI that explains why it has never been a great Oracle success ! Another major issue with OCCI is that you've have to deal with object pointers in C++ and is not the best C++ design and not STL like oriented. OCILIB is compatible with all C compilers and all Oracle plaforms, in their 32/64 flavours. Another thing is Version 4.0 of OCILIB introduces a new C++ API : OCILIB++ : full C++ design, based on templates, using right design patterns. No user dynamic object allocation (that is a pain for using exceptions with effectiveness). Instead, the library uses stack objects that implements internally references counting, raii, and so on. OCILIB++ is a single C++ header (ocilib.hhpp) ! It is already available on the SF.NET repository under the include folder. It hasn't been released because i'm missing a bit of time for completing the user documentation. You'll also find most of the c demo files under the demo folder ported to their c++ counterparts :) Give it a try ! It will be much easier to port OCCI code to OCILIB++ than porting to raw C code ! Regards, Vincent On Tue, Aug 6, 2013 at 8:59 PM, xavier lhomme <lho...@gm...>wrote: > Hi > > We wrote a software few years ago which use OCCI to connect to oracle > 9.x. The software was written with visual c++ 2005 on win32... > I tryed to build a new version with oracle 11.2, visual studio 2012 on > x64, and OCCI but I encounter heap corruption after calling getString(apparently it's a famous problem due to > inconsistency between version of the compiler used and the OCCI sdk see > on google OCCI getString). > I'm disappointed with OCCI because I can't obtain a version compliant with > my environment (visual studio 2012,x64,oracle 11.2.0.1) > Then I wonder If I would have more chance using OCILIB with visual > studio 2012,x64,oracle 11.2.0.1 and if anybody has experience porting code > from OCCI to OCILIB ? > > best regards > xlhomme > > > > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite! > It's a free troubleshooting tool designed for production. > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk > _______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > > -- Vincent Rogier |
From: xavier l. <lho...@gm...> - 2013-08-06 18:59:37
|
Hi We wrote a software few years ago which use OCCI to connect to oracle 9.x. The software was written with visual c++ 2005 on win32... I tryed to build a new version with oracle 11.2, visual studio 2012 on x64, and OCCI but I encounter heap corruption after calling getString(apparently it's a famous problem due to inconsistency between version of the compiler used and the OCCI sdk see on google OCCI getString). I'm disappointed with OCCI because I can't obtain a version compliant with my environment (visual studio 2012,x64,oracle 11.2.0.1) Then I wonder If I would have more chance using OCILIB with visual studio 2012,x64,oracle 11.2.0.1 and if anybody has experience porting code from OCCI to OCILIB ? best regards xlhomme |
From: Artem H. <ha...@qu...> - 2013-03-29 00:37:52
|
Hi, I have a very simple program which does nothing but OCI_Initialize() followed by OCI_Cleanup() and according to valgrind it leaks memory. I have tried both ocilib 3.12.0 and 3.12.1, valgrind version is 3.6.0. The code of the program as well as the valgrind output can be found below. Is this a known issue? Thank you in advance for your help! Artem. ______________________________________ #include <assert.h> #include <ocilib.h> int main(int argc, char **argv) { assert(OCI_Initialize(NULL, NULL, OCI_ENV_THREADED | OCI_ENV_CONTEXT)); assert(OCI_Cleanup()); return 0; } ______________________________________ $ valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=40 --undef-value-errors=no bin/qdb_ocilib_test ==3444== Memcheck, a memory error detector ==3444== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==3444== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info ==3444== Command: bin/qdb_ocilib_test ==3444== ==3444== ==3444== HEAP SUMMARY: ==3444== in use at exit: 537,121 bytes in 236 blocks ==3444== total heap usage: 560 allocs, 324 frees, 906,553 bytes allocated ==3444== ==3444== 99 bytes in 1 blocks are definitely lost in loss record 96 of 235 ==3444== at 0x4C26FDE: malloc (vg_replace_malloc.c:236) ==3444== by 0x74E0397: slzsetevar (in /libclntsh.so.11.1) ==3444== by 0x74E406F: lfvSetOHome (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C5E2F: slpmloclfv (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C5A3A: slpmloc (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C3512: lpmloadpkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A79DC: lfvLoadPkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A76D4: lfvSetShlMode (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A74C3: lfvini1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A731A: lfvini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6520930: lxlinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x64BFD90: nleminz (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBFB91: nlstdggo (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBEF32: nlstdgg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x63D211E: nigini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691339B: kpeDbgGetNPDGlobal (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691326F: kpeDbgTLSInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7EE7E48: kpummTLSGET1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6913532: kpeDbgProcessInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6911954: kpummpin (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x62785E4: kpuenvcr (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x624A2F1: OCIEnvCreate (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x4E5B8A2: OCI_Initialize (in LIB_PATH/libocilib.so.3.12.1) ==3444== by 0x4006B6: main (qdb_ocilib_test.c:14) ==3444== ==3444== 192 bytes in 1 blocks are possibly lost in loss record 160 of 235 ==3444== at 0x4C26FDE: malloc (vg_replace_malloc.c:236) ==3444== by 0x65A411C: sltsmxi (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65BFB8B: lmmhpinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65BEDDD: lmmcis (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C3C40: lpmpali (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2F04: lpminitm (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2CEB: lpminit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A7997: lfvLoadPkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A7691: lfvSetShlMode (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A74C3: lfvini1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A731A: lfvini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6520930: lxlinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x64BFD90: nleminz (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBFB91: nlstdggo (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBEF32: nlstdgg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x63D211E: nigini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691339B: kpeDbgGetNPDGlobal (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691326F: kpeDbgTLSInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7EE7E48: kpummTLSGET1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6913532: kpeDbgProcessInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6911954: kpummpin (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x62785E4: kpuenvcr (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x624A2F1: OCIEnvCreate (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x4E5B8A2: OCI_Initialize (in LIB_PATH/libocilib.so.3.12.1) ==3444== by 0x4006B6: main (qdb_ocilib_test.c:14) ==3444== ==3444== 192 bytes in 1 blocks are possibly lost in loss record 161 of 235 ==3444== at 0x4C26FDE: malloc (vg_replace_malloc.c:236) ==3444== by 0x65A411C: sltsmxi (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65BFB8B: lmmhpinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65BEDDD: lmmcis (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C3C40: lpmpali (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C34CA: lpmloadpkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A79DC: lfvLoadPkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A76D4: lfvSetShlMode (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A74C3: lfvini1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A731A: lfvini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6520930: lxlinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x64BFD90: nleminz (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBFB91: nlstdggo (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBEF32: nlstdgg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x63D211E: nigini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691339B: kpeDbgGetNPDGlobal (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691326F: kpeDbgTLSInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7EE7E48: kpummTLSGET1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6913532: kpeDbgProcessInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6911954: kpummpin (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x62785E4: kpuenvcr (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x624A2F1: OCIEnvCreate (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x4E5B8A2: OCI_Initialize (in LIB_PATH/libocilib.so.3.12.1) ==3444== by 0x4006B6: main (qdb_ocilib_test.c:14) ==3444== ==3444== 139,264 bytes in 1 blocks are possibly lost in loss record 235 of 235 ==3444== at 0x4C25A28: calloc (vg_replace_malloc.c:467) ==3444== by 0x65C25F8: slwmmgetmem (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2390: lmmstvrt (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C0D1D: lmmstchnk (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2215: lmmstsml (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7E11809: lmmstmalloc (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7E10E3D: lmmmalloc (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65BECCC: lmmcis (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C3C40: lpmpali (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2F04: lpminitm (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65C2CEB: lpminit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A7997: lfvLoadPkg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A7691: lfvSetShlMode (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A74C3: lfvini1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x65A731A: lfvini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6520930: lxlinit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x64BFD90: nleminz (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBFB91: nlstdggo (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7DBEF32: nlstdgg (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x63D211E: nigini2 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691339B: kpeDbgGetNPDGlobal (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x691326F: kpeDbgTLSInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x7EE7E48: kpummTLSGET1 (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6913532: kpeDbgProcessInit (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x6911954: kpummpin (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x62785E4: kpuenvcr (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x624A2F1: OCIEnvCreate (in LIB_PATH/libclntsh.so.11.1) ==3444== by 0x4E5B8A2: OCI_Initialize (in LIB_PATH/libocilib.so.3.12.1) ==3444== by 0x4006B6: main (qdb_ocilib_test.c:14) ==3444== ==3444== LEAK SUMMARY: ==3444== definitely lost: 99 bytes in 1 blocks ==3444== indirectly lost: 0 bytes in 0 blocks ==3444== possibly lost: 139,648 bytes in 3 blocks ==3444== still reachable: 397,374 bytes in 232 blocks ==3444== suppressed: 0 bytes in 0 blocks ==3444== Reachable blocks (those to which a pointer was found) are not shown. ==3444== To see them, rerun with: --leak-check=full --show-reachable=yes ==3444== ==3444== For counts of detected and suppressed errors, rerun with: -v ==3444== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) $ |
From: Zoltan F. <zol...@ya...> - 2013-01-04 08:55:29
|
Cool, are you also planning to revisit the error handling? Based on the current ocilib example if directpathconvert fails if I call directpathconvert again it should resume conversion, skipping last errored row. This does not seem to be happening.(the current example will go in a infinite loop in case of an error) So in error case I am resetting the direct path and manually restart from the row after the erred row. Same applies to the load operation. Thank you for your work, I call this library from java(jna), and I can load data 20 times faster than JDBC batch inserts, without the need to write the data to a csv and load it with SQL loader or external tables... --z On Jan 3, 2013, at 11:30 PM, vincent rogier <vin...@ya...> wrote: > I will have a look and fix it an version 3.11.2 for end of january. But I will update svn this weekend for the bug regarding null number and this one as well > I had plans to enhance direct path support in version 4.0.0 (object support, fix piece support for lobs, ....) > I may work on this topics soon as well. > > Regards > > Vincent > > Le 3 janv. 2013 21:21, "Zoltan Farkas" <zol...@ya...> a écrit : >> Hi Vincent I also noticed a potential inconsistency: >> >> OCI_DirPathGetErrorRow seems to return a 0 based row number while OCI_DirPathSetEntry requires a 1 based row index. >> >> thank you >> >> --Z >> >> >> >> On Jan 3, 2013, at 4:00 PM, Zoltan Farkas <zol...@ya...> wrote: >> >>> Thank you, will do that. >>> >>> --z >>> >>> On Jan 3, 2013, at 12:39 PM, vincent rogier <vin...@ya...> wrote: >>> >>>> >>>> HI, >>>> >>>> I've checked the code, and even if the value provided to OCI_DirPathSetEntry() is NULL, OCILIB tries to convert the value to NUMBER if the column has a numeric format. >>>> >>>> I'll fix it in next release. >>>> >>>> The only thing you can do for now is to modify the source to not call OCI_NumberFromString() in dirpath.c or not call OCI_DirPathSetEntry() for null numbers. >>>> >>>> Regards, >>>> >>>> Vincent >>>> >>>> >>>> On Tue, Jan 1, 2013 at 11:30 PM, Zoltan Farkas <zol...@ya...> wrote: >>>>> dy let me know what >>>> >>>> >>>> >>>> -- >>>> Vincent Rogier >>> ------------------------------------------------------------------------------ >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>> MVPs and experts. ON SALE this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122712_______________________________________________ >>> Orclib-users mailing list >>> Orc...@li... >>> https://lists.sourceforge.net/lists/listinfo/orclib-users |
From: vincent r. <vin...@ya...> - 2013-01-03 22:30:13
|
I will have a look and fix it an version 3.11.2 for end of january. But I will update svn this weekend for the bug regarding null number and this one as well I had plans to enhance direct path support in version 4.0.0 (object support, fix piece support for lobs, ....) I may work on this topics soon as well. Regards Vincent Le 3 janv. 2013 21:21, "Zoltan Farkas" <zol...@ya...> a écrit : > Hi Vincent I also noticed a potential inconsistency: > > OCI_DirPathGetErrorRow seems to return a 0 based row number > while OCI_DirPathSetEntry requires a 1 based row index. > > thank you > > --Z > > > > On Jan 3, 2013, at 4:00 PM, Zoltan Farkas <zol...@ya...> wrote: > > Thank you, will do that. > > --z > > On Jan 3, 2013, at 12:39 PM, vincent rogier <vin...@ya...> wrote: > > > HI, > > I've checked the code, and even if the value provided to > OCI_DirPathSetEntry() is NULL, OCILIB tries to convert the value to NUMBER > if the column has a numeric format. > > I'll fix it in next release. > > The only thing you can do for now is to modify the source to not call > OCI_NumberFromString() in dirpath.c or not call OCI_DirPathSetEntry() for > null numbers. > > Regards, > > Vincent > > > On Tue, Jan 1, 2013 at 11:30 PM, Zoltan Farkas <zol...@ya...>wrote: > >> dy let me know what > > > > > -- > Vincent Rogier > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > > http://p.sf.net/sfu/learnmore_122712_______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > > > |
From: Zoltan F. <zol...@ya...> - 2013-01-03 20:22:04
|
Hi Vincent I also noticed a potential inconsistency: OCI_DirPathGetErrorRow seems to return a 0 based row number while OCI_DirPathSetEntry requires a 1 based row index. thank you --Z On Jan 3, 2013, at 4:00 PM, Zoltan Farkas <zol...@ya...> wrote: > Thank you, will do that. > > --z > > On Jan 3, 2013, at 12:39 PM, vincent rogier <vin...@ya...> wrote: > >> >> HI, >> >> I've checked the code, and even if the value provided to OCI_DirPathSetEntry() is NULL, OCILIB tries to convert the value to NUMBER if the column has a numeric format. >> >> I'll fix it in next release. >> >> The only thing you can do for now is to modify the source to not call OCI_NumberFromString() in dirpath.c or not call OCI_DirPathSetEntry() for null numbers. >> >> Regards, >> >> Vincent >> >> >> On Tue, Jan 1, 2013 at 11:30 PM, Zoltan Farkas <zol...@ya...> wrote: >> dy let me know what >> >> >> >> -- >> Vincent Rogier > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122712_______________________________________________ > Orclib-users mailing list > Orc...@li... > https://lists.sourceforge.net/lists/listinfo/orclib-users > |
From: Zoltan F. <zol...@ya...> - 2013-01-03 15:02:45
|
Thank you, will do that. --z On Jan 3, 2013, at 12:39 PM, vincent rogier <vin...@ya...> wrote: > > HI, > > I've checked the code, and even if the value provided to OCI_DirPathSetEntry() is NULL, OCILIB tries to convert the value to NUMBER if the column has a numeric format. > > I'll fix it in next release. > > The only thing you can do for now is to modify the source to not call OCI_NumberFromString() in dirpath.c or not call OCI_DirPathSetEntry() for null numbers. > > Regards, > > Vincent > > > On Tue, Jan 1, 2013 at 11:30 PM, Zoltan Farkas <zol...@ya...> wrote: >> dy let me know what > > > > -- > Vincent Rogier |
From: vincent r. <vin...@ya...> - 2013-01-03 11:40:22
|
HI, I've checked the code, and even if the value provided to OCI_DirPathSetEntry() is NULL, OCILIB tries to convert the value to NUMBER if the column has a numeric format. I'll fix it in next release. The only thing you can do for now is to modify the source to not call OCI_NumberFromString() in dirpath.c or not call OCI_DirPathSetEntry() for null numbers. Regards, Vincent On Tue, Jan 1, 2013 at 11:30 PM, Zoltan Farkas <zol...@ya...> wrote: > dy let me know what -- Vincent Rogier |
From: Zoltan F. <zol...@ya...> - 2013-01-01 22:31:03
|
I have a number format set for this column (with OCI_DirPathSetColumn of "999.99999")… when trying to set a null value I am getting : OCI-21560: argument 2 is null, invalid, or out of range it seems like when providing a format for numbers setting null values is not possible, it looks like it is possible for dates though … can somebody let me know what can I do to set a null value ? --Z |
From: vincent r. <vin...@gm...> - 2012-12-06 00:13:42
|
Hum... I've been testing my implementation that seemed to works nicely. But... We can have two types of queue table : single consumer and multiple consumers. First case, a message is consumed by one consumer Second case, a message can be consumed by many consumer In the first case, it simple. For the second case, the OCI subscription must specify the consumer name.... Thus it is not possible possible to have a library wide subscription when dealing with a queue with multiple consumers. Thus a subscription must be done for each dequeue object... So i removed OCI_DequeueEnableAsync() and OCI_DequeueDisableAsync() We end up with only 2 new functions ! Here is 2 examples: First a queue with multiple consumer set to false (default) : void on_message(OCI_Dequeue *deq, OCI_Msg *msg) { /* process message here */ } int main(int argc, char *argv[]) { OCI_Connection *con; OCI_Dequeue *deq; OCI_TypeInfo *inf; OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT | OCI_ENV_THREADED |OCI_ENV_EVENTS); con = OCI_ConnectionCreate("db11g", "usr", "pwd", OCI_SESSION_DEFAULT); inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); deq = OCI_DequeueCreate(inf, "usr.my_queue"); OCI_DequeueGetStartAsync(deq, 9999, 0, on_message); getchar(); OCI_DequeueGetStopAsync(deq); OCI_DequeueFree(deq); OCI_ConnectionFree(con); OCI_Cleanup(); return EXIT_SUCCESS; } And a second example where we have a queue with multiple consumers : void on_message(OCI_Dequeue *deq, OCI_Msg *msg) { /* process message here */ } int main(int argc, char *argv[]) { OCI_Connection *con; OCI_Dequeue *deq1; OCI_Dequeue *deq2; OCI_TypeInfo *inf; OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT | OCI_ENV_THREADED |OCI_ENV_EVENTS); con = OCI_ConnectionCreate("db11g", "usr", "pwd", OCI_SESSION_DEFAULT); inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); deq1 = OCI_DequeueCreate(inf, "usr.my_queue"); deq2 = OCI_DequeueCreate(inf, "usr.my_queue"); OCI_DequeueSetConsumer(deq1, "C1"); OCI_DequeueSetNavigation(deq1, OCI_ADN_FIRST_MSG); OCI_DequeueSetConsumer(deq2, "C2"); OCI_DequeueSetNavigation(deq2, OCI_ADN_FIRST_MSG); OCI_DequeueGetStartAsync(deq1, 9998, 0, on_message); OCI_DequeueGetStartAsync(deq2, 9999, 0, on_message); getchar(); OCI_DequeueGetStopAsync(deq1); OCI_DequeueGetStopAsync(deq2); OCI_DequeueFree(deq1); OCI_DequeueFree(deq2); OCI_ConnectionFree(con); OCI_Cleanup(); return EXIT_SUCCESS; } My tests seems to run smoothly... Let me know your opinion :) Vincent On Wed, Dec 5, 2012 at 9:11 PM, vincent rogier <vin...@gm...>wrote: > yep, OCI_DequeueSetConsumer is still optional. > > I'm currently working on implementing the design shown oin my previous > email. > > I'll send to you a temporary ocilib package later this evening :) > > On Wed, Dec 5, 2012 at 9:03 PM, Petr Vaněk <pe...@ya...> wrote: > >> ly assume thatOCI_DequeueSetConsumer is sti > > > > > -- > Vincent Rogier > -- Vincent Rogier |
From: vincent r. <vin...@gm...> - 2012-12-05 20:11:54
|
yep, OCI_DequeueSetConsumer is still optional. I'm currently working on implementing the design shown oin my previous email. I'll send to you a temporary ocilib package later this evening :) On Wed, Dec 5, 2012 at 9:03 PM, Petr Vaněk <pe...@ya...> wrote: > ly assume thatOCI_DequeueSetConsumer is sti -- Vincent Rogier |
From: Petr V. <pe...@ya...> - 2012-12-05 20:04:03
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 that would be perfect (IMHO). I think it's a very clean solution. For eg. simple monitoring it will need only few lines of code. also I silently assume thatOCI_DequeueSetConsumer is still optional (or available with consumer=NULL) to allow to catch all handler's events. thanks, petr On 12/5/12 8:16 PM, vincent rogier wrote: > Hi, > > The design exposed in my previous email would give : > > > void msg_handler(OCI_Dequeue *deq, OCI_Msg *msg) > { > /* process msg payload */ > } > > int main(void) > { > OCI_Connection *con; > OCI_Dequeue *deq1; > OCI_Dequeue *deq2; > > OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_EVENTS | OCI_ENV_THREADED); > > con = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); > inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); > deq1 = OCI_DequeueCreate(inf, "MY_QUEUE"); > deq2 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > OCI_DequeueEnableAsync(PORT, TIMEOUT); > > OCI_DequeueSetConsumer(deq1, "CONSUMER1"); > OCI_DequeueSetConsumer(deq2, "CONSUMER2"); > > OCI_DequeueGetStartAsync(deq1, msg_handler); > OCI_DequeueGetStartAsync(deq2, msg_handler); > > sleep(MAX_INT); > > OCI_DequeueGetStopAsync(deq1); //optional - performed by OCI_DequeueFree > OCI_DequeueGetStopAsync(deq2); //optional - performed by OCI_DequeueFree > OCI_DequeueFree(deq1); > OCI_DequeueFree(deq2); > > OCI_DequeueDisableAsync(); //optional - performed by OCI_Cleanup > OCI_ConnectionFree(con); > OCI_Cleanup(); > > return EXIT_SUCCESS; > } > > > > On Wed, Dec 5, 2012 at 6:39 PM, vincent rogier <vin...@gm... <mailto:vin...@gm...>> wrote: > > Hi, > > In fact, I prefer to not use an OCI_Event as all other fields (database, datetime, etc....) won't be available..... That would be messy ! > > Thus, what i proposed does not make sense. > > As the goal is to implement async dequeuing i prefer proposing another design. What do you think about the following : > * OCI_DequeueEnableAsync(port, timeout) > * OCI_DequeueDisableAsync(void) > * OCI_DequeueGetStartAsync(oci_dequeue *, async callback) > * OCI_DequeueGetStopAsync(oci_dequeue *) > > Where async callback prototype woulb be like: > void callback(oci_dequeue*, oci_msg*) > > Thus no public subscription (it would be internal). Just call to enable/disable program wide aq notification. Then you provide a callback that gets msg object. I find it smooth. > It may need to support more than one central notification... > > Vincent > > > hi Vincent, > > yes, it makes perfect sense to me. > > I'm looking forward to it! > p. > > On 12/5/12 9:07 AM, vincent rogier wrote: > > Hi, > > > > About coding, this is a secondary easy task that required only just few lines of code. > > I'm more focused on how to integrate to OCILIB. > > Is the following mock-up all right for you ? > > > > #include "ocilib.h" > > > #ifdef _WINDOWS > > #define sleep(x) Sleep(x*1000) > > #endif > > > #define PORT 5468 > > #define TIMEOUT 0 > > > void event_handler(OCI_Event *event); > > void error_handler(OCI_Error *err); > > > int main(void) > > { > > OCI_Connection *con; > > OCI_Subscription *sub; > > OCI_Dequeue *deq1; > > OCI_Dequeue *deq2; > > > OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_EVENTS | OCI_ENV_THREADED); > > > con = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); > > sub = OCI_SubscriptionRegister(con, "SUB-MSG", OCI_CNT_MESSAGE, event_handler, PORT, TIMEOUT); > > inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); > > deq1 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > deq2 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > > OCI_DequeueSetConsumer(deq1, "CONSUMER1"); > > OCI_DequeueSetConsumer(deq2, "CONSUMER2"); > > > OCI_SubscriptionAddDequeue(sub, deq1); > > OCI_SubscriptionAddDequeue(sub, deq2); > > > sleep(MAX_INT); > > > OCI_DequeueFree(deq1); > > OCI_DequeueFree(deq2); > > OCI_SubscriptionUnregister(sub); > > OCI_ConnectionFree(con); > > > OCI_Cleanup(); > > > return EXIT_SUCCESS; > > } > > > void error_handler(OCI_Error *err) > > { > > printf("*** error : %s\n", OCI_ErrorGetString(err)); > > } > > > void event_handler(OCI_Event *event) > > { > > OCI_Dequeue *deq = OCI_EventGetDequeue(event); > > OCI_Msg *msg = OCI_DequeueGet(deq); > > > /* process payload */ > > } > > > > > On Tue, Dec 4, 2012 at 8:57 PM, Petr Vaněk <pe...@ya... <mailto:pe...@ya...> <mailto:pe...@ya...> <mailto:pe...@ya...>> wrote: > > > OCI_SubscriptionAddDequeue > > > > > > -- > > Vincent Rogier > > > > > > -- > Vincent Rogier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQv6iiAAoJEC8yRjM4uE2tpd8H/RwdU3qGzA/Vx1J9xI8gzhGq S6qypr0K/ErrRCMCVNZhPGYYp4it1Os8pFek7FidETkOjPdO9HcCq1IVPdFWuX9N ZjqG6+tKWOMSUfHunXxwqdN+I28z0K5jgCzpKGpf2gtAdKnWeg/TZn02sB1sfAle a2fDbpFWzjtZ0N3wtA1zNJrsOAlHLwK8ciIGYbQXsPYMFDBrqgzR2n5iWUgpuH4R 8PJR4m48e6I/40+TZhrunFWg9QFXCZPW+CbxZdLz+XzrIRZEcXJ100yar63AeLfu vaX1XGluwj9+Og88EHxT50gnM1LNRXclU4K1Im66Q/u3NN2zm+6uxx33NcEAVpg= =pry4 -----END PGP SIGNATURE----- |
From: vincent r. <vin...@gm...> - 2012-12-05 19:16:55
|
Hi, The design exposed in my previous email would give : void msg_handler(OCI_Dequeue *deq, OCI_Msg *msg) { /* process msg payload */ } int main(void) { OCI_Connection *con; OCI_Dequeue *deq1; OCI_Dequeue *deq2; OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_EVENTS | OCI_ENV_THREADED); con = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); deq1 = OCI_DequeueCreate(inf, "MY_QUEUE"); deq2 = OCI_DequeueCreate(inf, "MY_QUEUE"); OCI_DequeueEnableAsync(PORT, TIMEOUT); OCI_DequeueSetConsumer(deq1, "CONSUMER1"); OCI_DequeueSetConsumer(deq2, "CONSUMER2"); OCI_DequeueGetStartAsync(deq1, msg_handler); OCI_DequeueGetStartAsync(deq2, msg_handler); sleep(MAX_INT); OCI_DequeueGetStopAsync(deq1); //optional - performed by OCI_DequeueFree OCI_DequeueGetStopAsync(deq2); //optional - performed by OCI_DequeueFree OCI_DequeueFree(deq1); OCI_DequeueFree(deq2); OCI_DequeueDisableAsync(); //optional - performed by OCI_Cleanup OCI_ConnectionFree(con); OCI_Cleanup(); return EXIT_SUCCESS; } On Wed, Dec 5, 2012 at 6:39 PM, vincent rogier <vin...@gm...>wrote: > Hi, > > In fact, I prefer to not use an OCI_Event as all other fields (database, > datetime, etc....) won't be available..... That would be messy ! > > Thus, what i proposed does not make sense. > > As the goal is to implement async dequeuing i prefer proposing another > design. What do you think about the following : > * OCI_DequeueEnableAsync(port, timeout) > * OCI_DequeueDisableAsync(void) > * OCI_DequeueGetStartAsync(oci_dequeue *, async callback) > * OCI_DequeueGetStopAsync(oci_dequeue *) > > Where async callback prototype woulb be like: > void callback(oci_dequeue*, oci_msg*) > > Thus no public subscription (it would be internal). Just call to > enable/disable program wide aq notification. Then you provide a callback > that gets msg object. I find it smooth. > It may need to support more than one central notification... > > Vincent > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > hi Vincent, > > yes, it makes perfect sense to me. > > I'm looking forward to it! > p. > > On 12/5/12 9:07 AM, vincent rogier wrote: > > Hi, > > > > > > About coding, this is a secondary easy task that required only just few > lines of code. > > I'm more focused on how to integrate to OCILIB. > > Is the following mock-up all right for you ? > > > > > > #include "ocilib.h" > > > > #ifdef _WINDOWS > > #define sleep(x) Sleep(x*1000) > > #endif > > > > #define PORT 5468 > > #define TIMEOUT 0 > > > > void event_handler(OCI_Event *event); > > void error_handler(OCI_Error *err); > > > > int main(void) > > { > > OCI_Connection *con; > > OCI_Subscription *sub; > > OCI_Dequeue *deq1; > > OCI_Dequeue *deq2; > > > > OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_EVENTS | > OCI_ENV_THREADED); > > > > con = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); > > sub = OCI_SubscriptionRegister(con, "SUB-MSG", OCI_CNT_MESSAGE, > event_handler, PORT, TIMEOUT); > > inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); > > deq1 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > deq2 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > > > OCI_DequeueSetConsumer(deq1, "CONSUMER1"); > > OCI_DequeueSetConsumer(deq2, "CONSUMER2"); > > > > OCI_SubscriptionAddDequeue(sub, deq1); > > OCI_SubscriptionAddDequeue(sub, deq2); > > > > sleep(MAX_INT); > > > > OCI_DequeueFree(deq1); > > OCI_DequeueFree(deq2); > > OCI_SubscriptionUnregister(sub); > > OCI_ConnectionFree(con); > > > > OCI_Cleanup(); > > > > return EXIT_SUCCESS; > > } > > > > void error_handler(OCI_Error *err) > > { > > printf("*** error : %s\n", OCI_ErrorGetString(err)); > > } > > > > void event_handler(OCI_Event *event) > > { > > OCI_Dequeue *deq = OCI_EventGetDequeue(event); > > OCI_Msg *msg = OCI_DequeueGet(deq); > > > > /* process payload */ > > } > > > > > > > > On Tue, Dec 4, 2012 at 8:57 PM, Petr Vaněk <pe...@ya... > <mailto:pe...@ya...> <pe...@ya...>> wrote: > > > > OCI_SubscriptionAddDequeue > > > > > > > > > > -- > > Vincent Rogier > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (Darwin) > Comment: GPGTools - http://gpgtools.org > Comment: Using GnuPG with undefined - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJQvwGAAAoJEC8yRjM4uE2t7MwH/iYJyM13uHjr7pEYewQJ+cLV > 5iYQTyB6RrD5TCVDXyid9KB55AVHHtef4yr24HDkMTxAit0D+ayP3T51EqV7ojuf > ncqMR895TJMleK01+NSy9W0jzevj81/K8Tia3QO6QdXJd7EPNHiBY0m2EYJaTPbI > AY1H47IKTWadMs2VCEuvV5zMzTf/RP7765FpKB/91/+Tm14A6A4SUY1QRc9mLRJ2 > +vCy6UU8MXhEngKmFUKB+ZBte7YB8GdxrNeStM2vIHTYuRqYEgvzZLmU3oIwubw6 > kOSOy1evKLuXNqe9DxbIwfMdE2T1DMvEtryLGUrHLG3UR35r5LwkhIW7Fp00VD8= > =vGEd > -----END PGP SIGNATURE----- > > -- Vincent Rogier |
From: vincent r. <vin...@gm...> - 2012-12-05 17:39:31
|
Hi, In fact, I prefer to not use an OCI_Event as all other fields (database, datetime, etc....) won't be available..... That would be messy ! Thus, what i proposed does not make sense. As the goal is to implement async dequeuing i prefer proposing another design. What do you think about the following : * OCI_DequeueEnableAsync(port, timeout) * OCI_DequeueDisableAsync(void) * OCI_DequeueGetStartAsync(oci_dequeue *, async callback) * OCI_DequeueGetStopAsync(oci_dequeue *) Where async callback prototype woulb be like: void callback(oci_dequeue*, oci_msg*) Thus no public subscription (it would be internal). Just call to enable/disable program wide aq notification. Then you provide a callback that gets msg object. I find it smooth. It may need to support more than one central notification... Vincent -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hi Vincent, yes, it makes perfect sense to me. I'm looking forward to it! p. On 12/5/12 9:07 AM, vincent rogier wrote: > Hi, > > > About coding, this is a secondary easy task that required only just few lines of code. > I'm more focused on how to integrate to OCILIB. > Is the following mock-up all right for you ? > > > #include "ocilib.h" > > #ifdef _WINDOWS > #define sleep(x) Sleep(x*1000) > #endif > > #define PORT 5468 > #define TIMEOUT 0 > > void event_handler(OCI_Event *event); > void error_handler(OCI_Error *err); > > int main(void) > { > OCI_Connection *con; > OCI_Subscription *sub; > OCI_Dequeue *deq1; > OCI_Dequeue *deq2; > > OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT | OCI_ENV_EVENTS | OCI_ENV_THREADED); > > con = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); > sub = OCI_SubscriptionRegister(con, "SUB-MSG", OCI_CNT_MESSAGE, event_handler, PORT, TIMEOUT); > inf = OCI_TypeInfoGet(con, "MY_MESSAGE", OCI_TIF_TYPE); > deq1 = OCI_DequeueCreate(inf, "MY_QUEUE"); > deq2 = OCI_DequeueCreate(inf, "MY_QUEUE"); > > OCI_DequeueSetConsumer(deq1, "CONSUMER1"); > OCI_DequeueSetConsumer(deq2, "CONSUMER2"); > > OCI_SubscriptionAddDequeue(sub, deq1); > OCI_SubscriptionAddDequeue(sub, deq2); > > sleep(MAX_INT); > > OCI_DequeueFree(deq1); > OCI_DequeueFree(deq2); > OCI_SubscriptionUnregister(sub); > OCI_ConnectionFree(con); > > OCI_Cleanup(); > > return EXIT_SUCCESS; > } > > void error_handler(OCI_Error *err) > { > printf("*** error : %s\n", OCI_ErrorGetString(err)); > } > > void event_handler(OCI_Event *event) > { > OCI_Dequeue *deq = OCI_EventGetDequeue(event); > OCI_Msg *msg = OCI_DequeueGet(deq); > > /* process payload */ > } > > > > On Tue, Dec 4, 2012 at 8:57 PM, Petr Vaněk <pe...@ya... <mailto:pe...@ya...> <pe...@ya...>> wrote: > > OCI_SubscriptionAddDequeue > > > > > -- > Vincent Rogier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQvwGAAAoJEC8yRjM4uE2t7MwH/iYJyM13uHjr7pEYewQJ+cLV 5iYQTyB6RrD5TCVDXyid9KB55AVHHtef4yr24HDkMTxAit0D+ayP3T51EqV7ojuf ncqMR895TJMleK01+NSy9W0jzevj81/K8Tia3QO6QdXJd7EPNHiBY0m2EYJaTPbI AY1H47IKTWadMs2VCEuvV5zMzTf/RP7765FpKB/91/+Tm14A6A4SUY1QRc9mLRJ2 +vCy6UU8MXhEngKmFUKB+ZBte7YB8GdxrNeStM2vIHTYuRqYEgvzZLmU3oIwubw6 kOSOy1evKLuXNqe9DxbIwfMdE2T1DMvEtryLGUrHLG3UR35r5LwkhIW7Fp00VD8= =vGEd -----END PGP SIGNATURE----- |