in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Non-constant CommandTimeout

Last post 12-22-2007 11:57 AM by Robert Simpson. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-14-2007 5:28 PM

    Non-constant CommandTimeout

    I have a program with several threads accessing the same DB. Some transactions are very slow, so the default SQLiteCommand.CommandTimeout=30 is not appropriate.

     

    I can change SQLiteCommand.CommandTimeout value for each SQLiteCommand instance (though it's very inconvenient) but there are cases when SQLiteCommand is not accessible. For example SQLiteTransaction.Commit() creates an instance of SQLiteCommand and executes it without giving an ability to change something.

     

    The proposal is to make the default value of SQLiteCommand.CommandTimeout controllable at runtime.

     

    This can be done easily by changing SQLiteCommand.cs line 130

      _commandTimeout = 30;

    to

      _commandTimeout = connection.ConnectionTimeout;

    and implementing SQLiteConnection.ConnectionTimeout property setter.

     

    P.S. Sorry for my English, it isn't debugged yet.

  • 12-17-2007 11:44 AM In reply to

    • Sam_
    • Top 10 Contributor
    • Joined on 02-14-2007
    • Washington DC
    • Posts 86

    Re: Non-constant CommandTimeout

    I would not be in favor of linking CommandTimeout to ConnectionTimeout since it would be inconsistent with other DB's to do so.  I would suggest instead adding a connections tring parameter like "CommandTimeout" or "DefaultCommandTimeout" so one could specify on the connection string what default command timeout to use.

     Sam   

    We're hiring! B-Line Medical is seeking .NET Developers for exciting positions in medical product development in MD/DC. Work with a variety of technologies in a relaxed team environment. See ads on http://careerbuilder.com.
  • 12-22-2007 11:57 AM In reply to

    Re: Non-constant CommandTimeout

    I could add that pretty easily to the connection string.  I could also call it "TransactionTimeout" instead, so its clear where the timeout would apply ... either that or just call it "CommandTimeout" and make that the default value for all newly-created commands.

    Robert

     

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems