filtering Blobs

I tried filtering a DbTypeWideMemo Blob like this:

...where(dic.entity.widememoblob <> '')...

This raises an cast error in TMappingExplorer.ValueToVariant trying this line:

Blob := Value.AsType<TBlob>;

I resolved this by this way:

var
  hEmptyBlob: TBlob;
...
        hEmptyBlob.AsUnicodeString := '';
...where(dic.entity.widememoblob <> hEmptyBlob)...

is there another easy way for filtering strings within blob WideMemo-Fields?
Maybe it is worth it handle this case within TMappingExplorer.ValueToVariant?

I don't think there is an easy way. Blobs are simply a bunch of bytes. The fact that they can be strings is strongly related to the string encoding used in Blob.

Your solution is fine and adequate. If you really want to treat your blobs are strings, you can maybe map them as string instead of TBlob.

In most cases my blobs are rtf texts, that could get big containing images and stuff...

Fetching these data is not necessary in roundabout 99% of my usecases, so I'm using TBlob because of lazy loading.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.