#1 2014-09-30 08:46:37

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

sqlite and field before a variant field

I've defined these tsqlrecord descendants :

    tSqlMyRecordSigned = class(tSqlRecordSigned)
    protected
             fCreated : tCreateTime;
             fModified : tModTime;
             fSyncState,        
             fState : byte;  
    published
             property Created : tCreateTime read fCreated write fCreated;
             property Modified : tModTime read fModified write fModified;
             property State : byte read fState write fState;
             property SyncState : byte read fSyncState write fSyncState;
    end;


    tSqlDominion = class(tSQLMyRecordSigned)
    public
          fDescription : RawUtf8;
          fLocDescription : RawUtf8;
    published
             property Description : RawUtf8 index 255 read fDescription write fDescription stored as_Unique;
             property LocDescription : RawUtf8 index 255 read fLocDescription write fLocDescription;
    end;


    tSqlEB_DocType = class(tSqlDominion)
    private
           fDocProps : Variant;
    published
             property DocProps : variant read fDocProps write fDocProps;
    end;

In the model i've added only tSqlEB_DocType , togheter with other objects.
The server is a restserverdb.
Adding or editing  data with tRecordEditForm doesn't update the LocDescription field.
Also managing the sqlite db with SQliteSpy , isn't possible edit data in the field wich appears in a different color (the same of field DocProps).
As a workaround i've added a new dummy boolean property before DocProps : this solves the problem
I'm using 1.18 downloaded one month ago.

Offline

#2 2014-09-30 10:06:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: sqlite and field before a variant field

And if you work at object level?

Try to debug TRecordEditForm to see what is happening.

Offline

#3 2014-10-01 02:29:25

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: sqlite and field before a variant field

I've debugged and , client side , is all ok (json string contains correct values).
Owing to the refreshing mechanism of the ribbon it's a bit difficult for me to understand what is wrong on server side.
To reproduce this event , i've modified FileTabs in synfile project such a way (added a variant type after keywords):

  TSQLFile = class(TSQLRecordSigned)
  public
    fName: RawUTF8;
    fModified: TTimeLog;
    fCreated: TTimeLog;
    fPicture: TSQLRawBlob;
    fKeyWords: RawUTF8;
    fDocProps: variant;
  published
    property Name: RawUTF8 read fName write fName;
    property Created: TTimeLog read fCreated write fCreated;
    property Modified: TTimeLog read fModified write fModified;
    property Picture: TSQLRawBlob read fPicture write fPicture;
    property KeyWords: RawUTF8 read fKeyWords write fKeyWords;
    property DocPropr: variant read fDocProps write fDocProps;
    property SignatureTime;
    property Signature;
  end;

KeyWords is never saved in the db.

Offline

#4 2014-10-07 08:05:48

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: sqlite and field before a variant field

Hi AB,

it isn't a varint issue, but a null field issue.

in mormotsqlite3 , line 644 :

    result^.BindNull(i) else

should be :

    result^.BindNull(i+1) else

Offline

#5 2014-10-07 16:22:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: sqlite and field before a variant field

Should be fixed by http://synopse.info/fossil/info/b54ddc066c

Thanks a lot for the patch!
smile

Offline

Board footer

Powered by FluxBB