#51 mORMot 2 » DynArray IndexOf - D7 vs D12.1 - Different Results » 2024-09-16 08:32:23

tfopc
Replies: 3

I have detected an unexpected behavior on old Delphi compiler vs. newer one.

var s:string;
    dynArr:TRawUtf8DynArray;
begin
  s := 'test1';
  setLength(dynArr,1);
  dynArr[0]='test1';
  Result := DynArray(TypeInfo(TRawUtf8DynArray),dynArr).IndexOf(s,true);
end;

-> Delphi7: Result=0, found
-> Delphi12: Result=-1, not found

If i cast the string to RawUtf8 or use RawUtf8 directly it is working.

var u:RawUtf8;
    dynArr:TRawUtf8DynArray;
begin
  u := 'test1';
  setLength(dynArr,1);
  dynArr[0]='test1';
  Result := DynArray(TypeInfo(TRawUtf8DynArray),dynArr).IndexOf(u,true);
end;

-> Delphi7: Result=0, found
-> Delphi12: Result=0, found

#52 Re: mORMot 2 » TExecutableCommandLine with own command line » 2024-09-16 08:10:17

I have done it now via an regex found on StackOverflow:

Regex: /[\/-]?((\w+)(?:[=:]("[^"]+"|[^\s"]+))?)(?:\s+|$)/g

With this regex i was able to build the RawUtf8DynArray and assign it on my own ExecutableCommandLine.RawParams before ExecutableCommandLine.Parse(CRLF,'/','-')

#53 mORMot 2 » TExecutableCommandLine with own command line » 2024-09-13 15:02:19

tfopc
Replies: 1

Hi,
is there any function to produce a valid array that can be assigned to cmdline.RawParams to support a CMD-Line like:
prog.exe /switch1 /param="param with spaces" /switch2
My try with:
CsvToRawUtf8DynArray(ownCmdLine,dynArray,' ');
procduces a invalid array because of the spaces in the doublequoted param.

Thanks.

#54 mORMot 2 » Problem with mormot.app.agl (process params with URI) » 2024-09-09 12:38:42

tfopc
Replies: 0

Hi Arnaud,

today i tried agl.exe / mormot.app.agl.pas. It works perfectly for my use case. But i have a problem with a process that has a URI in the params.

For example "powershell" -command "$l = New-Object System.Net.HttpListener ; $l.Prefixes.Add('http://127.0.0.1:8080/'); $l.Start(); ..."

Problem detected in mormot.app.agl.Exec. "NormalizeFileName" is also done on the params. So "http://127.0.0.1:8080/" under Windows becomes "http:\\127.0.0.1:8080\". Under Unix, the same probably happens with backslashes in the parameters.

Thanks ab, for this great framwork!

Kind regards,
Tobias

#55 mORMot 2 » Record serialization of static arrays (Delphi7, no rtti-infos) » 2024-03-07 08:17:02

tfopc
Replies: 1

Hi,
is it possible to serialize a record like this with definition RegisterFromText and without changing the record type (TTest) definition?

type TEnum = (eTagUnknown,eTagOne,eTagTwo)

     TTest = record
              id: cardinal;
              test: string;
              prices: array[1..3] of double;
              tags[eTagOne..eTagTwo] of integer;
             end;
const __TTest = 'id:cardinal;test:string;prices: array of double;tags: array of integer';

I have tried registriation with:

Rtti.RegisterTypes([TypeInfo(TEnum)]);
Rtti.RegisterFromText(TypeInfo(TTestRecord),__TTest);

but i get the error/exception on RegisterFromText:

Rtti.RegisterFromText(TTestRecord): text definition  covers 16 bytes, but RTTI defined 40

#56 mORMot 2 » TOrmMany/TSQLMany - ManyAdd result » 2024-01-21 13:16:13

tfopc
Replies: 0

Hi,

if i want to update the pivot-table with new entries i call "PivotTable.ManyAdd" with NoDuplicates=true. But the result is false if the record allready exists.

So the is no difference between ignore insert and a false result because of the false result from Client.Add or UseBatch.Add.

Maybe set the result to true if InternalIDFromSourceDest<>0 is better?

  if NoDuplicates and
     (InternalIDFromSourceDest(aClient, aSourceID, aDestID) <> 0) then
    begin
    result := true;
    exit; // this TRecordReference pair already exists
    end;

best regards,
Tobias

#57 mORMot 2 » Authentication in WinHTTP / WinHttpSetCredentials » 2024-01-08 16:24:08

tfopc
Replies: 1

Hi,

are there any plans to support authentification for reqests and proxy-authentication via WinHttpSetCredentials like descriped at:

https://learn.microsoft.com/en-us/windo … in-winhttp

Best regards
Tobias

Board footer

Powered by FluxBB