Subject | Re: How to find the size of the contents of a blob? (problem solved). |
---|---|
Author | mlq97 |
Post date | 2007-10-26T12:51:30Z |
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>Problem solved.
> --- In firebird-support@yahoogroups.com, "mlq97" <mlq@> wrote:
> >
> > I am storing PDF files in Blobs.
> > Is it possible to use a query to find the size of the contents of a
> blob?
> > If so, how does one do this?
>
> From what I can tell, it is not possible out of the box. If it was a
> text blob, then you may be able to do something by casting it to a
> varchar first and using the shipped UDFs, but you are using PDFs.
>
> You could write your own UDF function that accepted a BLOB and
> returned the size in bytes, but this requires the database engine to
> retrieve the entire blob and pass it to your dll to then count every
> time you want to get the number of bytes.
>
> It is easier and quicker to actually store the size in the same table.
> If you wrote the UDF I mentioned in the previous paragraph, you could
> even do this silently using before insert and before update triggers,
> or require the client application to tell you.
>
> Adam
>