npgsql 2 uses async fetching in DataReader:

Rows are read from server only when DataReader Read() requests them.
Connection is in this case in fetching state. 
ADO .NET Sqlclient does never return Fetching connection state in standard 
ConnectionState property and npgsql follows this for compatibility.

In cases when user aborts Linq enumerator e.q by exiting foreach before end and 
issues new query, DbLinq tries to use this connection again
since it finds that it is in Open state.

This causes npgsql exception since really connection is in fetching state and 
Multiple Active Result Sets over same connections are not available (only MS 
Sqlclient with newer sql servers allows them but even this requires setting 
MARS explicity in connection string).

I think this must be same for any ADO .NET provider which will not read entire 
result set to memory.

Possible fixes may be:

1. Close connection if Datareader is closed and re-open it if needed. Jiri 
wrote in earlier discussion that this is slow in Oracle.
2. Catch this exception and re-open connection. This may require  catching 
every provider exception and try re-open for every exception since there is no 
ADO standard for this. 
3. Create some special vendor setting to use vendor-specific fixes.

Andrus.



  ----- Original Message ----- 
  From: Pascal Craponne 
  To: [email protected] 
  Sent: Wednesday, October 22, 2008 10:19 PM
  Subject: Re: Nested LINQ with postgres


  Hi Andrus,


  is there any way to get this code more generic (ie without cast to 
NpgsqlConnection)?
  It seems strange that PostgreSQL manages connections so differently.


  Pascal.


  On Wed, Oct 22, 2008 at 17:36, Alan187 <[EMAIL PROTECTED]> wrote:


    Andrus,

    Thank you for taking time to reply to my post.

    Again, keep up the great work everone.

    -Alan






  -- 
  Pascal.

  jabber/gtalk: [EMAIL PROTECTED]
  msn: [EMAIL PROTECTED]



  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to