Command timeout doesn't work for prepared commands
Posted: Tue 06 Sep 2011 12:32
Hi,
Setting the command timeout to 0 to suppress timeout exceptions as indicated in the documentation doesn't seem to work for prepared commands. I'm using dotConnect version 5.30.202 in combination with PostgreSQL 8.4.8.
Code to reproduce:
This always results in a PgSqlException "Server did not respond within the specified timeout interval" after 30 seconds, ignoring any value specified as CommandTimeout.
When the prepare statement is commented out, the value of CommandTimeout is used correctly.
Postgres function definition:
To me this seems like a bug?
Regards,
Ruud
Setting the command timeout to 0 to suppress timeout exceptions as indicated in the documentation doesn't seem to work for prepared commands. I'm using dotConnect version 5.30.202 in combination with PostgreSQL 8.4.8.
Code to reproduce:
Code: Select all
DbProviderFactory factory = DbProviderFactories.GetFactory(@"Devart.Data.PostgreSql");
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = @"Host=localhost;Database=test;User Id=test;Unicode=true";
connection.Open();
DbCommand command = connection.CreateCommand();
command.CommandText = "worker_func";
command.CommandType = CommandType.StoredProcedure;
command.CommandTimeout = 0;
command.Prepare();
try
{
command.ExecuteNonQuery();
}
catch (DbException e)
{
Console.Error.WriteLine(e.Message);
}
connection.Close();
When the prepare statement is commented out, the value of CommandTimeout is used correctly.
Postgres function definition:
Code: Select all
CREATE OR REPLACE FUNCTION worker_func()
RETURNS void AS $$
BEGIN
WHILE TRUE LOOP
END LOOP;
END;
$$ LANGUAGE plpgsql VOLATILE;
Regards,
Ruud