Blobs greater than 1000K

"Jon Claney" <i...@sprintmail.com>
Sender: Jon Claney
Subject: Blobs greater than 1000k

Message body:

Using Delphi 3, BDE 5.1, MSSQL Server v7, table with a blob field of
type
image

The first of the following two routines loads a file on disk into an
image
field in a SQL server v7 database, and the second will reverse the
process.
According to the BDE Administrator help (see bottom of this message) the

BLOB SIZE parameter (32k to 1000k range) should not affect live tables,
yet
I can not use these routines to manipulate files greater than 1000k.

Of course, I would prefer to use TQuery (parameters and a a sql
statement)
to manipulate this table, but the same section of the help file suggests

that this may be impossible with queries, certainly will be impossible
with
a query that is not live.

How can I store blobs greater than 1000K in the database, and can this
be
done with a TQuery?

Any help would be greatly appreciated,

-Jon

procedure TMainSpecialForm.CreateFilefromStream(theFileName: string;
  theBlobID: Longint);
var
  bs: TBlobStream;
  fs: TFileStream;

begin
  if theFileName='' then exit;
  theTable.Open;
  theTable.Locate('BLOBID', theBlobID, []);
  fs:=TFileStream.Create(theFileName, fmCreate);
  bs:=nil;
  try

bs:=TBlobStream.Create(TBlobField(theTable.FieldByName('ValueBlob')),bmRead

);
    fs.CopyFrom(bs, 0);
  finally
    fs.Free;
    if bs <> nil then
      bs.Free;
    theTable.Close;
  end;
end;

procedure TMainSpecialForm.UpdateStreamFromFile(fileName: string;
  theBlobID: Longint);
var
  bs: TBlobStream;
  fs: TFileStream;

begin
  if not FileExists(fileName) then exit;
  fs:=TFileStream.Create(fileName ,fmOpenRead);
  bs:=nil;
  try
    fs.Position:=0;
      theTable.Open;
      theTable.Locate('BLOBID', theBlobID, []);
      theTable.Edit;

bs:=TBlobStream.Create(TBlobField(theTable.FieldByName('ValueBLOB')),bmWrite

);
      bs.CopyFrom(fs, 0);
      theTable.Post;
  finally
    fs.Free;
    if bs <> nil then
      bs.Free;
    theTable.Close;
  end;
end;

BLOB SIZE

Determines the fetch buffer size for dead BLOBs. Applications that deal
with
dead BLOBs using dead  table opens or queries or batchmoves can set a
maximum limit on the size of BLOBs to fetch. Setting this parameter to
64
means your application can fetch BLOBs of up to 64K.

This parameter does not apply to live table opens.

Default Value: 32
Range : >32 and <1000

  thill.vcf
< 1K Download