Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: storing files with dbi & sqlserver

by gmax (Abbot)
on May 04, 2003 at 20:39 UTC ( [id://255518]=note: print w/replies, xml ) Need Help??


in reply to storing files with dbi & sqlserver

MS SQL has some different BLOB types, such as IMAGE, TEXT and NTEXT, which you can use according to your needs.

As for inserting them into the database, you may use the same upload subroutine that you saw in my node about BLOBs, without the stuff about max length.

However, be aware that inserting large objects in a database through DBI may be tricky. Check the DBI documentation about LongReadLen and LongTruncOK before attempting to achieve your goal.

That aside, retrieving variables from BLOBs is not different from other types.

# --- untested --- $dbh->LongReadLen = 100 * 1024; # 100 KB $dbh->LongTruncOK =0; # will fail if the column is too big my $sth = $dbh->prepare(qq{select image from table where id= ? }); my $image = undef; $sth->execute(1); my $record = $sth->fetchrow_hashref(); $image = $record->{"image"}; $sth->finish;

HTH

_ _ _ _ (_|| | |(_|>< _|

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-25 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found