#4 Re: mORMot 1 » Memory usesed by mormot Server increasing all time when client runing » 2017-02-17 07:36:19

vga

function ExecuteSQL(FormatSQLWhere: string; const BoundsSQLWhere: array of const): Boolean;
var
  Query: IRemoteSQL;
  aSQL: RawUTF8;
begin
  aSQL := FormatUTF8(PUTF8Char(FormatSQLWhere), [], BoundsSQLWhere);
  if Client.Services['RemoteSQL'].Get(Query) then
  try
    Query.Execute(aSQL, False, False);
    Result := True;
  except
    Result := False;
  end;
end;

Iused  delphi 2007    zeosdbo 7.2  mysql 5.6   windows 7

#5 mORMot 1 » Memory usesed by mormot Server increasing all time when client runing » 2017-02-17 07:33:06

vga
Replies: 6

mOrmot is very grate product and I like it very much!

thease days, my server report "Out of memory" error.

my client code:

procedure TForm1.btnTestClick(Sender: TObject);
var
  Data, SQL: string;
  Data_ID: Integer;
begin
  Data_ID := 1;

  while not chkStop.Checked do
  begin
    Application.ProcessMessages;
    Caption := IntToStr(Data_ID);
    Data := widestringToUtf8('11123錦');
    SQL := Format('update t_data set Dat=:(''%s''):,PostTime1=now(),s1=2 where Data_ID=%d', [Data, Data_ID]);

    if not ExecuteSQL(sql, []) then
    begin
      ShowMessage('Fail to save data!');
      Break;
    end;
    Inc(Data_ID);
  end;
end;

when runing, I found the  memory usesed by mormotServer increasing。

#6 Re: mORMot 1 » Insert Record with Mysql Server Time » 2016-12-19 22:06:31

vga

ok,

ExecuteSQL(
      'insert into `t_appstaffonline`(Staff_ID, IP, AppName, OnLine, LastLoginTime)' +
      'values(?,?,?,?,now())',[1, '127.0.0.1', 'app.exe', 1]);


this work fine.

#7 Re: mORMot 1 » Insert Record with Mysql Server Time » 2016-12-18 21:52:33

vga

thank you.

How can I fill the value of the field LastLoginTime with mysql server time "now()" when insert record to the table?

#8 mORMot 1 » Insert Record with Mysql Server Time » 2016-12-18 01:23:46

vga
Replies: 3

I use Delphi 2007 , Mysql 5.6,

CREATE TABLE `t_appstaffonline` (
    `App_ID` INT(11) NOT NULL AUTO_INCREMENT ,
    `Staff_ID` INT(11) NULL DEFAULT NULL,
    `AppName` VARCHAR(50) NULL,
    `IP` VARCHAR(50) NULL DEFAULT NULL,
    `Online` INT(11) NULL DEFAULT 0,
    `UpdateTime` TIMESTAMP NULL',
    `LastLoginTime` TIMESTAMP NULL,
    `LastLogOutTime` TIMESTAMP NULL DEFAULT NULL,
    PRIMARY KEY (`App_ID`),
    UNIQUE INDEX `Idx_SAP` (`Staff_ID`, `AppName`)
);


I want to set   LastLoginTime to DBServer's time, 
so my SQL Statement:

'insert into `t_appstaffonline`(Staff_ID, IP, AppName, OnLine, LastLoginTime)' +
'values(?,?,?,?,?)',[1, '127.0.0.1', 'app.exe', 1, 'now()']);

but this does not work,  and

'insert into `t_appstaffonline`(Staff_ID, IP, AppName, OnLine)' +
'values(?,?,?,?)',[1, '127.0.0.1', 'app.exe', 1]);

work fine, why

#10 Re: mORMot 1 » About TSQLHttpClient & TSQLDBSocketConnectionProperties » 2016-09-04 09:39:31

vga

thank you.

I did not get it work. 

TSQLHttpClient to execute server functions, when return json datarows,  how convert result to clientdataset?

#11 mORMot 1 » About TSQLHttpClient & TSQLDBSocketConnectionProperties » 2016-09-03 03:57:33

vga
Replies: 4

hello,

    My program need TSQLHttpClient to execute server functions, and I

    use  TSQLDBSocketConnectionProperties to open query,

    could TSQLHttpClient and  TSQLDBSocketConnectionProperties
    use the same port?


    Model := TSQLModel.Create([], ROOT_NAME);
    ClientA := TSQLHttpClient.Create('127.0.0.1', '8192', Model);
    Client.ServerTimeStampSynchronize;

   with

    fClientB := TSQLDBSocketConnectionProperties.Create('127.0.0.1:8192', 'myserver', 'myusername', 'password');

#12 Re: mORMot 1 » about sql with utf8 chars » 2016-08-18 19:57:43

vga

thank you.  I use Delphi 2007 & xe2

#13 mORMot 1 » about sql with utf8 chars » 2016-08-18 09:06:44

vga
Replies: 2

hello,

    My Code (I use  zeosdbo ):

procedure TFrmMain.btnClick(Sender: TObject);
var
  val: string;
begin
   { --- this do not work,   
   fClient.ExecuteNoResult(formatutf8('update `t_data` set `imgname`=''%''',
    [AnsiToUtf8('錦錦.jpg')]), []);
   }

   // this work fine
    val := '錦錦.jpg';
    fClient.ExecuteNoResult('update `t_data` set `imgname`=?', [AnsiToUtf8(val)]);

  { ----- this will no work ----
    sql := 'update `tb_status` set `imgname`='  + AnsiToUtf8('錦錦.jpg');
    fClient.ExecuteNoResult(sql, []);
  }
end;

Board footer

Powered by FluxBB