teads has asked for the wisdom of the Perl Monks concerning the following question:
***** 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::Oracle - RAW datatypes
by cjensen (Sexton) on Oct 19, 2001 at 01:20 UTC | |
by Anonymous Monk on Oct 19, 2001 at 05:24 UTC | |
by cjensen (Sexton) on Oct 19, 2001 at 21:02 UTC | |
by Anonymous Monk on Oct 20, 2001 at 02:52 UTC | |
by cjensen (Sexton) on Oct 20, 2001 at 03:41 UTC | |
| |
|
Re: DBD::Oracle - RAW datatypes
by wyrickre (Initiate) on Feb 24, 2005 at 19:47 UTC | |
by Anonymous Monk on Apr 11, 2014 at 14:48 UTC |