views:

158

answers:

1

It seems like the UnitImport program maybe came along some ways into the development of cajScript/PascalScript and it may hide some of the details that would help provide an understanding of how to implement a PascalScript application. Assuming that is the case or that you wanted to write a PascalScript application without using the importer, how would you incorporate a class like this into your scripting environment?:

 TQuery = Class(TObject)
  private
    oSQL: TSQLQuery;
    FFirstCall: Boolean;
    function ExecSQL: Integer;
    function GetFields(iNdx: Integer): String;
    function GetFieldNames(iNdx: Integer): String;
    function GetFieldCount: Integer;
  public
    EOF: Boolean;
    Constructor Create(Owner: TComponent);
    Destructor Destroy;
    property FieldCount: Integer Read GetFieldCount;
    property FieldNames[iNdx: Integer]: String Read GetFieldNames;
    property Fields[iNdx: Integer]: String Read GetFields;
    procedure AddSQL(sSQL: String);
    procedure ExecSQL;
    function Fetch: Boolean;
  end;

I'm hoping to put together some basic notes on using PascalScript that might fill in some of the gaps left by the two instruction documents and the newsgroups.

Thanks for any help.

+1  A: 

The Unit Importer tool works pretty well, and that class doesn't look like it would give it any trouble. What I'd do is run the class through the importer and take a look at the import code that comes out. By examining it, you can see what a good class import unit should look like, which will give you a place to start from in your attempt to learn how class importing works.

Mason Wheeler
Yes, the Unit Importer works well. After following the suggestion you gave Larry a few days ago, I found that my unit works well and I can run my script. I asked the question because PascalScript looks like a great library and I expect to spend a lot of time with it in the future. But it seems like it would be better to understand what is going on with it if, for example, I find out that I want to change some aspect of my imported unit without running it back through the import tool or I want to add a non-class variable.
Jrodenhi, read beyond the first sentence of Mason's answer, and you'll have your advice. Look at what the importer does, and then do the same thing, but manually.
Rob Kennedy
Mason, I see that I failed to come back and accept your answer. I did end up following the approach you suggest here. I ran into some other issues and bagged PascalScript in favor of TMS Scripter Studio. I tested FastScript and PascalScript before settling on TMS. It's not perfect, but I have made enough progress with it to stay with it now.