Board index » delphi » Using commandtimeout

Using commandtimeout

Hi all,

I have a question about the commandtimeout property. I'm writing a
conversion program that has bunch of steps. Some of the require a bit of
time to process a sql statement. Since this is a one-time thing, I'm not
concerned about the amount of time a command takes (some up to @ 5 minutes)

Using D5, MSSQL 7, trying to use tadoquery.

A little about the program. It has generic code that the format of our
legacy file structure and builds a SQL table with all the same fields. The
old data stored everything as ascii text. It reads data from the legacy
files into sql tables which are built on the fly based on the file being
converted.

I noticed some odd behavior during the processing. When I got a time-out,
I'm simply increasing the timeout value (in my adoconnection). I've gotten
past the bogus timeout errors (sometimes it reports one, but the real error
is something else. I pasted the SQL text into query analyzer to find the
real error), but I noticed that the timeout doesn't seem to work right. So,
I decided to test it. I have one table with  @ 25,000 records in it. As a
test, I put in logic that takes that table and copies into a throwaway table
using insert statements. Since that didn't take very long, I had it copy the
data into it several times. This means that the new junk table has 8 copies
of the original. This takes around 35 seconds. (The old record has a lot of
fields in it)  With the commandtimeout set ridiculously high (1500), the
command times out at around 33 seconds. At a low value (like 1, 5, 10, etc)
it still times out around the same time.

As a further test, I moved the sql.text into the commandtext property of a
adocommand, and it seems to work right. Any idea what's going on?

Mike Walsh

 

Re:Using commandtimeout


Hi Mike,

Quote
> As a further test, I moved the sql.text into the commandtext property of a
> adocommand, and it seems to work right. Any idea what's going on?

In D5, the CommandTimeOut property of TADOQuery is not exposed.
Here is how you can set it through a typecasting:

TADODataSet(ADOQuery1).CommandTimeOut := 60;

TADOCommand has a CommandTimeOut property, thus it is also a good solution, even better than TADOQuery if your SQL is not returning
records.

Thrse

Re:Using commandtimeout


Quote
"Thrse Hanquet" <therese.hanq...@skynet.be> wrote in message

news:3df12999$1@newsgroups.borland.com...
Quote
> Hi Mike,

> In D5, the CommandTimeOut property of TADOQuery is not exposed.
> Here is how you can set it through a typecasting:

> TADODataSet(ADOQuery1).CommandTimeOut := 60;

> TADOCommand has a CommandTimeOut property, thus it is also a good

solution, even better than TADOQuery if your SQL is not returning
Quote
> records.

> Thrse

Thrse,

    So the query has a timeout property? I thought it just used the one in
the adoconnection, learn something every day.

Mike

Other Threads