Re: [Orclib-users] Simple insert with in variables to procedure
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
From: Miguel V. <pag...@gm...> - 2015-01-13 21:47:29
|
Yes, i understand the impossibility of sending a class, what i meant was send bulk rows of data in one go. Dont worry. Get that realeas done. And thanks. :-) best regards, MV On Tue, Jan 13, 2015 at 9:37 PM, vincent rogier <vin...@gm...> wrote: > I'm currently finishing creating release packages for v4.0.1. > They will be online wihtin the next hour. > > You cannot send a C++ class to an oracle procedure. > > Regards, > > Vincent > > On Tue, Jan 13, 2015 at 10:34 PM, Miguel Vaz <pag...@gm...> wrote: > >> Hi Vincent, >> >> Thats perfectly ok. Just glad you know what the problem is. I did spend >> the whole afternoon cursing over my code and lack of skills, hehe. :-) >> >> On a different note, how can i send a simple class over to an oracle >> procedure? >> >> Something like: >> >> class person{ >> string nome; >> int id; >> } >> >> on the oracle side somethign like: >> >> create ... >> procedure_name(indata IN cursor){ >> >> >> } >> >> Any pointer on this is great help. >> >> Again, no worries about the bug. :-) >> >> best regards, >> MV >> >> >> >> >> >> >> >> >> >> >> >> >> On Tue, Jan 13, 2015 at 6:40 PM, vincent rogier <vin...@gm...> >> wrote: >> >>> Hi Miguel, >>> >>> I apologize as there is an issue with binding string in the released >>> header files. >>> >>> I'm going to release an version 4.0.1 with some fixes for both C and C++ >>> APIs this week. >>> >>> Regarding your issue, while waiting for the new packages, you can fix it >>> quickly by making the following simple modification : >>> >>> * in the file ocilib_impl.hpp, line 3860 (BindAdaptor template class >>> constructor) >>> * replace _size by size >>> >>> and it should work again :) >>> >>> Sorry for the inconvenience ! >>> >>> Regards, >>> >>> Vincent >>> >>> >>> On Tue, Jan 13, 2015 at 6:15 PM, Miguel Vaz <pag...@gm...> wrote: >>> >>>> Hi, >>>> I cant a simple insert to work using a procedure and ocilib. >>>> >>>> The procedure: >>>> >>>> CREATE OR REPLACE >>>> PROCEDURE criasistema(idout OUT NUMBER, nm IN VARCHAR2) AS >>>> BEGIN >>>> insert into sistemas(NOME) values(nm) returning id_sistema into idout; >>>> >>>> END; >>>> >>>> >>>> Heres the c++ code: >>>> >>>> Environment::Initialize(Environment::Default | Environment::Threaded); >>>> string sql = "declare ids NUMBER begin criasistema(:ids,:nm); end;"; >>>> >>>> try{ >>>> con.Open(connectString, user, passw); >>>> Statement st(con); >>>> Statement st2(con); >>>> st.Prepare(sql); >>>> st.Bind(":ids", st2, BindInfo::Out); >>>> st.Bind(":nm", nome, 255, BindInfo::In); >>>> st.Execute(); >>>> >>>> con.Commit(); >>>> con.Close(); >>>> >>>> } >>>> catch (Exception &ex){ >>>> cout << ex.what() << endl; >>>> } >>>> >>>> Environment::Cleanup(); >>>> >>>> It compiles but breaks at st.Bind(":nm", nome, 255, BindInfo::In); >>>> What am i doing wrong? >>>> >>>> I assumed it would be simply a matter of binding in and out variables >>>> and it shuld work, but not so easy.. :-P >>>> >>>> I am really not at easy with the binds. Next step will be to send a >>>> full object (int,string,...) array, but if i cant solve this simple string >>>> issue, i am not going anywahere. >>>> >>>> Thanks. >>>> MV >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> New Year. New Location. New Benefits. New Data Center in Ashburn, VA. >>>> GigeNET is offering a free month of service with a new server in >>>> Ashburn. >>>> Choose from 2 high performing configs, both with 100TB of bandwidth. >>>> Higher redundancy.Lower latency.Increased capacity.Completely compliant. >>>> http://p.sf.net/sfu/gigenet >>>> _______________________________________________ >>>> Orclib-users mailing list >>>> Orc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/orclib-users >>>> >>>> >>> >>> >>> -- >>> Vincent Rogier >>> >> >> > > > -- > Vincent Rogier > |