You are not logged in.
That is excellent, it can help mormot2 to gain more appearance and users
type
Tmyorm=class(Torm)
private
Fwasadded: boolean;
published
property wasadded:boolean read Fwasadded write Fwasadded;
end;
function CompareMyOrmID(const A, B): integer;
begin
result := ord(Tmyorm(A).IDValue > Tmyorm(B).IDValue) - ord(Tmyorm(A).IDValue < Tmyorm(B).IDValue);
end;
procedure TForm3.Button1Click(Sender: TObject);
var lista:ilist<Tmyorm>; o:tmyorm; fin:tarray<tmyorm>; n:integer; b:boolean;
begin
lista:=collections.Newplainlist<Tmyorm>;
lista.Comparer := CompareMyOrmID;
for n:=0 to 4 do
begin
o:=tmyorm.Create;
o.IDValue:=1;
lista.AddSorted(o,@b);
o.wasadded:=b;
if not b then o.free;
end;
fin:=lista.AsArray;
memo1.lines.add(dynarraysavejson(fin,typeinfo(tarray<tmyorm>)));
end;The following works as I can see. So, my problem is fixed.
Should I check before adding? if so, what does the second parameter in ilist<>.add?
Since I created the list with loCreateUniqueIndex and ptOrm, why Torm objects are added with the same IDvalue?
In the following code:
type
Tmyorm=class(Torm)
private
Fwasadded: boolean;
published
property wasadded:boolean read Fwasadded write Fwasadded;
end;
procedure TForm3.Button1Click(Sender: TObject);
var lista:ilist<Tmyorm>; o:tmyorm; fin:tarray<tmyorm>; n:integer; b:boolean;
begin
lista:=collections.Newplainlist<Tmyorm>([loCreateUniqueIndex],nil,ptOrm);
for n:=0 to 4 do
begin
o:=tmyorm.Create;
o.IDValue:=1;
lista.add(o,@b);
o.wasadded:=b;
if not b then o.free;
end;
fin:=lista.AsArray;
memo1.lines.add(dynarraysavejson(fin,typeinfo(tarray<tmyorm>)));
end;I am getting:
[{"RowID":1,"wasadded":true},{"RowID":1,"wasadded":true},{"RowID":1,"wasadded":true},{"RowID":1,"wasadded":true},{"RowID":1,"wasadded":true}]What am I doing wrong?
To be honest, not all the record definitions involved in the part of the code that produced the error where declared with TRttiJson.RegisterFromText
I have changed it after this error.
I will test the commit
Thank you ab
Is array of Integer different to Tarray<Integer> ? In delphi there are differences
Is there a way to get more debug, like in which record type (that has the integer array) it happed?
The last month I am getting the following in unpredicted times:
20260129 09242262 ! EXC ERttiException {Message:"TRttiJson.ArrayFinalize: Integer has refcnt=2"} [Main] at 9af2db mormot.core.rtti.pas TRttiCustom.NoRttiArrayFinalize (9342) {6 2.43 2.62 4.6GB/7.7GB 66581b01}
windows Delphi 12.3 & 13.0
Where should I check for that?
I tried to asked gemini what it thinks about my solution. And I got that the above change is not safe plus the following:
The Root Cause: Batch DML Synchronization
The issue stems from a "state mismatch" between the mORMot 2 batching logic and the Zeos internal buffer allocation.
Zeos Side: In ZDbcMySqlStatement.pas, the indicators array (used for NULL values) is only allocated when the driver is explicitly told it is performing a batch operation via AllocateBuffers.
mORMot Side: In mormot.db.sql.zeos.pas, the ExecutePrepared method detects a batch when fParamsArrayCount > 0. It then creates a TZeosArrayBinding to bind the data.
The Conflict: If mORMot reuses a statement that was previously used for a single row (common in the ORM's InternalProcess or ExecutePrepared calls), the Zeos statement object may not have re-run the allocation logic for the indicators pointer, leading to the nil access at line 3201.
The solution is to disable the cache from mormot, in connection with: usecache:=false; After that Bind^.indicators=nil error disappears when I removed the check "if Bind^.indicators<>nil"
I also noticed, that SupportsArrayBindings=false even when using a recent version of libmariadb.dll and zeos 8.0-paches trunk.
This solution is less fast as cache is not used, but at least in my senario, it is reliable.
I removed the updates from trestbatch and now it seems that everything works with updates
Now I have again a problem with Trestbatch in the same zeos file in TZAbstractMySQLPreparedStatement.GetUpdateCount: Integer; line 1314
LastUpdateCount := FPlainDriver.mysql_stmt_affected_rows(FMYSQL_STMT);
That gives Range Check Error when called from TSqlDBZeosStatement.UpdateCount
The above was fixed by adding a LastUpdateCount := Integer(FPlainDriver.mysql_stmt_affected_rows(FMYSQL_STMT)); it was my compiler running in debug mode
My initial problem was resolved by adding to check if it is null
else if Bind^.indicators <> nil then for i := 0 to BatchDMLArrayCount -1 do ....Sometimes, I feel I am the only person in earth that uses mariadb with zeos and mormot. All updates in zeos is for other bindings.....
I also found in the logs the following error that it is not connected with zeos:
20260123 10355947 5 EXC ESqlite3Exception {Message:"Error SQLITE_ERROR (1) [Step] using 3.51.2 - SQL logic error",ErrorCode:1,SQLite3ErrorCode:"secERROR"} [pool15-TepresSlave] at 01232ca2 {6 2.57 65532.92 8 5GB/7.7GB 66581b01}
20260123 10355947 5 ERROR mormot.rest.sqlite3.TRestServerDB(02187594f480) {"ESqlite3Exception(02182f9aab20)":{Message:"Error SQLITE_ERROR (1) [Step] using 3.51.2 - SQL logic error",ErrorCode:1,SQLite3ErrorCode:"secERROR"}} for update EhfyResult set exid=:(4674): where RowID in (:(112150186198810):,:(112150186198811):) // update EhfyResult set exid=? where RowID in (?,?)
20260123 10355947 5 EXC EZUnsupportedException {Message:"Unsupported operation"} [pool15-TepresSlave] at e58408 {6 2.57 65532.92 8 5GB/7.7GB 66581b01}
I removed the updates from trestbatch and now it seems that everything works with updates
Now I have again a problem with Trestbatch in the same zeos file in TZAbstractMySQLPreparedStatement.GetUpdateCount: Integer; line 1314
LastUpdateCount := FPlainDriver.mysql_stmt_affected_rows(FMYSQL_STMT);
That gives Range Check Error when called from TSqlDBZeosStatement.UpdateCount
What do you recommend to use as alternative to zeos for mariab and mormot2?
For windows and linux
ThreadId=3080
ProcessId=9
ThreadName="pool10-TepresSlave"
ExceptionMessage="Access violation at address 0000000000BC119E. Read of address 0000000000000000"
ExceptionName="EAccessViolation"
ExceptionDisplayName="$C0000005"
ExceptionAddress=00BC119E
FileName="C:\DG\zeoslib\src\dbc\ZDbcMySqlStatement.pas"
LineNumber=3201
I delete the table and left mormot to recreate it, but the same exception happened again
Entering 0 in a Tdatetime field in a Torm is allowed?
How can I debug it more?
Looking the logs probably I have find the problem:
Mormot creates a query to update a Torm where the datetime field "approved" is 0 and in the query is shown as '', producing the error:
update pinakas set vid=295,abnorm=0,monas=0,timi='6 , 13:45',sim='',parentbcode=74272047418,approved='' where ID=959894
The above query does not run in mariadb
I am having a strange error when using TrestBatch. I am getting an exception error when batch is send that happens the same way in the same part of the code and I can not find a solution:
Bind^.indicators is null and gives exception in line 3201 in ZDBcMysqlStatement:
procedure TZMariaDBBatchDMLPreparedStatement.SetNullArray(
ParameterIndex: Integer; const SQLType: TZSQLType; const Value;
const VariantType: TZVariantType);
var
Bind: PMYSQL_aligned_BIND;
aArray: PZArray;
I: Integer;
begin
inherited SetNullArray(ParameterIndex, SQLType, Value, VariantType);
{$IFNDEF GENERIC_INDEX}
ParameterIndex := ParameterIndex - 1;
{$ENDIF}
{$R-}
Bind := @FMYSQL_aligned_BINDs[ParameterIndex];
{$IFDEF RangeCheckEnabled}{$R+}{$ENDIF}
if (FMYSQL_STMT = nil) then
InternalRealPrepare;
if (FMYSQL_STMT = nil) then
raise EZSQLException.Create(SFailedtoPrepareStmt);
aArray := BindList[ParameterIndex].Value;
if Pointer(Value) = nil
then FillChar(Bind^.indicators^, BatchDMLArrayCount, Char(MySQLNullIndicatorMatrix[False, FUseDefaults]))
else for i := 0 to BatchDMLArrayCount -1 do
{$R-}
{3201 line} Bind^.indicators[I] := MySQLNullIndicatorMatrix[(Bind^.indicators[i] = Ord(STMT_INDICATOR_NULL)) or IsNullFromArray(aArray, I), FUseDefaults];
{$IFDEF RangeCheckEnabled}{$R+}{$ENDIF}
end;ParameterIndex is 0 as it is called from TZeosArrayBinding.Create line 1091 of mormot.db.sql.zeos where fStatement does not seem to have something unsual.
I am using Delphi 12.3 64bit, with mariadb 10.6.7 and 10.6.24 dll
This problem does not happen in 32bit with mariadb 3.1.24 dll but it gives an error in function TZAbstractMySQLPreparedStatement.GetUpdateCount in line 1314 (LastUpdateCount := FPlainDriver.mysql_stmt_affected_rows(FMYSQL_STMT);)
Also this happens with only 3 Torms that they do not have something special. And all this happens exactly the same in any case for these torms
One of the them is:
TormEhfymdIcd=class(Torm)
private
Fdescr, Fcod: rawutf8; Fsdat, Fedat: tdatetime;
public
class procedure InitializeTable(const Server: IRestOrmServer; const FieldName: RawUtf8; Options: TOrmInitializeTableOptions); override;
published
property cod: rawutf8 index 25 read Fcod write Fcod;
property descr: rawutf8 index 1500 read Fdescr write Fdescr;
property sdat: tdatetime read Fsdat write Fsdat;
property edat: tdatetime read Fedat write Fedat;
end;
Any help? I really can not understand what happens. Thank you in advance
it is really stupid of me....... Thanks ab
Download associated mORMot 2.4.stable static binaries .7z and extract it into the static sub-folder of local source (e.g. d:\dev\mormot2\static). On POSIX, consider the static binaries .tgz.
I really did not understand.
But I am a bit puzzled about the static files: When should we use the static.7z for POSIX systems?
Thank you for the new Mormot 2.4 version
But I am a bit puzzled about the static files: When should we use the static.7z for POSIX systems?
Excellent work!!!
May I ask a couple of questions that have to do with my work?
Is Bookworm supported for raspberry Pi and mormot2?
Also, Mac ventura is quite old nowadays. Can I use FPC 3.2.3 to compile mormot2 for Sequoia or Tahoe?
Thank you in advance
You could also use user-based systemd, then you don't need to start the mORMot program as root. In this setup, your systemd files are in $HOME/.config/systemd/user, and you'd start/stop the service as follows, as your own UID:
% systemctl --user start yourmormotservice % systemctl --user stop yourmormotserviceAlso, why run agl under systemd at all, since systemd has agl's functionality?
You have right and thank you, I did not notice the --user option, that make thinks less complicate, I will test it.
I have an "agl" as a derived class from TSynAngelize to do more functions I need. For sure, I can have the same results with scripts and systemd but I want to have as more unified as possible code for both linux and windows
Trying to run an agl derived app and two mormot2 services in linux I come to solutions that work in simple way. I leave it here for comments and as it could useful for someone else.
I found that using systemd is an easy way to keep running mormot services and agl.
A working /etc/systemd/system/yoursystemdservice.service without troubles and special care example of systemd is and can be used for agl and mormot services:
[Unit]
Description=Your mormot service
After=network.target yourdb.service
Wants=network-online.target
[Service]
Type=simple
User=youruser
Group=yourgroup
UMask=0007
WorkingDirectory=/usr/local/bin/yourdir
ExecStart=/usr/local/bin/yourdir/yourserviceexecutable -c
TimeoutSec=40
Restart=on-failure
RestartSec=10s
TimeoutStopSec=20
KillMode=mixed
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
enable with systemctl enable yoursystemdservice
if agl does not run as root (the proposed way for security reasons), the start/stop operations to other services is not allowed
A solution to that is to define which commands to use in sudo with: visudo -f /etc/sudoers.d/yourappname and enter
# Allow youruser to manage agl service
youruser ALL=(ALL) NOPASSWD: /bin/systemctl start yoursystemdservice
youruser ALL=(ALL) NOPASSWD: /bin/systemctl stop yoursystemdservice
youruser ALL=(ALL) NOPASSWD: /bin/systemctl restart yoursystemdservice
youruser ALL=(ALL) NOPASSWD: /bin/systemctl status yoursystemdservice
youruser ALL=(ALL) NOPASSWD: /bin/systemctl is-active yoursystemdservice
youruser ALL=(ALL) NOPASSWD: /usr/bin/journalctl -u yoursystemdservice*
now in agl's start/stop operations you should use:
exec:/bin/sudo /bin/systemctl start yoursystemdservice
exec:/bin/sudo /bin/systemctl stop yoursystemdservice
Thanks again to ab and all for this excellent framework
I finally arrived to giveup with fork way of running my derived version of agl and use systemd to run it as console app.
In such a way it works ok.
I have a derived class from TSynAngelize
I use Tsynlog as argument in the inherited create function
I set Nofile=false, AutoFlushTimeOut=1, Level=[...], PerThreadLog=ptIdentifiedInOneFile after inherited create function.
I use Tsynlog.dolog(...... to write to the log after that.
The logs are shown in the file but everything is not shown in the log after the process forks, except if an exception happens.
During forking, file handlers are lost. So, if logging have been started with aftercreate, any logging will not be saved.
how can we recreate the file handlers for logging during start procedure and forking?
I have the same problem with mariadb as external database and 2-3 table with 2-7 fields, where one is just big.
Something I can not understand happens after the above changes.
all logs after Starting procedure are not shown when fork is used in linux. But it works ok with -c switch.
Also, if an exception happens, everything is ok and logs are shown in the file.
Also the service takes the timeout to stop.
I did not understand. Perhaps I did not explain it well. It is the following (that gives exception in recordsavejson), I am trying to avoid:
type
Dtest=packed record
id:integer;
lab:rawutf8;
i64:int64;
op:double;
chk:boolean;
b:byte;
f:tdatetime;
ed:integer;
end;
procedure TForm3.Button1Click(Sender: TObject);
var a:dtest; s:rawutf8;
begin a.id:=1111111; a.lab:='a testing'; a.i64:=13234 shl 23; a.op:=pi;
a.chk:=true; a.b:=136; a.f:=now; a.ed:=222222;
s:=RecordSaveJson(a,typeinfo(dtest));
showmessage(utf8tostring(s));
end;
initialization
TRttiJson.RegisterFromText(TypeInfo(Dtest),'f:tdatetime id:integer b:byte lab:rawutf8 chk:boolean ed:integer i64:int64 op:double',[jpoIgnoreUnknownProperty, jpoIgnoreUnknownEnum],[woDontStoreDefault]);
thank @ab, I will test it
Thank you a lot @ab. I usually use the Delphi IDE to write code and to test as I am more familiar and with cntools it is really very productive. With Claude, I do minimal things for the moment
I compile to both Delphi and FPC and with Delphi I can check if everything is OK with these definitions.
AutoValidateRecordOffsets checks if the order of the fields are the same in the record definition and in the text definition in TRttiJson.RegisterFromText
If I understand well, the order is crucial for field mapping, or not?
Also the following code from Claude check if you change the field order in the definition of the record comparing with the definition from TRttiJson.RegisterFromText(
https://gist.github.com/dkounal/2d64c97 … 853cd30388
It runs in delphi to check if you are going to use it with fpc 3.2.x that does not have rtti for records
After each TRttiJson.RegisterFromText I have something like the following.
{$ifndef fpc}{$ifdef DEBUG} s:=AutoCheckRecordRegistration(TypeInfo(Dvname)); Assert(s='',utf8tostring(s)); {$endif}{$endif}
I see it as a kind of test that runs to find mismatches.
I believe it will be helpful to be added to the TRttiJson.RegisterFromText as additional argument or option.
Thank you in advance
I notice that with http watches, the service restarts. I am not sure if this is a bug or feature.
Is it possible for the "notify" to call a procedure of angel object with an rawutf8 argument defined in notify?
I have the angel app and a windows service it should monitor (I kept only needed from its config):
{
"Start":
[
"service:pchrd",
"sleep:3000"
],
"Stop":
[
"service:pchrd"
],
"Watch":
[
"service:pchrd"
],
"WatchDelaySec": 60,
"WatchCountRestart": 3,
}
I am getting in the log:
20260103 21315748 $ trace mormot.core.os.TServiceController(026b64e52640) GetState(pchrd)=Stopped
20260103 21315748 $ trace angel.pchr.tmyAngelconfig(026b652d8fc0) SetState(Stopped) [As Windows Service "pchrd"]
20260103 21325722 $ trace mormot.core.os.TServiceController(026b64e52640) GetState(pchrd)=Stopped
20260103 21325722 $ trace angel.pchr.tmyAngelconfig(026b652d8fc0) SetState(Stopped) [As Windows Service "pchrd"]
20260103 21335748 $ trace mormot.core.os.TServiceController(026b64e52640) GetState(pchrd)=Stopped
20260103 21335748 $ trace angel.pchr.tmyAngelconfig(026b652d8fc0) SetState(Stopped) [As Windows Service "pchrd"]
20260103 21345819 $ trace mormot.core.os.TServiceController(026b64e52640) GetState(pchrd)=Stopped
20260103 21345819 $ trace angel.pchr.tmyAngelconfig(026b652d8fc0) SetState(Stopped) [As Windows Service "pchrd"]
20260103 21355755 $ trace mormot.core.os.TServiceController(026b64e52640) GetState(pchrd)=Stopped
20260103 21355755 $ trace angel.pchr.tmyAngelconfig(026b652d8fc0) SetState(Stopped) [As Windows Service "pchrd"]
and if I understand well in the source mormot.app.agl lines: 1613-6128 it never calls the StatusFailed to restart the service
Is there something I do wrong?
Thank you in advance
Is it possible to have a function in mormot.core.base to use in assertions for checking if a record type is registered in rtti?
Perhaps something like the following:
function IsRecordProperlyRegistered(TypeInfo: PRttiInfo): Boolean;
var RttiCustom: TRttiCustom;
begin
Result := False;
if TypeInfo = nil then Exit;
RttiCustom := Rtti.FindType(TypeInfo);
Result := (RttiCustom <> nil) and (rcfHasNestedProperties in RttiCustom.Flags);
end;
Thank you in advance
hi,
in mormot.app.agl in constructor TSynAngelize.Create the aLog parameter is not used somewhere. Or I miss something?
Thank you a lot ab
Is it possible to stop logging this exception?
correct
I have the last update from github before 2 hours and I just had:
Exception: 20251125 14551607 - EXC ENetSock {LastError:"nrClosed",Message:"THttpClientSocket.SockInReadLn [#5 Closed]"} [pool8-TepresSlave] at 9485d5 mormot.net.sock.pas TCrtSocket.DoRaise (5765) mormot.net.client.pas THttpClientSocket.RequestInternal (3352) mormot.core.base.pas FastSetString (5160) mormot.net.client.pas THttpClientSocket.Request (3470) ephttp.pas Tephttp.httpGet (547) System.pas @ReallocMem (5093) ephttp.pas Tephttp.dohttp (669) ephttp.pas Tephttp.dohttp (689) slave.terminology.pas TTerminologySlave.GetTermCodesysEntities (169) slave.terminology.pas TTerminologySlave.Time2Run (95) rest.services.pas TepresSlavePool.Task (291) mormot.core.log.pas _SetThreadName (5429) mormot.core.log.pas _SetThreadName (5429) mormot.core.threads.pas TSynThreadPoolWorkThread.DoTask (3898) mormot.core.threads.pas TSynThreadPoolWorkThread.Execute (3930) {12 65535.28 0.42 13 18.2GB/31.6GB 65f41b01}
I am getting errors like the following when a THttpClientSocket has probably lost its connection due to timeout, because THttpClientSocket instance was not in use for a period of time.
It does not seem to cause any harm, but is it possible to check the state before the request in order not to have this exception?
Exception: 20251125 11271351 * EXC ENetSock {LastError:"nrClosed",Message:"THttpClientSocket.SockInReadLn [#5 Closed]"} [pool6-TepresSlave] at ee8535 mormot.net.sock.pas TCrtSocket.DoRaise (5765) mormot.net.client.pas THttpClientSocket.RequestInternal (3310) mormot.core.text.pas VarRecToTempUtf8 (9375) mormot.net.ws.core.pas FrameInit (1486) mormot.core.buffers.pas AppendRawUtf8ToBuffer (9535) mormot.core.base.pas AppendShort (5376) mormot.core.base.pas FastSetString (5160) mormot.net.client.pas THttpClientSocket.Request (3428) System.pas @GetMem (4971) mormot.core.base.pas FastSetString (5160) System.pas @GetMem (4971) mormot.core.buffers.pas FromVarString (3497) System.pas @FreeMem (5019) System.pas @LStrClr (26350) System.pas @FinalizeRecord (33306) ephttp.pas Tephttp.httpGet (547) System.pas @ReallocMem (5093) ephttp.pas Tephttp.dohttp (669) ephttp.pas Tephttp.dohttp (689) slave.terminology.pas TTerminologySlave.GetTermCodesysEntities (169) slave.terminology.pas TTerminologySlave.Time2Run (95) rest.services.pas TepresSlavePool.Task (291) mormot.core.log.pas _SetThreadName (5429) mormot.core.log.pas _SetThreadName (5429) mormot.core.threads.pas TSynThreadPoolWorkThread.DoTask (3898) mormot.core.threads.pas TSynThreadPoolWorkThread.Execute (3930) {6 4.26 2.92 5.3GB/7.7GB 66581b01}
Delphi 12.3 win64
thank you a lot ab
I am getting all other errors with line numbers, that is the reason I am sure that map file is used.
The problem is that this happens to computers I do not have access to test, but I have enabled debug info for other reason.
It doesn't happen to my debug environment.
I will try tomorrow to see if the windows user account type (if it is a limited user) can be the reason.
But is it possible somehow to get the dll that causes it?
I am getting a big number of errors from tsynlog in my program like the following:
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807370) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
Exception OS: 20251117 10025441 ! EXCOS EExternalException (1073807366) [Main] at 7ffa5761804a {8 4.64 6.21 10 4.9GB/7.7GB 8.2GB/9.7GB 65f41b01}
They can be more than 100 with the same timestamp and there is no apparently problem when using my app.
I am not sure if webview2, the edge dll, cause them or an other dll like mariadb's dll. It does not return me any line number and I am not sure about the numbers in GB I see at the end.
Is there a way to get more information from tsynlog? Or can it be a problem from tsynlog that causes the same message to be archived multiple times?
Delphi 12.3 /windows / 64Bit compiled
Thank you in advance
I still don't understand how you defined the IList instance.
TormGetbundle=class(Torm)
private
Fdedo: RawUtf8; Fupddat: tdatetime; Ftyp,Fekdosi: integer;
public
class procedure InitializeTable(const Server: IRestOrmServer; const FieldName: RawUtf8; Options: TOrmInitializeTableOptions); override;
published
property typ:integer read Ftyp write Ftyp;
property ekdosi:integer read Fekdosi write Fekdosi;
property dedo:RawUtf8 read Fdedo write Fdedo;
property upddat:tdatetime read Fupddat write Fupddat;
end;
The errors happens when I do the following:
lis:=collections.NewList<TormGetbundle>;
TormGetbundle in this windows app is not an db table, (part of shared code with an other app that uses it as db table)
I still don't understand how you defined the IList instance.
I was using NewPlainList instead of NewList, as I notice now.
But still, in the above code if fDynArray.Info.ArrayRtti = nil, then the fDynArray.Info.ArrayRtti.Kind in EIList.RaiseUtf8 will give exception
Apologies Ab, I did not define anything new
I noticed that this happens since the updates in github after 3/11/25
The exception I get is in EIList.RaiseUtf8 and when debugging the fDynArray.Info.ArrayRtti is nil
@ab, Delphi 11.3 in a Torm class
but:
if (fDynArray.Info.ArrayRtti = nil) or
(fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind) then
EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
[self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);
mormot.core.collections, line 902
if fDynArray.Info.ArrayRtti is nil then fDynArray.Info.ArrayRtti.Kind will cause exception
I have random errors from that
constructor TIListParent.CreateRtti(aDynArray: TRttiCustom;
aItemTypeInfo: PRttiInfo; aOptions: TListOptions; aSortAs: TRttiParserType);
begin
fDynArray.InitRtti(aDynArray, fValue, @fCount);
aSortAs := fDynArray.SetParserType(aSortAs, // aSortAs=ptNone->RTTI
loCaseInsensitive in fOptions);
if (fDynArray.Info.ArrayRtti = nil) or
(fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind) then
EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
[self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);
The ORM has no way of actually knowing the range in the database.
At the ORM level, it handles 64-bit signed integers.It is up to the user code to ensure the value is in the correct range.
I agree, my question was about the error that was not reported.
The response from Trestbatch.send was 200
Today, I noticed that when adding a new Tormmyorm in an external mysql database, the record was not added in the database table.
The result from add was Ok, with the ID number, no exception somewhere
Trying to debug it, I found from ZEOS log that one field of the Tormmyorm had a value that was bigger that the allowed range in the database.
Zeos returned that no record was added and an error like the following:
'2025-10-31 14:08:44.386' cat: Execute, proto: mariadb, msg: Statement 903 : insert into myorm (ID,xxxx,xxxx,labo,xxxx) values (?,?,?,?,?,?,?,?,?,?,?,?), errcode: 1264, error: Out of range value for column 'labo' at row 1
I know that the table's field were changed to a smaller integer type and that was not caught in orm's object, but should I expect an error in such a case from mormot?
Thank you in advance