This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
To: Oleg Mechtcheriakov <ome@webcom.de> From: Tim Bunce <Tim.Bunce@pobox.com> Subject: Re: :Proxy and bind_param (with ORACLE) Date: Thu, 13 Dec 2001 16:00:38 +0000 FYI I've opted to apply the ProxyServer patch (thanks) but not the Proxy patch for named bind params. I'm not comfortable with the sql-editing approach. Too risky for general use. I think a better fix would be to treat $sth->{'proxy_params'} as a list of lists of bind params, so a bind_param(1,$foo) would push [1,$foo] onto teh list, and bind_param_inout(":baz",\$bar,10) would push [":baz",\$bar,10] onto the list. The list-of-lists would be easy to recognise and handle on the server side. Tim. On Thu, Aug 23, 2001 at 05:24:17PM +0200, Oleg Mechtcheriakov wrote: > OK, > > here come 'diff -c' files. > > And sorry for not so good explanation. Clear English is not my best point. > :-) > > But changes in the server and client code are independent. And basically > only Proxy.pm has to be changed for sure. Changes in ProxyServer fix another > point. > > So I don't use hash ref to allow new clients to work with old server. That > means that the communication and server's algorithm are kept the same. > > Reg's > Oleg > > > > > -----Original Message----- > > From: Tim Bunce [mailto:Tim.Bunce@pobox.com] > > Sent: Thursday, August 23, 2001 5:04 PM > > To: Oleg Mechtcheriakov > > Cc: 'Scott T. Hildreth'; dbi-users@perl.org; 'Tim Bunce' > > Subject: Re: :Proxy and bind_param (with ORACLE) > > > > > > On Thu, Aug 23, 2001 at 03:57:18PM +0200, Oleg Mechtcheriakov wrote: > > > OK, > > > > > > sorry for a delay, I was not in the office. > > > > > > The diff files are attached. The changes could be actually > > too fast and > > > dirty -- I'm just occasional programmer so may be I missed > > some hidden magic > > > behind of these modules. > > > > Why not just make params be a hash ref? Far simpler. (Don't > > forget to allow > > the server to handle both so old clients can still talk to a > > newer server.) > > > > Tim. > > > > p.s. Please use a context diff format (diff -c or diff -u). > > > > > Here comes an explanation. > > > > > > ---- Proxy.pm. ---- > > > Existing version didn't handle named parameters in the > > function bind_param > > > (and bind_param_inout of course). > > > > > > The function is exented to handle named parameters as well. > > Named parameters > > > are supposed to be passed in the form > > ':name_of_the_parameter'. The function > > > replaces these named parameters in the quesry string with > > ':p1', ':p2' and > > > bind them as numbered parameters. This is allowed due to > > the fact that > > > DBD::Proxy doesn't make true 'prepare' and the query string > > could be changed > > > after 'prepare' was called. > > > > > > Perhaps the code itself has to be veryfied by some Perl > > guru because I'm not > > > 100% sure in my regular expressions. One more point is that > > to make sure I > > > programmed it so that named parameters in the form ':p1' > > will be rejected > > > but actually may be it was to restrictive. > > > > > > ---- ProxyServer.pm ---- > > > Existing version processed parameter binding in the > > function 'execute' in a > > > wrong way. The decision about which function to use, bind_param or > > > bind_param_inout was made based on the number of the > > parameters passed in > > > the initial call of bind_param (or bind_param_inout) being > > made on the > > > client side (in the Proxy.pm). It worked well only when all > > the parameters > > > were given, i.e. > > > > > > $sth->bind_param_inout(1,\$addr_id,32,DBI::SQL_INTEGER) > > > > > > or > > > $sth->bind_param(1,$addr_id,DBI::SQL_INTEGER) > > > > > > > > > Actually my changes are optional and made mainly to get all > > my existing > > > scripts running whereas not all of them are supplying the > > whole parameter > > > list. > > > > > > Now the dicision which fucntion to use is made based on the > > 'nature' of the > > > parameter variable. It checks directly if this is a > > reference or not. > > > > > > That's all. Your are welcom to ask for more detailed explanation. > > > > > > Reg's > > > Oleg > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: shildret@scotth.emsphone.com > > > > [mailto:shildret@scotth.emsphone.com]On Behalf Of Scott > > T. Hildreth > > > > Sent: Tuesday, August 21, 2001 3:31 PM > > > > To: Oleg Mechtcheriakov > > > > Cc: dbi-users@perl.org > > > > Subject: RE: :Proxy and bind_param (with ORACLE) > > > > > > > > > > > > > > > > I believe you want to send the patch to Tim, since DBD::Proxy is > > > > bundled with DBI. > > > > > > > > On 21-Aug-01 Oleg Mechtcheriakov wrote: > > > > > OK, > > > > > > > > > > now I'm ready to answer my question om my own. > > > > > > > > > > The point was exactly that. DBI::Proxy worked well only for > > > > 'numbered' > > > > > parameters. I've created small and dirty patch to work with > > > > named parameters > > > > > as well. Who is the right person to talk about the patch > > > > for DBI::Proxy? > > > > > > > > > > Reg's > > > > > Oleg > > > > > > > > > >> -----Original Message----- > > > > >> From: Oleg Mechtcheriakov [mailto:ome@webcom.de] > > > > >> Sent: Monday, August 20, 2001 12:35 PM > > > > >> To: dbi-users@perl.org > > > > >> Subject: DBD::Proxy and bind_param (with ORACLE) > > > > >> > > > > >> > > > > >> Greetings, > > > > >> > > > > >> has someone experienced troubles with DBD::Proxy and > > > > >> bind_param function? > > > > >> > > > > >> I'm trying to switch from DBD::Oracle to DBD::Proxy and > > > > >> everything was OK > > > > >> but bind_param gives me an exception. > > > > >> > > > > >> Here is the code snippet: > > > > >> > > > > >> my $addr_id; > > > > >> my $sth = $dbh->prepare(q{BEGIN :id := > > > > >> first_req.check_req_sub_ok(:address);END;}); > > > > >> $sth->bind_param_inout(":id",\$addr_id,32,DBI::SQL_INTEGER); > > > > >> $sth->bind_param(":address",$address); > > > > >> > > > > >> which gives me the following error message at the first > > > > >> bind_param_inout > > > > >> > > > > >> Modification of non-creatable array value attempted, > > > > subscript -1 at > > > > >> /usr/local/lib/perl5/site_perl/5.6.1/i86pc-solaris/DBD/Proxy.p > > > > >> m line 536 > > > > >> > > > > >> Any ideas? > > > > >> > > > > >> Many thanks in advance > > > > >> Oleg > > > > >> > > > > >> > > > > > > > > > > > > > ---------------------------------- > > > > E-Mail: Scott T. Hildreth <shildreth@emsphone.com> > > > > Date: 21-Aug-01 > > > > Time: 08:29:52 > > > > ---------------------------------- > > > > > > > > > > > > ===