#1 2011-09-25 20:04:35

ingoberg
Member
Registered: 2010-11-20
Posts: 17

UpdateField function

I just downloaded the latest version of the framework. In my old version, the TSQLRestServerDB had the following function, which I used in my app:

function UpdateField(Table: TSQLRecordClass; ID: integer;
      const FieldName: shortstring; const FieldValue: RawUTF8): boolean; override;

In the most recent version that I downloaded, this function appears to have beenn changed to:

function UpdateField(Table: TSQLRecordClass; Where: integer;
      const FieldName: shortstring; FieldValue: integer; ByID: boolean): boolean; override;

Is there another function that I can call in the new version that works the same as the old one or should I abandon this approach to updating record values?

Offline

#2 2011-09-26 06:02:29

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

Re: UpdateField function

This is the same function, just one additional parameter:

Take a look a the updated documentation:

    /// update an individual record field INTEGER value from a specified ID or Value
    // - if ByID=true, search for RowID=Where, otherwise search for FieldName=Where
    // - return true on success
    // - this method must be implemented in a thread-safe manner
    function UpdateField(Table: TSQLRecordClass; Where: integer;
      const FieldName: ShortString; FieldValue: integer; ByID: boolean): boolean; virtual; abstract;

So UpdateField(Table,WhereID,FieldName,FieldValue,true) is exactly the same as the previous version.

Just adding a ,true) at the end of the parameters list will work as expected.
Perhaps I should have made this explicit.

Offline

#3 2011-09-26 12:55:06

ingoberg
Member
Registered: 2010-11-20
Posts: 17

Re: UpdateField function

The problem is that the FieldValue parameter is an integer value and not a RawUTF8

Offline

#4 2011-09-26 15:44:40

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

Re: UpdateField function

ingoberg wrote:

The problem is that the FieldValue parameter is an integer value and not a RawUTF8

Indeed - so it's a feature regression here!

Sorry for that.
I'll add a matching overloaded method.

Offline

#5 2011-09-26 16:42:45

ingoberg
Member
Registered: 2010-11-20
Posts: 17

Re: UpdateField function

Thanks for being so responsive! I have no idea how you are able to do this. I just hope that someone else of your caliber is able to get involved.

Offline

#6 2011-09-26 17:06:03

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

Re: UpdateField function

I've added this overloaded method in the source code repository.
See http://synopse.info/fossil/info/a7fad077bf

By the way, I think I've found out a potential issue in TSQLRestServerDB.UpdateField(ByID=true) implementation.
Should be fixed in the same time.

Offline

Board footer

Powered by FluxBB