while returning a string from the function, where the function is producing a SQL Query.
While trying to add values to object.
Tried with latest files.
In the First scenario , am trying to get the sql.query as an output from the function. (PS_Test)
In the second scenario, I was trying to add value to an object. When the add method of the object was called directly without interacting with Pascal Script, then the value was added successfully. But when we interact with Pascal Script, we are getting AV.
As both are resulting in AV, I mentioned in single topic. These scenarios works good with 32-bit.
type
TMySQLQuery = class helper for TSQLQuery
public
function GetQueryText: String;
end;
function TMySQLQuery.GetQueryText: String;
var
i: Integer;
s: string;
begin
try
Result := Self.SQL.Text;
if Self.Params.Count = 0 then
exit;
for i := 0 to Self.Params.Count - 1 do
begin
if s > '' then
s := s + ', ' + #13#10;
s := s + ':' + Self.Params.Items[i].Name + ' [' +
TruncateString(Self.Params.Items[i].Text, 100, True) + ']';
end;
Result := Result + #13#10 + s;
except
Result := Self.SQL.Text;
end;
end;
I have tried these helpers with a mistake.
“RegisterMethod(@TMySQLQuery.GetQueryText, ‘GetQueryText’);”. This is what I did.
And without these helpers also it worked when I used the file shared by you long ago for a query. I would like to share the file with you. InvokeCall.inc (9.6 KB) uPSRuntime.pas (433.0 KB)
By using these files , the sql worked without helpers. There were differences b/w the latest files and the shared files. The files which I shared was once given by you for the same issue as a fix.
I have tested the things by changing to unicode in both files. When it changed to unicodestring, i got weird value in the key variable. Am getting the array.name into str1 variable. The key was “name”, but when i changed it to unicodestring , i got the key as “name%^” . So i reverted to original