TAstaServerSocket.OnSubmitSQL


 

Applies to
TAstaServerSocket

 

Declaration
type TAstaServerExecSQLEvent = procedure(Sender: TObject;
  AQuery: TComponent; DataBaseStr, SQLString:
string;
  
var TheResult: Boolean; var Msg: string) of object;

property OnSubmitSQL: TAstaServerExecSQLEvent;

 

Decription

This is the event coded that allows Select statements to work for ASTA clients. Here is an example from the AstaBDEServer. Depending on the threading model in effect, the AQuery parameter will be supplied by the ThreadedDBSupplyQueryEvent. Since ASTA suports any type of component for use with ASTA servers, the example below type casts AQuery as a BDE TQuery since this example was from the AstaBDEServer.

 

procedure TForm1.AstaServerSocket1SubmitSQL(Sender: TObject;
  ClientSocket: TCustomWinSocket; AQuery: TDataSet;
  DataBaseStr, SQLString:
string; Options: TAstaSelectSQLOptionSet);

begin

  try

  //This is the key to make your server work with ASTA.

  //Just pass on the SQL from the client!

    if TQuery(AQuery).Active then TQuery(AQuery).Close;

    TQuery(AQuery).SQL.Clear;

    TQuery(AQuery).SQL.Add(SQLString);

    TQuery(AQuery).Open;

  except

    LogException(ClientSocket, Exception(exceptObject).Message, True);

  end;

end;

 



ASTA Overview TAstaServerSocket.OnStoredProcedure TUsers.CheckListBox