function AESEncrypt(const AContent, APass: RawByteString): RawByteString;
begin
Result := TAESOFB.SimpleEncrypt(AContent, APass, True, True);
Result := BinToBase64(Result);
end;
function AESDecrypt(const AContent, APass: RawByteString): RawByteString;
begin
Result := TAESOFB.SimpleEncrypt(Base64ToBin(AContent), APass, False, True);
end;
BTW you're using mORMot1 version which is in maintenance mode, there's also v2 which is actively in development.
]]>Fossil is perfect for an internal/private project, which is hosted on your side.
It is like a GitLab or Gitea but even more efficient.
See https://fossil-scm.org/home/doc/trunk/w … v-git.wiki
According the 248 max value, I just analyzed the situation from an algorithmic point of view in the scope of the function, but if this is a known limitation documented as such, that's fine.
]]>The backward compatibility is a double-edge sword - and I would hope that the code could be cleaned up of $ifdef and force some to rethink/refactor their code in general - the reason I did the issue was because our code broke with a mORMot commit in January - and now I want to move forward
Not using aliases, was partly a political and a build environment decision - and it is actually quite helpful and nice to have the full "namespace" provided - and the compile does not need to resolve them (probably only measurable in gigantic projects)
I will look into what mORMot2 brings - the EKON slides looked very promising - more clean and readable code. And I love the new naming - TSQLxxx has always put me off.
Thanks Anoud, for taking the time to respond.
]]>BTW: this is not the correct thread for such questions.
You should have posted this in https://synopse.info/forum/viewforum.php?id=2
Best regards.
]]>Anyway thanks for the code, the linked https://synopse.info/fossil/info/d3f5197f3c shows that it's a "limitation" of the design pattern as I supposed.
]]>After playing around a bit, now the difference becomes more clear to me... Sorry for the trouble!
...ThirdPartyDemos\Migajek\synopse-sqlite-demo...
procedure TForm1.LoadTasksForCustomer(const ACustomer: TSQLCustomer; const AList: TStrings);
var
tasks: TSQLTasks;
MsgUTF8: RawUTF8;
Msg: string;
task: TSQLTask;
fIds: TIDDynArray;
begin
// Can be created directly
tasks := TSQLTasks.Create;
try
// How to get Dest IDs
// tasks.DestGet(globalClient, fIds); // Does not work
tasks.DestGet(globalClient, ACustomer.ID, fIds); // Works
// ACustomer.Tasks.DestGet(globalClient, ACustomer.ID, fIds); // Original
task:= TSQLTask.CreateAndFillPrepare(globalClient, TInt64DynArray(fIds));
AList.BeginUpdate();
AList.Clear();
try
while task.FillOne do
AList.AddObject(Format('%s', [UTF8ToString(task.Text)]), Pointer(task.id));
finally
AList.EndUpdate();
FreeAndNil(task);
end;
// How to get Pivot instances, and Dest instances later
tasks.FillMany(globalClient, ACustomer.ID);
while tasks.FillOne do begin
// MsgUTF8 := tasks.Dest.Text;
task := TSQLTask.Create(globalClient, tasks.Dest.ID);
try
MsgUTF8 := task.Text;
Msg := UTF8ToString(MsgUTF8);
Msg := 'Get Dest through Pivot: ' + UTF8ToString(MsgUTF8);
OutputDebugString(PChar(Msg));
finally
task.Free;
end;
end;
// How to get Dest instances directly
task := tasks.DestGetJoined(globalClient, '', ACustomer.ID) as TSQLTask;
try
while task.FillOne do begin
MsgUTF8 := task.Text;
Msg := 'Directly get Dest: ' + UTF8ToString(MsgUTF8);
OutputDebugString(PChar(Msg));
end;
finally
task.Free;
end;
finally
tasks.Free;
end;
end;
procedure TForm1.lbTasksClick(Sender: TObject);
var
tasks: TSQLTasks;
task: TSQLTask;
cust: TSQLCustomer;
clientsIds: TIDDynArray;
i, j: integer;
MsgUTF8: RawUTF8;
Msg: string;
begin
gbEditTask.Visible:= lbTasks.ItemIndex <> -1;
if not gbEditTask.Visible then
exit;
gbEditTask.Visible:= lbTasks.Items.Objects[lbTasks.ItemIndex] <> nil;
if not gbEditTask.Visible then
exit;
task:= LoadTask(integer(lbTasks.Items.Objects[lbTasks.ItemIndex]));
cbTaskPriority.ItemIndex:= Ord(task.Priority);
cbTaskPriority.Tag:= task.ID;
FillCustomersList(CheckListBox1.Items, true);
CheckListBox1.Tag:= task.ID;
// load list of customers assigned to the given task
cust:= TSQLCustomer.Create();
try
cust.Tasks.SourceGet(globalClient, task.ID, clientsIds);
for i:= low(clientsIds) to high(clientsIds) do
begin
// find the client on the list (by ID)
for j:= 0 to CheckListBox1.Count -1 do
if Integer(CheckListBox1.Items.Objects[j]) = clientsIds[i] then
CheckListBox1.Checked[j]:= true;
end;
finally
cust.Free();
FreeAndNil(task);
end;
// Learn about FillManyFromDest
tasks := TSQLTasks.Create;
try
tasks.FillManyFromDest(globalClient, integer(lbTasks.Items.Objects[lbTasks.ItemIndex]));
while tasks.FillOne do begin
cust := TSQLCustomer.Create(globalClient, tasks.Source.ID);
try
MsgUTF8 := cust.FirstName;
Msg := UTF8ToString(MsgUTF8);
Msg := 'Get Source through Pivot: ' + UTF8ToString(MsgUTF8);
OutputDebugString(PChar(Msg));
finally
cust.Free;
end;
end;
finally
tasks.Free;
end;
end;