disable broken tests on net_4_0
[mcs.git] / class / Npgsql / Npgsql / NpgsqlConnectedState.cs
bloba32d89430fb14b1b31b93e1bef95fd712a88a8e7
1 // Npgsql.NpgsqlConnectedState.cs
2 //
3 // Author:
4 // Dave Joyner <d4ljoyn@yahoo.com>
5 //
6 // Copyright (C) 2002 The Npgsql Development Team
7 // npgsql-general@gborg.postgresql.org
8 // http://gborg.postgresql.org/project/npgsql/projdisplay.php
9 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Lesser General Public
13 // License as published by the Free Software Foundation; either
14 // version 2.1 of the License, or (at your option) any later version.
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Lesser General Public License for more details.
21 // You should have received a copy of the GNU Lesser General Public
22 // License along with this library; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 using System;
26 using System.IO;
29 namespace Npgsql
31 internal sealed class NpgsqlConnectedState : NpgsqlState
34 private static NpgsqlConnectedState _instance = null;
36 private NpgsqlConnectedState()
39 public static NpgsqlConnectedState Instance
41 get
43 if ( _instance == null )
45 _instance = new NpgsqlConnectedState();
47 return _instance;
51 public override void Startup(NpgsqlConnector context)
53 NpgsqlStartupPacket startupPacket = new NpgsqlStartupPacket(296, //Not used.
54 context.BackendProtocolVersion,
55 context.Database,
56 context.UserName,
57 "",
58 "",
59 "");
61 startupPacket.WriteToStream( new BufferedStream(context.Stream), context.Encoding );
62 context.Mediator.RequireReadyForQuery = false;
63 context.Mediator.CommandTimeout = 20;
64 context.Stream.Flush();
65 ProcessBackendResponses( context );
68 public override void CancelRequest(NpgsqlConnector context)
70 NpgsqlCancelRequest CancelRequestMessage = new NpgsqlCancelRequest(context.BackEndKeyData);
73 CancelRequestMessage.WriteToStream(context.Stream, context.Encoding);