New test.
[mono.git] / mcs / class / Npgsql / Npgsql / NpgsqlRow.cs
1 // created on 4/3/2003 at 19:45
2
3 // Npgsql.NpgsqlBinaryRow.cs
4 //
5 // Author:
6 //      Francisco Jr. (fxjrlists@yahoo.com.br)
7 //
8 //      Copyright (C) 2002 The Npgsql Development Team
9 //      npgsql-general@gborg.postgresql.org
10 //      http://gborg.postgresql.org/project/npgsql/projdisplay.php
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
26 using System;
27 using System.Collections;
28 using System.IO;
29 using System.Text;
30 using System.Net;
31 using NpgsqlTypes;
32
33
34 namespace Npgsql
35 {
36
37     /// <summary>
38     /// This is the abstract base class for NpgsqlAsciiRow and NpgsqlBinaryRow.
39     /// </summary>
40     internal abstract class NpgsqlRow
41     {
42         // Logging related values
43         private static readonly String CLASSNAME = "NpgsqlRow";
44
45         protected ArrayList                  data;
46         protected NpgsqlRowDescription       row_desc;
47         protected ProtocolVersion            protocol_version;
48
49         public NpgsqlRow(NpgsqlRowDescription rowDesc, ProtocolVersion protocolVersion)
50         {
51             data = new ArrayList();
52             row_desc = rowDesc;
53             protocol_version = protocolVersion;
54         }
55
56         public virtual void ReadFromStream(Stream inputStream, Encoding encoding)
57         {
58           throw new NotImplementedException("Abstract");
59         }
60
61         /// <summary>
62         /// Provide access to the fields in this row.
63         /// </summary>
64         public virtual Object this[Int32 index]
65         {
66             get
67             {
68                 NpgsqlEventLog.LogIndexerGet(LogLevel.Debug, CLASSNAME, index);
69                 if ((index < 0) || (index >= row_desc.NumFields)) {
70                     throw new IndexOutOfRangeException("this[] index value");
71                 }
72
73                 return data[index];
74             }
75         }
76     }
77
78 }