unit uPSI_SQLConnection;
{
This file has been generated by UnitParser v0.7, written by M. Knight
and updated by NP. v/d Spek and George Birbilis. 
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ROPS are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok's conv utility

}
interface
 

 
uses
   SysUtils
  ,Classes
  ,uPSComponent
  ,uPSRuntime
  ,uPSCompiler
  ;
 
type 
(*----------------------------------------------------------------------------*)
  TPSImport_SQLConnection = class(TPSPlugin)
  public
    procedure CompileImport1(CompExec: TPSScript); override;
    procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
  end;
 
 
{ compile-time registration functions }
procedure SIRegister_TSQLQuery(CL: TPSPascalCompiler);
procedure SIRegister_TSQLConnection(CL: TPSPascalCompiler);
procedure SIRegister_SQLConnection(CL: TPSPascalCompiler);

{ run-time registration functions }
procedure RIRegister_TSQLQuery(CL: TPSRuntimeClassImporter);
procedure RIRegister_TSQLConnection(CL: TPSRuntimeClassImporter);
procedure RIRegister_SQLConnection(CL: TPSRuntimeClassImporter);

procedure Register;

implementation


uses
   SQLConnection
  ;
 
 
procedure Register;
begin
  RegisterComponents('Pascal Script', [TPSImport_SQLConnection]);
end;

(* === compile-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure SIRegister_TSQLQuery(CL: TPSPascalCompiler);
begin
  //with RegClassS(CL,'TObject', 'TSQLQuery') do
  with CL.AddClassN(CL.FindClass('TObject'),'TSQLQuery') do
  begin
    RegisterMethod('Constructor Create');
    RegisterMethod('Procedure Open');
    RegisterMethod('Procedure Close');
    RegisterMethod('Procedure Next');
    RegisterMethod('Procedure First');
    RegisterMethod('Procedure Last');
    RegisterMethod('Procedure Previous');
    RegisterMethod('Procedure Append');
    RegisterMethod('Procedure Edit');
    RegisterMethod('Procedure Post');
    RegisterMethod('Procedure ExecSQL');
    RegisterMethod('Function Eof : boolean');
    RegisterMethod('Function FieldByNameAsBoolean( FieldName : string) : Boolean');
    RegisterMethod('Function FieldByNameAsDateTime( FieldName : string) : TDateTime');
    RegisterMethod('Function FieldByNameAsFloat( FieldName : string) : Double');
    RegisterMethod('Function FieldByNameAsInteger( FieldName : string) : Longint');
    RegisterMethod('Function FieldByNameAsString( FieldName : string) : String');
    RegisterProperty('Active', 'boolean', iptrw);
    RegisterProperty('SQL', 'TStrings', iptr);
    RegisterProperty('Connection', 'TSQLConnection', iptrw);
  end;
end;

(*----------------------------------------------------------------------------*)
procedure SIRegister_TSQLConnection(CL: TPSPascalCompiler);
begin
  //with RegClassS(CL,'TObject', 'TSQLConnection') do
  with CL.AddClassN(CL.FindClass('TObject'),'TSQLConnection') do
  begin
    RegisterMethod('Constructor Create');
    RegisterMethod('Procedure Open( )');
    RegisterMethod('Procedure Close( )');
    RegisterProperty('ProviderName', 'string', iptrw);
    RegisterProperty('UserName', 'string', iptrw);
    RegisterProperty('Password', 'string', iptrw);
    RegisterProperty('Server', 'string', iptrw);
    RegisterProperty('Port', 'integer', iptrw);
    RegisterProperty('Database', 'string', iptrw);
    RegisterProperty('Connected', 'boolean', iptrw);
    RegisterProperty('Params', 'TStringList', iptr);
  end;
end;

(*----------------------------------------------------------------------------*)
procedure SIRegister_SQLConnection(CL: TPSPascalCompiler);
begin
  SIRegister_TSQLConnection(CL);
  SIRegister_TSQLQuery(CL);
end;

(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure TSQLQueryConnection_W(Self: TSQLQuery; const T: TSQLConnection);
begin Self.Connection := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLQueryConnection_R(Self: TSQLQuery; var T: TSQLConnection);
begin T := Self.Connection; end;

(*----------------------------------------------------------------------------*)
procedure TSQLQuerySQL_R(Self: TSQLQuery; var T: TStrings);
begin T := Self.SQL; end;

(*----------------------------------------------------------------------------*)
procedure TSQLQueryActive_W(Self: TSQLQuery; const T: boolean);
begin Self.Active := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLQueryActive_R(Self: TSQLQuery; var T: boolean);
begin T := Self.Active; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionParams_R(Self: TSQLConnection; var T: TStringList);
begin T := Self.Params; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionConnected_W(Self: TSQLConnection; const T: boolean);
begin Self.Connected := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionConnected_R(Self: TSQLConnection; var T: boolean);
begin T := Self.Connected; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionDatabase_W(Self: TSQLConnection; const T: string);
begin Self.Database := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionDatabase_R(Self: TSQLConnection; var T: string);
begin T := Self.Database; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionPort_W(Self: TSQLConnection; const T: integer);
begin Self.Port := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionPort_R(Self: TSQLConnection; var T: integer);
begin T := Self.Port; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionServer_W(Self: TSQLConnection; const T: string);
begin Self.Server := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionServer_R(Self: TSQLConnection; var T: string);
begin T := Self.Server; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionPassword_W(Self: TSQLConnection; const T: string);
begin Self.Password := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionPassword_R(Self: TSQLConnection; var T: string);
begin T := Self.Password; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionUserName_W(Self: TSQLConnection; const T: string);
begin Self.UserName := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionUserName_R(Self: TSQLConnection; var T: string);
begin T := Self.UserName; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionProviderName_W(Self: TSQLConnection; const T: string);
begin Self.ProviderName := T; end;

(*----------------------------------------------------------------------------*)
procedure TSQLConnectionProviderName_R(Self: TSQLConnection; var T: string);
begin T := Self.ProviderName; end;

(*----------------------------------------------------------------------------*)
procedure RIRegister_TSQLQuery(CL: TPSRuntimeClassImporter);
begin
  with CL.Add(TSQLQuery) do
  begin
    RegisterConstructor(@TSQLQuery.Create, 'Create');
    RegisterMethod(@TSQLQuery.Open, 'Open');
    RegisterMethod(@TSQLQuery.Close, 'Close');
    RegisterMethod(@TSQLQuery.Next, 'Next');
    RegisterMethod(@TSQLQuery.First, 'First');
    RegisterMethod(@TSQLQuery.Last, 'Last');
    RegisterMethod(@TSQLQuery.Previous, 'Previous');
    RegisterMethod(@TSQLQuery.Append, 'Append');
    RegisterMethod(@TSQLQuery.Edit, 'Edit');
    RegisterMethod(@TSQLQuery.Post, 'Post');
    RegisterMethod(@TSQLQuery.ExecSQL, 'ExecSQL');
    RegisterMethod(@TSQLQuery.Eof, 'Eof');
    RegisterMethod(@TSQLQuery.FieldByNameAsBoolean, 'FieldByNameAsBoolean');
    RegisterMethod(@TSQLQuery.FieldByNameAsDateTime, 'FieldByNameAsDateTime');
    RegisterMethod(@TSQLQuery.FieldByNameAsFloat, 'FieldByNameAsFloat');
    RegisterMethod(@TSQLQuery.FieldByNameAsInteger, 'FieldByNameAsInteger');
    RegisterMethod(@TSQLQuery.FieldByNameAsString, 'FieldByNameAsString');
    RegisterPropertyHelper(@TSQLQueryActive_R,@TSQLQueryActive_W,'Active');
    RegisterPropertyHelper(@TSQLQuerySQL_R,nil,'SQL');
    RegisterPropertyHelper(@TSQLQueryConnection_R,@TSQLQueryConnection_W,'Connection');
  end;
end;

(*----------------------------------------------------------------------------*)
procedure RIRegister_TSQLConnection(CL: TPSRuntimeClassImporter);
begin
  with CL.Add(TSQLConnection) do
  begin
    RegisterConstructor(@TSQLConnection.Create, 'Create');
    RegisterMethod(@TSQLConnection.Open, 'Open');
    RegisterMethod(@TSQLConnection.Close, 'Close');
    RegisterPropertyHelper(@TSQLConnectionProviderName_R,@TSQLConnectionProviderName_W,'ProviderName');
    RegisterPropertyHelper(@TSQLConnectionUserName_R,@TSQLConnectionUserName_W,'UserName');
    RegisterPropertyHelper(@TSQLConnectionPassword_R,@TSQLConnectionPassword_W,'Password');
    RegisterPropertyHelper(@TSQLConnectionServer_R,@TSQLConnectionServer_W,'Server');
    RegisterPropertyHelper(@TSQLConnectionPort_R,@TSQLConnectionPort_W,'Port');
    RegisterPropertyHelper(@TSQLConnectionDatabase_R,@TSQLConnectionDatabase_W,'Database');
    RegisterPropertyHelper(@TSQLConnectionConnected_R,@TSQLConnectionConnected_W,'Connected');
    RegisterPropertyHelper(@TSQLConnectionParams_R,nil,'Params');
  end;
end;

(*----------------------------------------------------------------------------*)
procedure RIRegister_SQLConnection(CL: TPSRuntimeClassImporter);
begin
  RIRegister_TSQLConnection(CL);
  RIRegister_TSQLQuery(CL);
end;

 
 
{ TPSImport_SQLConnection }
(*----------------------------------------------------------------------------*)
procedure TPSImport_SQLConnection.CompileImport1(CompExec: TPSScript);
begin
  SIRegister_SQLConnection(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_SQLConnection.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
  RIRegister_SQLConnection(ri);
end;
(*----------------------------------------------------------------------------*)
 
 
end.
