Fieldtype "text" in DataModeler - TBlob


We're using the Data Modeler to export the Aurelius-files. We're running on SQL Server 2008 (as well as on 2005).
If the "datatype" in the Data Modeler is set to "Text", the data modeler export it as a TBlob:

property BearbeitungText: TBlob read FBearbeitungText write FBearbeitungText;

I think, the MSSQL fieldtype "text" isn't a blob.

Therefore code like...

MyDataset.FieldByName( 'BearbeitungText' ).AsString:= 'Hello world' //MyDataset is an aurelius-dataset

... isn't working (anymore).

An typecast-exception ("image isn't compatible with text") occures.
Am I missing the point?


This is by design, TEXT is a memo field, which is a type of BLOB field (sub type text). The TBlob type can handle both binary and text blobs, actually there is even an AsString property which you can use this way:

BearbeitungText.AsString := 'Hello world';

Also, TAureliusDataset handles TBlob properties smoothly, I have re-run the tests here, and FieldByName('').AsString just works with properties of type TBlob. So my guess is that the problem must be somewhere else - I'm not saying the problem can't be in Aurelius, but it's not in the code you mention. Can you provide more info, the line where the error occurs, etc.? I'm not sure this error is happening in Aurelius, I think it's happening at server level, or database-access component level.

I've created a test project. You can download here:

I'm still getting following error message when i connect to a mssql database (2008 r2) over sqlncli11:

image isn't compatible with text

Hi Thomas, actually you are right, I apologize. Data Modeler should generate the property as string so Aurelius can tell it's a Text/CBLOB field, not a binary blob. We will fix this in Data Modeler export. In the meanwhile, the only workaround you have is replace the TBLOB by string and set the size in Column attribute as greater than 65535.

Hi Wagner. When will you release a new version of the data modeler? Could we get a pre-release? Our data model contains many blob fields.

I tested your workaround. How can we load these strings lazy/on demand?

In this case, you can't.

Just a note, for the record, that this has been fixed and improved in both Aurelius and Data Modeler. Aurelius now supports a [DBTypeMemo] attribute to indicate a TBLob property is text, not binary.  And Data Modeler exports that attribute accordingly when the database type is text blob (CLOB, TEXT, MEMO, etc.)