marsupilami wrote: ↑15.06.2020, 08:56I assume, aehimself has created some class helpers.
I'm not a big fan of class helpers, I like to write custom classes. By a table wrapper I mean a completely separate TObject, containing a TZQuery object, publishing the table's field in SQL as custom properties:
Code: Select all
TMyTable = Class
strict private
_sqltable: TZQuery;
public
FCreated: TMyDateTimeField;
End;
These fields are assigned after setting the table active:
Code: Select all
Self.FCreted.AssignField(_sqltable.FieldByName('Created));
The definitions are automatically generated by the database layout designer: if a table is created / deleted / modified, it's creating the delta scripts, full create scripts, the TMyTable definitions and some custom data formats required for the SQL query generator to be able to build a valid SQL query if the user wants to see "Created" and "IPAddress".
It's not ORM, but something like. The main purpose of it was to get rid of the continuous, expensive .FieldByName lookups as the application runs.
As TMyTable completely hides the ZQuery object it publishes some properties / methods, like .Eof, .RecNo, .RecordCount, etc.
.Save is simply calling _sqltable.Post after some internal data validation. I chose that name because it's easier to remember for me
marsupilami wrote: ↑15.06.2020, 08:56Logging happens on the dbc layer with code like this:
Code: Select all
if DriverManager.HasLoggingListener then
DriverManager.LogMessage(lcConnect, ConSettings^.Protocol, LogMsg);
So if one wants to do more logging, it is a matter of extending the driver in use, I think. For rows returned / affected, the statements would have to be extended.
Well, the good news is that you answered my question as I have no idea what are you talking about
I already saw statement and drivermanager references in the sources, but never actually worked with them... it's a good start though.
I'll see if I can get myself into it.