#1 Re: mORMot 1 » Regional Settings Windows » 2015-03-06 07:39:05

great, but not all look fine.
original code

  // 2. handle missing .msg file
  LanguageForLanguageFile := aLanguage;
  if LanguageForLanguageFile<>lngEnglish then
    if not FileExists(TLanguageFile.FileName(LanguageForLanguageFile)) then begin
      if aForceEnglishIfNoMsgFile then
        if CurrentLanguage.Index=lngEnglish then
          exit else
          aLanguage := lngEnglish;
      LanguageForLanguageFile := lngEnglish; // no .msg -> no translation 
    end;

5264488.jpg

dates look bad, not default view dd.mm.yyyy

if change

  // 2. handle missing .msg file
  LanguageForLanguageFile := aLanguage;
  if LanguageForLanguageFile<>lngEnglish then
    if not FileExists(TLanguageFile.FileName(LanguageForLanguageFile)) then begin
      if aForceEnglishIfNoMsgFile then
        if CurrentLanguage.Index=lngEnglish then
          exit else
          aLanguage := lngEnglish;
      LanguageForLanguageFile := lngRussian; // CHANGED TO lngRussian
    end;

dates look fine
5282920.jpg

Do not know why such a difference

#2 Re: mORMot 1 » how block record from save? » 2015-02-25 09:58:28

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

#3 Re: mORMot 1 » how block record from save? » 2015-02-02 13:26:29

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.

#4 Re: mORMot 1 » how block record from save? » 2015-02-02 12:01:53

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;

#5 mORMot 1 » how block record from save? » 2015-02-02 09:54:50

proto
Replies: 6

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?

#6 Re: mORMot 1 » Does anyone know any alternative to SOAP client for Delphi? » 2014-10-31 13:20:03

mpv can you put here your implementation?
Пишу интеграцию с единой регистратурой (ФЕР), они используют протокол SOAP и ничего кроме него(. Если поделишься реализацией будет просто чудестно.

#7 Re: SyNode » Adding JavaScript support for mORMot framework » 2014-10-30 10:19:19

Spidermonkey has passed V8 on Octane performance on arewefastyet, and is now leading V8 and JSC on Octane, Sunspider and Kraken.
http://robert.ocallahan.org/2014/10/are … e-are.html

#9 Re: mORMot 1 » 10 - Background Http service not work after update » 2014-09-08 10:38:49

hm, very strange.
rewrite server with 10 - Background Http service and try use xxx /install and danielkuettner command - it works!

thanks for advise danielkuettner, but i dont know why new version broken /start command, may be not execute procedure TSQLite3HttpService.DoStart(Sender: TService)?

#10 mORMot 1 » 10 - Background Http service not work after update » 2014-09-05 11:10:11

proto
Replies: 6

i update mormot and recompile my background service and he broken - not work. I rollback to old mormot folder and service work fine, again change folder to new mormot and broken.
i run sample 10 - Background Http service and he broken too///

log on /install:

20140905 15080316 trace mORMotHttpServerService="ssStopped"
20140905 15080316 info  Controling mORMotHttpServerService with command "/install"
20140905 15080316 OSERR CreateService("mORMotHttpServerService","mORMot Http Server Service") "Указанная служба уже существует" (1073)  stack trace API 00528B12 005A77BA 005A7DB6 006345A7 00639D3E 7C817077
20140905 15080316 trace Quitting command line
20140905 15080316 trace mORMotHttpServerService="ssStopped"

log on /start

20140905 15080437 trace mORMotHttpServerService="ssStopped"
20140905 15080437 info  Controling mORMotHttpServerService with command "/start"
20140905 15080443 OSERR TServiceController(00C84F90) Start "Служба не ответила на запрос своевременно" (1053)  stack trace API 00528C02 005A7C92 005A7E56 006345A7 00639D3E 7C817077
20140905 15080443 trace Quitting command line
20140905 15080443 trace mORMotHttpServerService="ssStopped"

#11 Re: mORMot 1 » SOS! Not enough storage to process this command » 2014-08-06 09:41:58

thank you very much for your help, this is true, there are no memory leaks

#12 Re: mORMot 1 » SOS! Not enough storage to process this command » 2014-08-06 09:23:46

is not the problem if you comment out these lines, the error is still there.

          if pic <> '' then begin
//            img.Picture := nil;
//            img.Picture.Assign(LoadFromRawByteString(pic));
            LoadFromRawByteString(pic)
          end;

error somewhere in the bowels function LoadFromRawByteString

#13 mORMot 1 » SOS! Not enough storage to process this command » 2014-08-06 08:58:43

proto
Replies: 4

I'm writing a simple directory to save the jewelry filtration. With the active use vyhodito error "Not enough memory to process this command", it generates a scroll pages back and forth.
I wrote a test case showing the problem. I'm on the 2950-2960 iteration pops overflow memory.
Please help solve the problem!

https://www.dropbox.com/s/zg0629isv7d7w … String.zip

  TSQLProduct = class(TSQLRecord)
  private
    fPreview: TSQLRawBlob;
  public
  published
    property preview: TSQLRawBlob read fPreview write fPreview;
  end;

var
  Form1: TForm1;
  Database: TSQLRestClientURI;
  Server: TSQLRestServerDB;
  model: TSQLModel;

implementation

{$R *.dfm}

function CreateModel: TSQLModel;
begin
  result := TSQLModel.Create([TSQLProduct]);
end;

procedure InitClient;
begin
  Model := CreateModel;
  Database := TSQLRestClientDB.Create(Model, CreateModel, 'test.db3', TSQLRestServerDB);
  if Database = nil then Exit;
  DataBase.ForceBlobTransfert := True;
  TSQLRestClientDB(Database).Server.CreateMissingTables(0);
end;

procedure FinalizeClient;
begin
  Server.Free;
  Database.Free;
  Model.Free;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i, j, c: Integer;
  jpg: TJPEGImage;
  pic: RawByteString;
  prd: TSQLProduct;
begin
  c := 0;
  for j := 1 to 1000 do begin
    for i := 1 to 1000 do begin
        prd := TSQLProduct.Create(Database, i, False);
        try
          pic := prd.preview;
          inc(c);
          Caption := IntToStr(c);
          if pic <> '' then begin
            img.Picture := nil;
            img.Picture.Assign(LoadFromRawByteString(pic));
          end;
      finally
        FreeAndNil(prd);
      end;
      Application.ProcessMessages
    end;
  end;
end;

initialization
  Gdip := TGDIPlusFull.Create;
  InitClient;
finalization
  FinalizeClient();
end.

#14 mORMot 1 » how to add a function charindex? » 2012-02-20 06:46:57

proto
Replies: 2

http://sqlite.org/contrib

http://sqlite.org/contrib wrote:

extension-functions.c (50.96 KB) contributed by Liam Healy on 2010-02-06 15:45:07

Provide mathematical and string extension functions for SQL queries using the loadable extensions mechanism. Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter. Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile.

#16 Re: mORMot 1 » bug use fileone » 2011-12-15 11:15:21

ups, you absolutly right

#17 mORMot 1 » bug use fileone » 2011-12-15 09:06:47

proto
Replies: 2

part of Person Class

  TSQLPerson = class(TSQLRecord)
  private
    fFam, fIm, fOt,
    fSex: string;
    fDr: TDateTime;
...
  published
    property Fam: string read fFam write fFam;
    property Im: string read fIm write fIm;
    property Ot: string read fOt write fOt;
    property Sex: String read fSex write fSex;
    property Dr: TDateTime read fDr write fDr;
...
  end;

part of Patients Class

  TSQLPatients = class(TSQLPerson)
  private
    fMO: Integer;
    fFizRazv: string;
    fMass, fRost: Real;
...
  published
    property MO: Integer read fMO write fMO;
    property FizRazv: string read fFizRazv write fFizRazv;
    property Mass: Real read fMass write fMass;
    property Rost: Real read fRost write fRost;
...
  end;

procedure update Medical organization code (MO)

procedure TfrmMain.SetMO;
var
  i: Integer;
  patients: TSQLPatients;
  ids: TIntegerDynArray;
begin
  if TablePatients = nil then Exit;

  patients := TSQLPatients.Create;
  try
    patients.FillPrepare(TablePatients);
    if Database.TransactionBegin(TSQLPatients) then
    try
      Database.BatchStart(TSQLPatients);
      while patients.FillOne do begin
        patients.MO := MOs.ID;
        Database.BatchUpdate(patients);
      end;
      Database.BatchSend(ids);
      Database.Commit;
      ShowNotification('МО успешно обновлено');
    except
      ShowNotification('Ошибка при обновлении');
      Database.RollBack;
    end;
  finally
    FreeAndNil(patients);
  end;
end;

patients.FillOne fill only TSQLPerson date (Fam, Im, Ot, Sex...) and no one TSQLPatients (MO, FizRazv...)

#18 Re: mORMot 1 » how do I change the header names in DrawGrid? » 2011-11-18 12:31:19

how search hidden id?

Table := Database.ExecuteList([], 'select Id, TipogNum, Fam, Im, Ot, DateBorn, MestoRab from DataRecord');
ttg := TSQLTableToGrid.Create(dgDataRecord, Table, Database);
ttg.OnValueText := OnListText;
ttg.IDColumnHide; //if comment this line i bring search result

dgDataRecord.Row := Table.SearchValue('5', 1, 0, nil); // search record with id = 5

#19 Re: mORMot 1 » how do I change the header names in DrawGrid? » 2011-11-16 12:59:23

I'm trying to determine the visibility of the ID column but the result lie all the time

in documentation:
function IDColumnHide: boolean;
- return true is ID was succesfully hidden, false if not possible

in code:

function TSQLTable.IDColumnHide: boolean;
var FID,R,F: integer;
    S,D1,D2: PPUTF8Char;
begin
  // 1. check if possible
  result := false;
  if (self=nil) or Assigned(fIDColumn) or (FieldCount<=1) then
    exit; // already hidden or not possible <<<--- always false if hidden

#20 mORMot 1 » how do I change the header names in DrawGrid? » 2011-11-14 09:34:04

proto
Replies: 5
Table := Database.ExecuteList([], 'select * from base');
TSQLTableToGrid.Create(DrawGrid, Table, Database);

how to change the header of the received table? I want to Russify them, as I understood the module to change the SQLite3i18n prednaznichen not dynamically change the text

#21 mORMot 1 » manyupdate metod? » 2011-10-10 10:14:27

proto
Replies: 1

i see manyadd, manydelete and they work fine, but how update TSQLRecordMany?

#22 mORMot 1 » Bypass fields » 2011-10-06 13:49:54

proto
Replies: 1

i load data to sqlite database from csv, procedure work fine:


class procedure TSQLPopulation.CreatePopulation(const ADatabase: TSQLRest);
var
  i, j: integer;
  population: TSQLPopulation;
  sl, slES: TStringlist;
begin
  sl := TStringList.Create;
  sl.LoadFromFile('Population.csv');
  slES := TStringList.Create;

  for i := 0 to sl.Count - 1 do begin
    slES.Clear;
    ExtractStrings([';'], [' '], PChar(sl.Strings[i]), slES);
    population := TSQLPopulation.Create(Database, 'Region = "%"', [slES.Strings[0]]);
    try
      with population do
        if ID = 0 then begin
          fRegion  := slES.Strings[0];
          fAll2011 := StrToInt(slES.Strings[1]);
          fM2011   := StrToInt(slES.Strings[2]);
          fW2011   := StrToInt(slES.Strings[3]);
          FAll2012 := StrToInt(slES.Strings[4]);
          fM2012   := StrToInt(slES.Strings[5]);
          fW2012   := StrToInt(slES.Strings[6]);

          Database.Add(population, true);
        end
    finally
      FreeAndNil(population);
    end;
  end;

  sl.Free;
  slES.Free;
end;

but i want to automate the bypass fields

class procedure TSQLPopulation.CreatePopulation(const ADatabase: TSQLRest);
var
  i, j: integer;
  population: TSQLPopulation;
  sl, slES: TStringlist;
  v: Variant;
begin
  sl := TStringList.Create;
  sl.LoadFromFile('Population.csv');
  slES := TStringList.Create;

  for i := 0 to sl.Count - 1 do begin
    slES.Clear;
    ExtractStrings([';'], [' '], PChar(sl.Strings[i]), slES);
    population := TSQLPopulation.Create(Database, 'Region = "%"', [slES.Strings[0]]);
    try
      with population do
        if ID = 0 then begin
          for j := 0 to slES.Count - 1 do begin
            v := slES.Strings[j];
            SetFieldVarData(j , TVarData(v));
          end;

          Database.Add(population, true);
        end
    finally
      FreeAndNil(population);
    end;
  end;

  sl.Free;
  slES.Free;
end;

and this code not work(((

#23 Re: mORMot 1 » how to properly link the tables one to many? » 2011-09-29 05:19:02

thanks for quick reply i used old documentation

#24 mORMot 1 » how to properly link the tables one to many? » 2011-09-28 09:51:58

proto
Replies: 2

in sample synopse-sqlite-demo only many to many tables link.
i try create one to many but error: stack overflow(
i not found in documentation information.


need link tables

need link on address to many users

#25 Re: mORMot 1 » Synopse mORMot framework 1.15 » 2011-09-26 13:20:53

may be any write new sample advanced using drawgrid with new features framework?

#26 Re: mORMot 1 » Sample i18n » 2011-09-21 10:52:34

issue if i add in uses section SQLite3UI (SQLite3i18n include in SQLite3UI)
my standart system LCID 1049 - ru
but if i only add in uses section SQLite3i18n all my setting get english format.

SetCurrentLanguage(LCIDToLanguage(SysLocale.DefaultLCID));

in my pc this function set always lngEnglish, but get russian local parameters SysLocale.DefaultLCID = 1049

  if CurrentLanguage.Index=aLanguage then
    exit;

{$ifdef USEFORMCREATEHOOK}
  if CurrentLanguage.Index<>LANGUAGE_NONE then
    raise Exception.Create('lang unit: language must be set only once');
{$endif USEFORMCREATEHOOK}

  // 2. file must exists if not English
  if aLanguage<>lngEnglish then
    if not FileExists(TLanguageFile.FileName(aLanguage)) then
      if CurrentLanguage.Index=lngEnglish then
        exit else
        aLanguage := lngEnglish; // if .msg not available -> force english  <<<<<<< always english, but why not default system language? <<<<<<<

#27 Re: mORMot 1 » how search uft8 string in grid? » 2011-09-21 05:31:28

i try use UnicodeComparison, but search dont work.
0 result if i search russian or english letter (((

i solve problem create 2 search:

Rec := TSQLDataRecord.Create(Database, 'Field like "%' + edtSearch.Text + '%"'); //first i search Field
r := Table.SearchValue(IntToStr(Rec.ID), 1, 0, nil); //second i search id in table
if r <> 0  then dgDataRecord.Row := r;
ab wrote:

Don't forget to use StringToUTF8(edtSearch.Text) to provide an UTF-8 encoded text.

i use Delphi 2010 - all strings in unicode

#28 mORMot 1 » how search uft8 string in grid? » 2011-09-20 12:31:08

proto
Replies: 5

then i write

procedure TfrmMain.btnSearchClick(Sender: TObject);
var
  r: integer;
begin
  r := Table.SearchValue(edtSearch.Text, 1, btnSearch.Tag, dgDataRecord);
  if r <> 0  then dgDataRecord.Row := r;
end;

if i search english letter or number it works fine, but russian letter not found
if source code i see const aUpperValue: RawUTF8;, but Search: PAnsiChar; why not utf8 search?

#29 mORMot 1 » Sample i18n » 2011-09-13 06:32:00

proto
Replies: 10

thanks for buatiful framework!
may be any write simple sample for using SQLite3i18n language file?

Board footer

Powered by FluxBB