Help translating some subclassed functions from V7.2x to V8
Posted: 19.09.2022, 23:06
In version 7.2.x I had subclassed the tzConnection component to add some convenience functions and there are two of them I am having no luck recreating in Version 8. The first is as follows, and since the fDatasets property has been removed, I don't know how to go about getting either the TableCount or the actual tables/datasets used by connection. Here was my original code:
I did see some FindTables functions but they only return table names not the datasets/tables themselves, and they require schemas which I am not entirely clear how to access. Another thought I had was using the FindComponent function of the kzConnection but I wasn't sure if that was the best way (or if it would even work) do accomplish this.
The Second function I'm struggling with was one that took an SQL String and returned a TObjectList of all the tables affected by an UPDATE, INSERT OR DELETE. I had used some tokenizer functions in V7.2.x but the tokenizer functions in Version 8 have changed so much I'm not even sure where to start.
Any and all help on this would be GREATLY appreciated!
Code: Select all
function kZConnection.GetTable(inTableName: string):kZTable;
var
ResultIndex: Integer;
begin
result:=Nil;
for ResultIndex:=0 to Pred(FDatasets.Count) do
if Assigned(FDataSets[ResultIndex]) and (Tobject(FDataSets[ResultIndex]) is tzTable) and
SameText(tzTable(FDataSets[ResultIndex]).TableName,inTableName) then
begin
result:=kZTable(FDataSets[ResultIndex]);
exit;
end;
end;
The Second function I'm struggling with was one that took an SQL String and returned a TObjectList of all the tables affected by an UPDATE, INSERT OR DELETE. I had used some tokenizer functions in V7.2.x but the tokenizer functions in Version 8 have changed so much I'm not even sure where to start.
Code: Select all
type
tzTableList = TObjectList<tzTables>;
function kzConnection.FindAllTablesAffectedBySQL(const InSQL:String);tzTableList;