Manny: Do you want to have one or more queries per session? You want a Query pool?
Make a global array or a dynamic list of TSQLQuery ... myqueries : array of TZQuery, or something like this.
Ask the Query if it is executing or however you define a Query is available. In the procuedure you can hold a reference to the TSQLQuery you have choosen.
var
lQry : TXXQuery;
begin
lQry := myGlobalQryList[POS_CHOOSEN_BECAUSE_FREE] and work with it.
lQry.SQL:='select mystuff1, mystuuf2 from mytab';
lQry.Open;
// Don't close or free in this case.
// Same would work if you just take the index.
//myGlobalQryList[POS_CHOOSEN_BECAUSE_FREE].SQL:='...';
// myGlobalQryList[POS_CHOOSEN_BECAUSE_FREE].SQL:=Open;
;
I think something like this is what you seek. This code just for getting an idea. The processing of a PHP script in our case is opening a Form. This is where this DB Query concept comes from. Also check if putting queries on a datamodule can help you. A data module can be created at runtime and with little phantasy one can see it as a submodel. Maybe this PDF documents will give you an idea about the underlying issue...
http://motaz.freevar.com/freespider.pdfMike