#1 2017-09-05 06:20:01

wac1104
Member
Registered: 2017-08-25
Posts: 17

What is the use of TSQLmodel?

I found that I used sample06   client to build a tsqlmodel
What is the use of TSQLmodel?

Offline

#2 2017-09-05 06:26:26

wac1104
Member
Registered: 2017-08-25
Posts: 17

Re: What is the use of TSQLmodel?

I would like to send the  TSQLrecord object  to restful server how do i do?

Offline

#3 2017-09-05 06:30:11

wac1104
Member
Registered: 2017-08-25
Posts: 17

Re: What is the use of TSQLmodel?

I tried this  code Fclient.CallBackGetResult ('UserLogin', [UserInfo]);
but  httpserver  recive   nil ctxt.parmaters
procedure THttpServer.UserLogin (CTXt: TSQLRestServerURIContext);
var
   User: TUserInfo;
   P: PUTF8Char;
begin
//
   //
   P: = CTXt.Parameters;
end

Offline

#4 2017-09-05 06:33:47

wac1104
Member
Registered: 2017-08-25
Posts: 17

Re: What is the use of TSQLmodel?

My ServerCode

unit frm_Server;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,SynCommons,mORMot,mORMotHttpServer,data_record,
  Vcl.StdCtrls;

type
  THttpServer=class(TSQLRestServerFullMemory)
  published
    procedure UserLogin(CTXt:TSQLRestServerURIContext);
  end;
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    FModel: TSQLModel;
    { Private declarations }
    FServer:THttpServer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormDestroy(Sender: TObject);
begin
  if Assigned(FServer) then FreeAndNil(FServer);
  if Assigned(FModel) then FreeAndNil(FModel);

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  button1.Enabled :=false;
  if Assigned(FServer) then FreeAndNil(FServer);

  if Assigned(FModel) then FreeAndNil(FModel);

  FModel  :=TSQLModel.Create([TUserInfo],'service');
  FServer :=THttpServer.Create(FModel);
  FServer.ExportServerNamedPipe('RestService');
  Button1.Enabled :=true;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

{ THttpServer }

procedure THttpServer.UserLogin(CTXt:TSQLRestServerURIContext);
var
  User:TUserInfo;
  P:PUTF8Char;
begin
//
  //
  P :=CTXt.Parameters;

end;

end.

Offline

#5 2017-09-05 06:35:19

wac1104
Member
Registered: 2017-08-25
Posts: 17

Re: What is the use of TSQLmodel?

My ClientCode

procedure TestRestfullHttpClient.SetUp;
begin
  inherited;
  FModel :=TSQLModel.Create([TUserInfo],'service');
  FClient :=TSQLRestClientURINamedPipe.Create(FModel,'RestService');
end;

procedure TestRestfullHttpClient.TearDown;
begin
  FreeAndNil(FClient);
  inherited;

end;

procedure TestRestfullHttpClient.TestRestuFullClientAccess;
var
  UserInfo :TUserInfo;
begin
  UserInfo :=TUserInfo.Create;
  try
    UserInfo.UserName :='EricWang';
    UserInfo.Password :='123456';
    UserInfo.SessionKey :='sldkjfa;lkdjf';
    UserInfo.Version :='1.125';
    UserInfo.ProductID :=3;
    Fclient.CallBackGetResult('UserLogin',[UserInfo]);

  finally
    FreeAndNil(UserInfo);
  end;

Offline

#6 2017-09-05 07:07:27

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

Re: What is the use of TSQLmodel?

Please follow the forum rules.
https://synopse.info/forum/misc.php?action=rules
Don't post such extensive source code in the forum.

About your question, it is unclear what it is.
Open the documentation https://synopse.info/files/html/Synopse … 01.18.html
Go to the keyword list. Search for TSQLModel.
Click on the light blue links, which are the "main entries" about the keyword.
You will find https://synopse.info/files/html/Synopse … l#MNDX_666
and https://synopse.info/files/html/Synopse … #MNDX_2059

Offline

Board footer

Powered by FluxBB