loading blobs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • picaza

    loading blobs

    hi,

    does anyone have a perl example of loading blobs from either a bin file
    or an input stream?

    much thanks,
    peter

  • Bill Karwin

    #2
    Re: loading blobs

    picaza wrote:[color=blue]
    > does anyone have a perl example of loading blobs from either a bin file
    > or an input stream?[/color]

    open(BLOB, "<blobfile.dat" );
    binmode(BLOB); # if necessary on your platform
    my $blobData;
    read(BLOB, $blobData, 1000000);
    close(BLOB);

    my $sth = $dbh->prepare("INSER T INTO myTable (blobField) VALUES (?)");
    $sth->execute($blobD ata);

    Error checking, reading blobs longer than 1MB, etc. is left up to you.

    Regards,
    Bill K.

    Comment

    Working...