Jump to content

Dmitry Arefiev

Members
  • Content Count

    161
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Dmitry Arefiev


  1. 1) DB admin features - PostgreSQL

    2) DB developer features - PostgreSQL / FireBird

    3) Encryption, and ... speed - InterBase. On many tests IB outperforms FB, at least.

    4) Mobile platforms - InterBase

    5) Change Views is unique InterBase feature

     

    If to put SQLite into this list, then if you does not need multi-user access, scalability, DB is relatively small, then SQLite is the right way. If something from this list is not true, or may become false in future, then not SQLite.

     

    Quote

    Windows desktop project?  Don't need outrageous speed, or size, just a dependable data store.  One nice feature is to be easy to backup/restore as needed

    In order of descending preferences - SQLite, IbToGo / Firebird embedded, PostgreSQL

    • Like 2
    • Thanks 1

  2. This may be coded in a more short form using 10.3.2. First case:

    var
      JsonValue: TJSONValue;
      Branch: string;
    begin
      JsonValue := TJSONObject.ParseJSONValue(st, False, True);
      try
        Branch := JsonValue.GetValue<string>('data.conditions[0].temp');
        memo1.Lines.add('Parsed temperature '+branch);
    
        Branch := JsonValue.GetValue<string>('data.conditions[2].bar_sea_level');
        memo1.Lines.add('Parsed barometer '+branch);
      finally
        JsonValue.Free;
      end;
    end;

    Second case:

    var
      JsonValue: TJSONValue;
      Branch: string;
    begin
      JsonValue := TJSONObject.ParseJSONValue(st, False, True);
      try
        Branch := JsonValue.GetValue<string>('iWN5p2qfRFeGKXn1m3iGnDW0Vkl2.PROFILE.BIRTHDAY');
        memo1.Lines.Add('Parsed BIRTHDAY ' + Branch);
    
        Branch := JsonValue.GetValue<string>('iWN5p2qfRFeGKXn1m3iGnDW0Vkl2.PROFILE.FULL NAME');
        memo1.Lines.Add('Parsed FULL NAME ' + Branch);
      finally
        JsonValue.Free;
      end;
    end;

    This is most simple code. Although not fastest, but may be enough fast. Depending on the requirements it may be optimized.

    • Like 1
    • Thanks 1

  3. There are two options:

    1) Modify your code. In EventAlert use:

      TThread.Queue(nil,
        procedure
        begin
          Caption := AEventName + ' ' + DateTimeToStr(Now);
        end);

    And in FormCreate set:

      FEvents.Options.Synchronize := False;

    2) Modify FireDAC sources. For that in FireDAC.Phys.pas change method:

    function TFDPhysEventMessage.Perform(AThread: TFDThread): Boolean;
    begin
      FMsgThread := AThread as TFDPhysEventThread;
      if FMsgThread.Active then begin
        if FMsgThread.FAlerter.GetOptions.Synchronize then
          TFDThread.Queue(nil, BasePerform)
        else
          BasePerform;
      end;
      Result := True;
    end;

     


  4. We have two problems:

    1) REST, DBX, System.JSON duplicating JSON serialization classes.

    2) Non complete docu for (1) classes.

     

    We want to keep only System.JSON with options for backward compatibility with REST, DBX. And only to develop System.JSON. When this will happen, then all demos, tests (internal), docu, must be updated to reflect the current RTL state. Now it is not the time for docu work ...

    • Confused 1

  5. function JsonEncodeString(const AStr: string): string;
    var
      LStr: TJSONString;
    begin
      LStr := TJSONString.Create(AStr);
      try
        Result := LStr.ToJSON;
        Result := Result.Substring(1, Result.Length - 2);
      finally
        LStr.Free;
      end;
    end;
    

    It expects AStr without double quotes, and returns text without double quotes. You can adjust it to your own needs.

    Quote

    2. No, there is no such function

    There are several options, eg with/without double quotes, encode non-ASCII chars/do not encode, etc. Probably more simple to implement the above according your needs.

    • Like 1

  6. May be a bit unexpected approach. And sorry not C but JS, but they are close here.

    uses
      System.JSON;
    
    function StripJSSlashes(const AStr: string): string;
    var
      LVal: TJSONValue;
    begin
      LVal := TJSONObject.ParseJSONValue('"' + AStr + '"', False, True);
      try
        Result := TJSONString(LVal).Value;
      finally
        LVal.Free;
      end;
    end;

     

×