moving from 2.6 to 2.8 Blolb Fields Problem

Hi,

Using XE8 I have a project using Aureluis 2.6, I have updated to 2.8 and now blob text fields are not loaded ok from database, using version 2.8 It only loads the first character from database. Had to revert back to 2.6 so blob fields can be loaded ok from database (Database is FIREBIRD).

Hope it is a bug, cuase I have lots of data loaded on the database as blob text fields using 2.6 and upgrading to 2.8 not able to load data ok.

hint: Would be nice to have a property or a default behaviour of JSON serializer to Trim string values from database.

Any hints.

Thanks in Advance,

Omar Zelaya


What is your database access component? What is the underlying datatype in the database? How is the property type declared? And how do you access the text value?

Hi,

This is the class..
  TLIBRERIA = class
  private
    [Column('ID', [TColumnProp.Required])]
    FID: integer;
   
    [Column('UNITNAME', [TColumnProp.Required], 20)]
    FUNITNAME: string;
   
    [Column('DESCRIPCION', [TColumnProp.Required], 80)]
    FDESCRIPCION: string;
   
    [Column('OBSERVACIONES', [], 300)]
    FOBSERVACIONES: Nullable<string>;
   
    [Column('SCRIPT', [TColumnProp.Lazy], 80)]
    FSCRIPT: TBlob;
   
    [Column('PCODE', [TColumnProp.Lazy], 80, 0)]
    FPCODE: TBlob;
   
    [Column('SITUACION', [TColumnProp.Required])]
    FSITUACION: integer;
  public
    property ID: integer read FID write FID;
    property UNITNAME: string read FUNITNAME write FUNITNAME;
    property DESCRIPCION: string read FDESCRIPCION write FDESCRIPCION;
    property OBSERVACIONES: Nullable<string> read FOBSERVACIONES write FOBSERVACIONES;
    property SCRIPT: TBlob read FSCRIPT write FSCRIPT;
    property PCODE: TBlob read FPCODE write FPCODE;
    property SITUACION: integer read FSITUACION write FSITUACION;
  end;

This is how I access the field.

Archivo1.Script.SourceCode.Text := FLibreria.Script.AsString;

The Database is FIREBIRD and the acces components are TUniDac from Devart.

Database DDL

CREATE TABLE LIBRERIAS
(
  ID                         INTEGER         NOT NULL,
  UNITNAME                   VARCHAR(    20) NOT NULL COLLATE NONE,
  DESCRIPCION                VARCHAR(    80) NOT NULL COLLATE NONE,
  OBSERVACIONES              VARCHAR(   300)  COLLATE NONE,
  SCRIPT                        BLOB SUB_TYPE 1 SEGMENT SIZE 80,
  PCODE                         BLOB SUB_TYPE 0 SEGMENT SIZE 80,
  SITUACION                  INTEGER         NOT NULL,
 CONSTRAINT PK_LIBRERIAS PRIMARY KEY (ID)
);

As I have mentioned before, everything works OK on 2.6 but not on 2.8, so something has changed on 2.8 on accesing blob fields.

Thanks in Advance,

Omar Zelaya

Use it this way:


Archivo1.Script.SourceCode.Text := FLibreria.Script.AsUnicodeString;


Hi,

Ok the previous data I had on the database is loaded OK. Now if I use AsUnicodeString to set the text of the field and reload it using AsUnicodeString doesnt work. again it only load the first character.

If I set the text data using AsString and get it using AsUnicodeString works OK. Is this a normal behaviour now?

Thanks in advance,

Omar Zelaya

Add [DBTypeMemo] attribute to your TBlob properties you want to behave like a memo. And when you do that, the content of the blob must be in Unicode encoding.

Hi,

Is there a way to set this on Data Modeler so changes to the generated file are not lost when regenerating?

Thanks in advance,

Omar Zelaya

Latest Data Modeler version already adds that [DBTypeMemo] attribute to memo fields.