Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-07

TField.DataType and ftBlob type

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Many database systems have sub-types for Blob fields. One such example is Firebird/Interbase.

     qfkBinary:     Result := 'Blob sub_type 0';
     qfkLongString: Result := 'Blob sub_type 1';
     ....

Currently I have code that converts the TField.DataType to our framework's local data types....

     ftString,
     ftWideString:
         Result := qfkString;
     ftBlob,
     ftGraphic,
     ftVarBytes:
         Result := qfkBinary;

Is there any way to find out the Sub-Type of a ftBlob in SqlDB? I would like to distinguish between binary data and long text data stored in a Blob field.

For example, in Delphi's IBX or the cross-compiler FBLib components, I could do the following...

begin
   case (AData.sqltype and (not 1)) of
     SQL_BLOB:     begin
                     case AData.sqlsubtype of
                     isc_blob_untyped:   result := qfkBinary;
                     isc_blob_text:      result := qfkLongString;
                     else
                       raise EtiOPFInternalException.Create('Invalid
FireBird sql subtype');
                     end;
                   end;

So is there a way I can find more information regarding TField.DataType when DataType = ftBlob?

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/
Martin Schreiber
to Graeme Geldenhuys
Graeme Geldenhuys wrote 5 lines
Is there any way to find out the Sub-Type of a ftBlob in SqlDB? I would like to distinguish between binary data and long text data stored in a Blob field.

In isc_blob_text is mapped to ftMemo (MSEgui, probably the same in original SqlDB, not tested).
TBlobField has the property BlobType, seems not to be used in fcl-db.

Martin