***** select snippet:my $max_len = 20000; # #Load Filenames into Scalar # opendir(DIR, "/RAWdata") || die "Cannot open gif:$!\n"; my @filenames = grep !/^\./, readdir(DIR); close(DIR); my $file; # #Go through list of filenames in a directory #Add the name, length, and binary data to the table # foreach my $title (@filenames) { open(FILE, "/RAWdata/$title") || die "Cannot open $title : $!\n"; binmode FILE; my $file_len = read FILE, $file, $max_len; #Prepare Insert Statement my $sth = $dbh->prepare("INSERT into RAH values (?,?,?)" ); #Bind Variables to columns. $sth->bind_param(1,$title); $sth->bind_param(2,$file_len); $sth->bind_param(3,$file, {ora_type => ORA_RAW} ); #Insert. my $rv = $sth->execute(); close(FILE); }
$dbh->{LongReadLen} = '20000'; opendir(DIR, "/RAWdata") || die "Cannot open gif:$!\n"; my @filenames = grep !/^\./, readdir(DIR); close(DIR); my $title; # #Select out RAW's based on their filename - R_NAME # foreach my $title (@filenames) { my $sth = $dbh->prepare("SELECT R_RAW from RAH where R_NAME='$t +itle'"); $sth->execute(); # #Put selected RAW into an array, write it to a file using the filename + you #got from the RAWdata directory. # my @jpg = $sth->fetchrow_array(); open(FILE, ">$title") || die "Cannot open file for writing: $!\ +n"; print FILE @jpg; close(FILE); $sth->finish();
Edit kudra, 2001-10-19 Replaced br with code
In reply to DBD::Oracle - RAW datatypes by teads
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |