in reply to Re: Oracle BLOBs DBD::Oracle
in thread Oracle BLOBs DBD::Oracle
OK, here is it. It's a bit mixed up as I've been trying different things.
Getting the impression this doesn't work though, despite what the documentation says.
# perform the connection using the Oracle driver my $dbh = DBI->connect("dbi:Oracle:$database", "$username", "$password +", { PrintError => 0, RaiseError => 0 }) or die "Can't connect to the database: $DBI::errstr\n"; print "INFO: connected to $database OK, updating picture_table with $p +hoto\n"; # prepare update statement print "INFO: reading $photo to blob\n"; open (BLOB, "<$photo") or die "Can't open $photo: $!"; binmode BLOB; { local($/) = undef; $blob = <BLOB>; } close (BLOB); $quotedblob = $dbh->quote($blob); # THIS ALL WORKS BAR THE BLOB UPLOAD...!!!! #my $sth = $dbh->prepare ("update ssi_pri_photos set recorded = sysdat +e, recorded_by = 'David', photograph = '$blob' where person_number = +'$person_id'"); #my $sth = $dbh->prepare ("select recorded_by from ssi_pri_photos"); my $sth = $dbh->prepare ("update ssi_pri_photos set recorded = sysdate +, recorded_by = 'David', photograph = ? where person_number = $person +_id"); $sth->bind_param(1, $quotedblob, SQL_LONGVARBINARY); # execute the statement in the database $sth->execute or die "Can't execute SQL statement: $DBI::errstr\n";
Thanks to everyone for the suggestions so far, by the way.
Thanks,
David
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Oracle BLOBs DBD::Oracle
by perrin (Chancellor) on Apr 08, 2003 at 18:03 UTC | |
by PerliKnight (Acolyte) on Apr 09, 2003 at 08:48 UTC | |
by perrin (Chancellor) on Apr 09, 2003 at 22:28 UTC | |
by PerliKnight (Acolyte) on Apr 10, 2003 at 07:47 UTC |