#1 Yesterday 17:00:48

tfopc
Member
Registered: 2024-01-08
Posts: 32

Problem/Bug - TSqlDBOdbcStatement.BindColumns cause endless loop

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

#2 Yesterday 19:48:54

tfopc
Member
Registered: 2024-01-08
Posts: 32

Re: Problem/Bug - TSqlDBOdbcStatement.BindColumns cause endless loop

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

Board footer

Powered by FluxBB