> I have posted to newsgroups.borland.com, but so far no joy. I am 
> using some ICS components in my project though;)
> The problem I have is getting the ADO stuff to work asynchronously.
> All of this happens in a thread

With ICS, you generally don't need to use threads, since everything is
event driven.  I have on application that accepts and sends data on
hundreds of sockets simultaneously, writes it all to hundreds of separate
files, and writes some to SQL (but in my testing only two four databases).

I don't use TADOQuery, just TADOConnection, created in code, the I build
SQL statements and used the Execute method to perform everything (I only
use stored procedures, so keep SQL away from Delphi):

ChDbAdoConn := TADOConnection.Create(Self) ;
OptDatabaseTimeout_Value := 10 ;
ChDbAdoConn.CommandTimeout := OptDatabaseTimeout_Value ;
ChDbAdoConn.LoginPrompt := false ;
ChDbAdoConn.ConnectionTimeout := OptDatabaseTimeout_Value ;
ChDbAdoConn.ConnectOptions := coConnectUnspecified ;
ChDbAdoConn.Tag := Channel ;
ChDbAdoConn.OnConnectComplete := ADOConnConnectComplete ;
ChDbAdoConn.OnDisconnect := ADOConnDisconnect ;
ChDbAdoConn.OnExecuteComplete := ADOConnExecuteComplete ;

ChDbAdoConn.ConnectionString := ChDbSqlConnStr ;
ChDbAdoConn.ConnectOptions := coConnectUnspecified ;
ChDbAdoConn.Open ;

cmdTxt := (SQL statements)
ChDbAdoConn.Execute (ChDbLastCmdLine, cmdText, [eoAsyncExecute, 
  eoAsyncFetchNonBlocking]) ; 

And ADOConnExecuteComplete is called when ADO has finished.  Note that
ADO itself uses a thread to provide async operation. 

The hardest part about async ADO is all the error handling and possible
delays, I use a FIFO queue to buffer SQL statements, fortunately this
application is write to SQL only, not interactive. 


To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to