3ddark 3 Posted July 29, 2023 Delphi Simple ORM using ZeosDBO https://github.com/3ddark/delphi-orm-test Two different version. v2 supported actions function GetList(AClass: TClass; var AList: TArray<TTable>; AFilter: string; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; function GetListCustom(AClass: TClass; var AList: TArray<TTable>; AFields: TArray<TFieldDB>; AFilter: string; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; function GetOne(ATable: TTable; AFilter: string; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; overload; function GetOneCustom(ATable: TTable; AFields: TArray<TFieldDB>; AFilter: string; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; overload; function GetOne(ATable: TTable; AID: Int64; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; overload; function GetOneCustom(ATable: TTable; AFields: TArray<TFieldDB>; AID: Int64; ALock: Boolean; APermissionCheck: Boolean=True): Boolean; overload; function Insert(ATable: TTable; APermissionCheck: Boolean=True): Boolean; virtual; function Update(ATable: TTable; APermissionCheck: Boolean=True): Boolean; virtual; function CustomUpdate(ATable: TTable; AFields: TArray<TFieldDB>; APermissionCheck: Boolean=True): Boolean; virtual; function DeleteBatch(AClass: TClass; AFilter: string; APermissionCheck: Boolean=True): Boolean; overload; function DeleteBatch(ATables: TArray<TTable>; APermissionCheck: Boolean=True): Boolean; overload; function Delete(ATable: TTable; APermissionCheck: Boolean=True): Boolean; virtual; function LogicalSelect(AClass: TClass; var ATable: TTable; AFilter: string; ALock, AWithBegin, APermissionCheck: Boolean; AProcBusinessSelect: TBusinessSelectEvent): TEntityManager; virtual; function LogicalInsert(ATable: TTable; AWithBegin, AWithCommit, APermissionCheck: Boolean; AProcBusinessInsert: TBusinessOperationEvent): Boolean; virtual; function LogicalUpdate(ATable: TTable; AWithBegin, AWithCommit, APermissionCheck: Boolean; AProcBusinessUpdate: TBusinessOperationEvent): Boolean; virtual; function LogicalDelete(ATable: TTable; AWithBegin, AWithCommit, APermissionCheck: Boolean; AProcBusinessDelete: TBusinessOperationEvent): Boolean; virtual; procedure Listen(ATableName: string); virtual; procedure Unlisten(ATableName: string); virtual; procedure Notify(ATableName: string); virtual; function IsAuthorized(ATableSourceCode: string; APermissionType: TPermissionType; APermissionCheck: Boolean; AShowException: Boolean=True): Boolean; procedure Start(AConnection: TZAbstractConnection = nil); procedure Commit(AConnection: TZAbstractConnection = nil); procedure Rollback(AConnection: TZAbstractConnection = nil); frmMain contain example for using methods 3 Share this post Link to post
Arnaud Bouchez 407 Posted July 31, 2023 Generation of SQL with parameters should help the performance and security. 1 Share this post Link to post
3ddark 3 Posted July 31, 2023 4 hours ago, Arnaud Bouchez said: Generation of SQL with parameters should help the performance and security. Can you explain with an example? Share this post Link to post
aehimself 396 Posted August 6, 2023 On 7/31/2023 at 2:31 PM, 3ddark said: Can you explain with an example? Instead of “SELECT * FROM MyTable WHERE ID = 99” use “SELECT * FROM MyTable WHERE ID = :pID”, then assign the value 99 for the parameter named pID. 1 Share this post Link to post