Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBI::bind_colums throws error when element of binding hash is deleteed

by tcf03 (Deacon)
on Oct 16, 2007 at 12:26 UTC ( [id://645158]=note: print w/replies, xml ) Need Help??


in reply to DBI::bind_colums throws error when element of binding hash is deleteed

If I understand you correctly, take a look at tblSync. I wrote this to do table synchronization between heterogeneous databases. I have since added functionality to handle tables w/ no unique keys.
I believe that the following code is what you're after.
# Set up you db connections - my statment handler is $rsth. # prepare and execute your query etc... __SNIP___ my $fetch = \&fetch; $counter = 0; my @rmaporder = qw|col1 col2 col3|; my %rdb; for ( @rmaporder ) { $counter++; $rdb{$_} = undef; $rsth->bind_col( $counter, \$rdb{$_} ); } my $rkey = 'col1'; # Fetch the data and hold in these hashes %RemoteDB = $fetch->($rsth, \%rdb, $rkey); sub fetch { my $sth = shift; my $dbhash = shift; my $key = shift; my %DB; while ( $sth->fetchrow_hashref ) { # Ensure that ALL data is properly quoted # using the dbi->quote method $DB{$dbhash->{$key}}{$_} = $rdbh->quote($dbhash->{$_}) for keys %$dbhash } return %DB or errpt ( 'FATAL', 'Unable to return data from fetch', + 'NA', 'NA' ); } __SNIP__
Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson
  • Comment on Re: DBI::bind_colums throws error when element of binding hash is deleteed
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://645158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2025-06-15 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.