You are not logged in.
Pages: 1
Hi
Is this the correct method to delete the object/objects?
for AObj in AList.Objects(LCompareStr) do
AList.Remove(AObj.AsVariant);
I want to do something like below. I did what I wanted manually with the loop. Thanks.
IDocList.Objects('name LIKE test%')
or
IDocList.Objects('name', '%test%', coLike)
or
IDocList.Objects('name', 'test', coInclude)
or
IDocList.Objects('name', 'test', coStartsWith)
or
IDocList.Objects('name', 'test', coEndsWith)
I started using "IDocList/IDocObject". How can I do custom filtering using TVariantCompare? Are there any examples? I need to make a comparison like "startsWith/endsWith" or "%like%".
I need to parse the following encoded form values. I use the "UrlDecodeNextNameValue" function for this. However, the result is as follows;
//original decoded value
name "time >=" value "1715497685"
//encoded form value
time%20%3C%3D=1715497685
// UrlDecodeNextNameValue(time%20%3C%3D=1715497685) result
// name "time >" value "=1715497685"
// Expected
// name "time >=" value "1715497685"
Does the UrlDecodeNextName() function return an expected value? Will the following change cause different problems?
// mormot.core.buffers
// Line 8290 has been changed
...
#0:
exit;
'=':
begin
result := U + 1;
break;
end;
'%':
if HexToCharValid(pointer(U + 1) {$ifndef CPUX86NOTPIC}, tab{$endif}) then
inc(U, 3)
else
inc(U);
...
I did initialization and everything is fine
LObj.Init;
Interestingly, even though I haven't made any changes in the code, sometimes I get the "Range check error" error and sometimes the "Add: Unexpected [id] object property in an array" error.
Compiler/IDE: Delphi 12.
Hi
I'm getting an error when working with TDocVariantData.
// This code works
procedure TForm1.Button3Click(Sender: TObject);
var
LObj:TDocVariantData;
LKey, LValue:Utf8String;
begin
LKey:='id';
LValue:='1001-test;@6f2dcdcc4303a085a18d98419e1fb374';
LObj.AddValue(LKey, LValue);
LKey:='id2';
LValue:='50';
LObj.AddValue(LKey, LValue);
memo1.Lines.Add(LObj.ToJson);
end;
// This code is not working
procedure TForm1.Button2Click(Sender: TObject);
var
LObj:TDocVariantData;
begin
FillParams(PUtf8Char(FParamStr), LObj);
memo1.Lines.Add(LObj.ToJson);
end;
procedure FillParams(AParams:PUtf8Char; var AObj:TDocVariantData);
var
LKey, LValue:Utf8String;
begin
if (AParams = nil) then exit;
repeat
AParams := UrlDecodeNextNameValue(AParams, LKey, LValue);
// Lkey='id', LValue='1001-test;@6f2dcdcc4303a085a18d98419e1fb374'
AObj.AddValue(LKey, LValue); <--- Range check error
if AParams = nil then break;
until AParams^ = #0;
end;
Why am I getting this error? Am I missing something?
Hi
I want to save the log file to be archived as a zip. But it keeps saving as "synlz".
with TSynLog.Family do
begin
//AutoFlushTimeOut:=10;
RotateFileCount:=100;
RotateFileSizeKB:=20; //test size
Level := LOG_VERBOSE;
PerThreadLog := ptIdentifiedInOnFile;
EchoToConsole := LOG_VERBOSE;
FileExistsAction:=acAppend;
CustomFileName:='project_test';
OnArchive:=mormot.core.zip.EventArchiveZip;
end;
// mormot.core.zip
function EventArchiveZip(const aOldLogFileName, aDestinationPath: TFileName): boolean;
var
n: integer;
begin
result := false;
if aOldLogFileName = '' then <<< This function fired but, "aOldLogFileName" is empty string.
FreeAndNilSafe(EventArchiveZipWrite)
else
begin
if not FileExists(aOldLogFileName) then
exit;
if EventArchiveZipWrite = nil then
EventArchiveZipWrite := TZipWrite.CreateFrom(
copy(aDestinationPath, 1, length(aDestinationPath) - 1) + '.zip');
n := EventArchiveZipWrite.Count;
EventArchiveZipWrite.AddDeflated(aOldLogFileName, {removepath=}true);
if (EventArchiveZipWrite.Count = n + 1) and
DeleteFile(aOldLogFileName) then
result := true;
end;
end;
First of all, you did a great job. Thanks again.
Like you, I think some structures should be simplified. For those new to mORMot, the learning curve should be rapid. After learning mORMot, I would like to contribute.
//I think these types of regulations you are talking about are;
FHttpServer:TContainerHttpServer; // or TAppHttpServer
FRestApp:TRestHttpApplication; // or TRestHttpService
FRawApp:TRawHttpAppication; // or TRawHttpService
FMvcApp:TMvcHttpApplication; // or TMvcHttpService
FHttpServer.Create('0.0.0.0:80', [FRestApp, FRawApp]);
FRestApp.Root:='/api';
FRestApp.Storage:=TOrmModel;
//FRestApp.Storage:=TMemoryModel;
FRawApp.Root:='/';
FRawApp.StaticsPath:='/statics'
I had already realized that I needed to use TRestServerFullMemory after your message. Thanks
Thanks ab :$
I want to get rid of SQL, so I'll use ORM
Hello
I wanted to do a simple test without using any ORM instance, but I'm getting an "Access Violation" error. What am I missing?
mormot.rest.core.pas
procedure TRest.OnBeginCurrentThread(Sender: TThread);
begin
fOrmInstance.BeginCurrentThread(Sender); <<< fOrmInstance has not been created; Access Violation
end;
...
type
TSampleServer = class(TRestServer)
published
procedure test(Ctxt: TRestServerUriContext);
end;
...
FApiServer:TSampleServer;
FHttpServer:TRestHttpServer;
...
procedure TForm1.FormCreate(Sender: TObject);
begin
FApiServer:=TSampleServer.Create('api');
FHttpServer := TRestHttpServer.Create('80', [FApiServer], '+', HTTP_DEFAULT_MODE, 4);
FHttpServer.AccessControlAllowOrigin := '*';
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FHttpServer.Free;
FApiServer.Free;
end;
procedure TSampleServer.test(Ctxt: TRestServerUriContext);
begin
Ctxt.Returns('{"result":null}');
end;
But when I started using Lazarus more deeply this changed.
Some links that may be of interest to you
I have been developing Linux Daemons with lazarus since 2013. I know all the information you have specified.
I did not know about LazDebuggerFp. I will try.
Thanks.
I tested Linux applications compiled in Delphi on CentOS7 and CentOS8. I did not have any problems. I have not had experience with different Linux distributions.
For a long time, I have been developing small services that run on Linux. I use FPC and Lazarus IDE to develop these services. The only IDE to be used with FPC is Lazarus. However, I think Delphi IDE is more comfortable than Lazarus at a few points.
I hope you add Delphi Linux support to your roadmap.
I'm new to mORMot. Framework looks great! Congratulations on your work. Do you have a plan for Delphi Linux64 support?
Pages: 1