disable broken tests on net_4_0
[mcs.git] / class / Npgsql / Npgsql / NpgsqlCopyFormat.cs
blobc18535210ce331cba2b7cf738ba39cb71629fd53
1 // Npgsql.NpgsqlCopyFormat.cs
2 //
3 // Author:
4 // Kalle Hallivuori <kato@iki.fi>
5 //
6 // Copyright (C) 2007 The Npgsql Development Team
7 // npgsql-general@gborg.postgresql.org
8 // http://gborg.postgresql.org/project/npgsql/projdisplay.php
9 //
10 // Copyright (c) 2002-2007, The Npgsql Development Team
12 // Permission to use, copy, modify, and distribute this software and its
13 // documentation for any purpose, without fee, and without a written
14 // agreement is hereby granted, provided that the above copyright notice
15 // and this paragraph and the following two paragraphs appear in all copies.
17 // IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
18 // FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
19 // INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
20 // DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
21 // THE POSSIBILITY OF SUCH DAMAGE.
23 // THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25 // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
26 // ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
27 // TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
30 using System;
32 namespace Npgsql
34 /// <summary>
35 /// Represents information about COPY operation data transfer format as returned by server.
36 /// </summary>
37 public sealed class NpgsqlCopyFormat
39 private readonly byte _copyFormat;
40 private readonly Int16[] _copyFieldFormats;
42 /// <summary>
43 /// Only created when a CopyInResponse or CopyOutResponse is received by NpgsqlState.ProcessBackendResponses()
44 /// </summary>
45 internal NpgsqlCopyFormat(byte copyFormat, Int16[] fieldFormats)
47 _copyFormat = copyFormat;
48 _copyFieldFormats = fieldFormats;
51 /// <summary>
52 /// Returns true if this operation is currently active and in binary format.
53 /// </summary>
54 public bool IsBinary
56 get { return _copyFormat != 0; }
59 /// <summary>
60 /// Returns true if this operation is currently active and field at given location is in binary format.
61 /// </summary>
62 public bool FieldIsBinary(int fieldNumber)
64 return _copyFieldFormats[fieldNumber] != 0;
67 /// <summary>
68 /// Returns number of fields if this operation is currently active, otherwise -1
69 /// </summary>
70 public int FieldCount
72 get { return _copyFieldFormats.Length; }