You are not logged in.
Hi ab,
after i give a software modul a try with the current source after some time, the software didn't start and runs in a busy loop...
Delphi7, Orm, Postgres, we are using the odbc-driver
after some debugging is see that the reason seems to be how the data is transfered to json. After each "numeric" element there are some "#0"
Here is the shortend Delphi (Debug-)Var content:
'[{"id":1'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0',"lastchange":"2025-05-13T14:54:33","createdon":"2022-09-12T08:35:10","name":"TF","location":1'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0'}]'#$A
Endless loop than happens in TOrmTableJson.ParseAndConvert GetFieldCountExpanded
I checked the older versions last working version with using the orm was from 24.06.25, with source from 12.05.2025, next git fetch and compiletime was 09.07.2025. so the breaking change i think was done in this timerange.
I also give the mormot.db.sql.postgres a try and use the libpq directly. But the currently used dll can't be loaded...
'TSqlDBPostgresLib.Resolve('PQFreeMem'): not found in libpq.dll'
The libpq.dll is used also from firedac in the same software. So it works in general.
Any hints? Resolution?
libpq.dll updates will be a litle bit problematic on many clients :-/
... ohh i see that "FreeMem" isn't used anywhere so i uncomment it and also google ai says:
"PGFreeMem is not part of the official PostgreSQL C library libpq, but rather a function used in the C++ library libpqxx. libpq is the C API for PostgreSQL and provides functions for communicating with the database server, while libpqxx is a C++ abstraction layer for interacting with libpq. PGFreeMem is used in libpqxx to free memory that was allocated by the underlying C library libpq."
After that the software starts again. but now there are some other problems the need to be resolved....
... next week - to much debugging for friday ;-)
Offline
FYI: the problem with "PQFreeMem" seems to be a case beautify search and replace problem ;-)
I looked via dll-export-viewer in the libpq.dll - the function ist "PGfreemem"
so
https://github.com/synopse/mORMot2/blob … s.pas#L350
should be lowercase made again.
Offline
You are right.
Please try with
https://github.com/synopse/mORMot2/commit/4bf8b6a31
Thanks for the feedback, and investigation.
Offline
Hi ab,
i saw your commits on odbc from yesterday. so i give the problem (see first post, that brings me to the dessison to switch the db-interface) a new try with odbc. But the problem with the endless-loop in
TOrmTableJson.ParseAndConvert - GetFieldCountExpanded is still there because of the invalid data returned from TSqlDBOdbcStatement - BindColumns / GetData.
But the buffer now looks different to my first try: '[{"id":1'
Debugged in mormot.orm.core line 6056.
But this data also ends in a endless loop in "mormot.core.json - GetFieldCountExpanded"
Isn't the missing check in GetFieldCountExpanded critical, if someone put invalid data in the function?
Didn't test with a unicode Delphi-Version. Only with D7.
Thanks.
Last edited by tfopc (2025-09-11 09:18:07)
Offline
It sounds like if the JSON was not copied before parsing, and it is parsed twice, which does not work.
It may be a caching problem.
We need a minimal reproducible example.
Offline