Print Page | Close Window

Fieldtype "text" in DataModeler - TBlob

Printed From: TMS Software
Category: Business Tools
Forum Name: Data Modeler
Forum Discription:
Printed Date: 22 Feb 2020 at 6:55am

Topic: Fieldtype "text" in DataModeler - TBlob
Posted By: Odermatt Thomas
Subject: Fieldtype "text" in DataModeler - TBlob
Date Posted: 08 Mar 2013 at 4:46am

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?


Posted By: Wagner R. Landgraf
Date Posted: 08 Mar 2013 at 6:47am
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.

Posted By: Odermatt Thomas
Date Posted: 08 Mar 2013 at 11:01am
I've created a test project. You can download here:
%20 -

I'm still getting following error message when i connect to a mssql database (2008 r2) over sqlncli11:
image isn't compatible with text

Posted By: Wagner R. Landgraf
Date Posted: 08 Mar 2013 at 2:56pm
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.

Posted By: Odermatt Thomas
Date Posted: 08 Mar 2013 at 4:26pm
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.

Posted By: Odermatt Thomas
Date Posted: 08 Mar 2013 at 5:07pm
I tested your workaround. How can we load these strings lazy/on demand?

Posted By: Wagner R. Landgraf
Date Posted: 09 Mar 2013 at 7:10am
In this case, you can't.

Posted By: Wagner R. Landgraf
Date Posted: 28 Sep 2015 at 10:42pm
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.)

Print Page | Close Window