#1 2015-02-02 09:54:50

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

how block record from save?

i have 2 version same programm
v1.0 and v1.1. In version 1.1 add new field.
i send new version all users but many users work in old 1.0 version and new field dont save.
how to determine that you are using an older version and the message?

Offline

#2 2015-02-02 10:20:22

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

Re: how block record from save?

ab wrote:

Any new property in the TSQLRecord class will be added at SQL level, with a ALTER TABLE ADD COLUMN.
But renaming should be done manually, as changing a field type.
SQLite3 does only support ALTER TABLE ADD COLUMN syntax - see https://www.sqlite.org/lang_altertable.html
For identifying the database revision, there is a user_version parameter to TSQLRestServerDB.CreateMissingTables().
This TSQLRestServerDB.CreateMissingTables method is where the table layout is checked and updated if necessary.

See http://synopse.info/forum/viewtopic.php … 627#p14627

Online

#3 2015-02-02 12:01:53

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

Re: how block record from save?

ok, but how read GetUserVersion or user_version in client?
GetUserVersion - declared protected

code init client side:

var
  Database: TSQLRestClientURI;

...

function InitClient: Boolean;
begin
  Result := True;
  Model := CreateModel;
  ReadConfig;
  Database := TSQLHttpClient.Create(ip, port, Model);
  DataBase.ForceBlobTransfert := True;
  if not Database.ServerTimeStampSynchronize then Result := False;
end;

well if you could use as

function InitClient: Boolean;
begin
  Result := True;
  Model := CreateModel;
  ReadConfig;
  Database := TSQLHttpClient.Create(ip, port, Model);
  DataBase.GetUserVersion < 2 then begin
    Showmessage('blabla');
    Result := False;
    Exit;
  end
  if not Database.ServerTimeStampSynchronize then Result := False;
end;

Last edited by proto (2015-02-02 12:07:04)

Offline

#4 2015-02-02 12:50:46

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

Re: how block record from save?

The user_version parameter of TSQLRestServerDB.CreateMissingTables() is pure database/SQLite3 logic.
What you request is IMHO application/ORM logic, not database/SQLite3 logic.
In your code, naming a TSQLHttpClient instance as "Database" variable sounds a bit confusing.

We may have to add a new feature for model comparison at connection, as we do for interface-based services: the client would send its current model to the server, so that it would be checked against the server expectations.
See http://synopse.info/fossil/tktview/366974912d104
In the meanwhile, you may just define a versioning service to be checked from the client side at connection.

Online

#5 2015-02-02 13:26:29

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

Re: how block record from save?

Database name remains of the alteration code, you are right, i rename it.

ab wrote:

We may have to add a new feature for model comparison at connection, as we do for interface-based services: the client would send its current model to the server, so that it would be checked against the server expectations.

thanks.

Offline

#6 2015-02-25 09:58:28

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

Re: how block record from save?

any news?
users dont update soft and do not fill last add field

Offline

#7 2015-04-08 13:06:39

comod
Member
Registered: 2015-04-08
Posts: 1

Re: how block record from save?

Hi AB!
I apologize for molestation, but there are some changes on this issue?

Offline

Board footer

Powered by FluxBB