Closed ypandit closed 11 years ago
pg_type => PG_BYTEA
is used.use DBD::Pg qw(:pg_types);
open( IMAGE, $filepath );
binmode(IMAGE);
my $buf;
my $data;
while ( read( IMAGE, $buf, 10000 ) ) { $data .= $buf; }
close(IMAGE);
$self->schema->storage->dbh_do(
sub {
my ( $storage, $dbh ) = @_;
my $sth
= $dbh->prepare(
"INSERT INTO stockprop (stock_id, type_id, value) VALUES ( ?,?,? ) "
) or die "PREPARE FAILED";
$sth->bind_param( 3, undef, { pg_type => PG_BYTEA } );
$sth->execute(
$stock_rs->stock_id,
$self->find_or_create_cvterm(
'plasmid map', 'dicty_stockcenter'
),
$data
) or die "EXECUTE FAILED";
$sth->finish;
}
);
Ref: 7a7a4e3 #L145
View from #89