I've figured out why each thread was able to finish before the next
one started. My Execute proc was not as "intensive" as I first
thought.
I replaced it with something much more time-consuming and intensive
in terms of accessing the database, and found that the threads DO
overlap.
procedure TTestThread.Execute;
var
~ rst: ADODB_TLB.Recordset;
~ lngAffected: OLEVariant;
~ strName: string;
~ i: integer;
begin
~ start := Loword(GetTickCount);
~ for i := 0 to 500 do
~ begin
~~~ rst := cnn.Execute(Format('SELECT * FROM Customers'#13#10 +
~~~ 'WHERE ((Customers.CustomerID)=%d);', [i]), lngAffected,
adCmdText);
~~~ if not rst.EOF then
~~~~~ strName := rstParents.Fields.Item['FirstName'].Value;
~~~ rst.Close
~ end;
~ stop := Loword(GetTickCount);
end;
Still no crashing of the ADO connection. Sweet.
In reality though, I won't be creating my own threads "as such".
What I'll be doing is accessing a database via a web service I have
written. The code will be in the implementation code of an
TInvokableClass descendant, and the threads will be incoming SOAP
requests that need to get information requiring access to a data file.
So I hope this test extrapolates fairly to that situation.
Ian.