TZQuery is class and unknown for pascalscript. For unknown classes you must create "import/register" unit.
Registered classes you can use:
//TStringList is already registered you can use it.
Sender.AddRegisteredVariable('Pars', 'TStringList'); // i declared this variable: Pars: TStringList;
All the plugins you dropped on your form registers various classes, types and component. Look in the units you can learn something.
Make your life easy, do what I did.
Also I am using TZQuery in my pascalscripts. But I don't created register unit. I use TDataSet in scripts.
I created in my form function for script like this:
procedure TForm1.ZQueryCreate(var aQ: TDataSet);
begin
aQ:=TZQuery.Create(Application);
TZQuery(aQ).Connection:=ZConnection1;
end;
procedure TForm1.ZSQLExec(aQ: TDataSet; aStr: String);
begin
TZQuery(aQ).Close; TZQuery(aQ).Sql.Clear;
TZQuery(aQ).Sql.Add(aStr);
TZQuery(aQ).ExecSQL;
end;
procedure TForm1.PSScript1Compile(Sender: TPSScript);
begin
Sender.AddMethod(Self, @TForm1.ZQueryCreate,'procedure ZQueryCreate(var aQ: TDataSet);');
Sender.AddMethod(Self, @TForm1.ZSQLExec,'procedure ZSQLExec(aQ: TDataSet; aStr: String);');
end;
In your script you can use:
var ds: TDataSet;
begin
ZQueryCreate(ds);
ZSQLExec(ds, 'select * from table1');
//then you can work with field same way as in freepascal
ds.first;
while no ds.eof do begin
writeln(ds.fieldbyname('field1').asstring);
ds.next;
end;
ds.Free;
end;
end;
You can also google for it:
https://duckduckgo.com/?q=pascalscript