RE: bind_param () - did something change?
John Scoles <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
I do not think so. That section of DBD::Oracle code does need some rework as it was written for Oracle 8. It should be updated to use the Oracle 10+ functionality for both select and updates. Alas one never seems to have any time work, (well finish actully) the work on this one. CheersJohn > Date: Mon, 28 Jan 2013 14:31:44 +0100 > From: [email protected] > To: [email protected] > Subject: bind_param () - did something change? > > I have a table with 5 BLOB's. BLOB's are easy in DBD::CSV and > DBD::Unify, but they need "some help" in Oracle. > > I had a script that did load a table from a CSV file by first inserting > all the records without the blob's and then update each blob in turn > ((DBD::Oracle would not allow me to have 5 BLOB's in one insert or > update). > > Given that c_ll + m_nr are a primary key, I had to change > > foreach my $blob (qw( w_tl w_xml0 w_xml1 w_xml2 w_xml3 attr )) { > print STDERR "Setting $blob in ll_verz_rel ...\n"; > my $sth = $dbh->prepare ("update ll_verz_rel set $blob = ? where c_ll = ? and m_nr = ?"); > for (@llvr) { > $_->{$blob} or next; > $sth->bind_param (1, $_->{$blob}, { ora_type => ORA_BLOB }); > $sth->bind_param (2, $_->{c_ll}, { ora_type => ORA_NUMBER }); > $sth->bind_param (3, $_->{m_nr}, { ora_type => ORA_NUMBER }); > $sth->execute (); > } > } > > to > > foreach my $blob (qw( w_tl w_xml0 w_xml1 w_xml2 w_xml3 attr )) { > print STDERR "Setting $blob\tin ll_verz_rel ... "; > my $sth = prepar ("update ll_verz_rel set $blob = ? where c_ll = ? and m_nr = ?"); > $sth->bind_param (1, undef, { ora_type => ORA_BLOB, ora_field => $blob }); > for (@llvr) { > $_->{$blob} or next; > $sth->execute ($_->{$blob}, $_->{c_ll}, $_->{m_nr}); > } > } > > to get it to insert the records. It FAILED to work without the > ora_field addition > > Now in this case I don't really mind the change. It makes my code > easier, but if I bind to one parameter only, the bind should/could know > what to bind to, it shouldn't need the ora_field entry in the hashref. > In above case, there is one ONE blob in the statement at any time, so > there is no conflict at all, ever. > > -- > H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ > using perl5.00307 .. 5.17 porting perl5 on HP-UX, AIX, and openSUSE > http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ > http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/