2005-07-26 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / Npgsql / Npgsql / NpgsqlParameterStatus.cs
1 // created on 8/6/2003 at 13:57
2 // Npgsql.NpgsqlAsciiRow.cs
3 //
4 // Author:
5 //      Francisco Jr. (fxjrlists@yahoo.com.br)
6 //
7 //      Copyright (C) 2002 The Npgsql Development Team
8 //      npgsql-general@gborg.postgresql.org
9 //      http://gborg.postgresql.org/project/npgsql/projdisplay.php
10 //
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.
15 //
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.
20 //
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
24
25 using System;
26 using System.Collections;
27 using System.IO;
28 using System.Text;
29 using System.Net;
30 using NpgsqlTypes;
31
32
33 namespace Npgsql
34 {
35
36     /// <summary>
37     /// This class represents the ParameterStatus message sent from PostgreSQL
38     /// server.
39     /// </summary>
40     ///
41     internal sealed class NpgsqlParameterStatus
42     {
43
44         private String _parameter;
45         private String _parameterValue;
46
47
48         public void ReadFromStream(Stream inputStream, Encoding encoding)
49         {
50
51             //Read message length
52             Byte[] inputBuffer = new Byte[4];
53             PGUtil.CheckedStreamRead(inputStream, inputBuffer, 0, 4 );
54
55             Int32 messageLength = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(inputBuffer, 0));
56
57             _parameter = PGUtil.ReadString(inputStream, encoding);
58             _parameterValue = PGUtil.ReadString(inputStream, encoding);
59
60
61         }
62
63         public String Parameter
64         {
65             get
66             {
67                 return _parameter;
68             }
69         }
70
71         public String ParameterValue
72         {
73             get
74             {
75                 return _parameterValue;
76             }
77         }
78
79
80     }
81
82
83 }