I've encountered in some code the following call :
SQLParser.Parse(qry.SQL.Text)().GetWhereClause
and I don't understand the meaning of those 2 parenthesis after the Parse call. Following the implementation I got the declarations for each one of them:
TSQLParser = class
public
class function Parse(const ASQL: string): ISmartPointer<TSQLStatement>;
TSQLStatement = class
function GetWhereClause: string;
and
ISmartPointer<T> = reference to function: T;
The Parse function returns a reference to a function. You can call this function. A longer equivalent form would be:
var
FunctionReference: ISmartPointer<TSQLStatement>;
SQLStatement: TSQLStatement;
begin
{ Parse returns a reference to a function. Store that function reference in FunctionReference }
FunctionReference := TSQLParser.Parse(qry.SQL.Text);
{ The referenced function returns an object. Store that object in SQLStatement }
SQLStatement := FunctionReference();
{ Call the GetWhereClause method on the stored object }
SQLStatement.GetWhereClause();
The line in the question is just a shorter version that does not use explicit variables to store the intermediate results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With