2009-05-27 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / FirebirdSql.Data.Embedded / ArrayDescMarshal.cs
1 /*
2  *      Firebird ADO.NET Data provider for .NET and Mono 
3  * 
4  *         The contents of this file are subject to the Initial 
5  *         Developer's Public License Version 1.0 (the "License"); 
6  *         you may not use this file except in compliance with the 
7  *         License. You may obtain a copy of the License at 
8  *         http://www.firebirdsql.org/index.php?op=doc&id=idpl
9  *
10  *         Software distributed under the License is distributed on 
11  *         an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
12  *         express or implied. See the License for the specific 
13  *         language governing rights and limitations under the License.
14  * 
15  *      Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16  *      All Rights Reserved.
17  */
18
19 using System;
20 using System.Runtime.InteropServices;
21
22 using FirebirdSql.Data.Common;
23
24 namespace FirebirdSql.Data.Embedded
25 {
26         #region Structures
27
28         [StructLayout(LayoutKind.Sequential)]
29         internal struct ArrayDescMarshal
30         {
31                 public byte DataType;
32                 public byte Scale;
33                 public short Length;
34                 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
35                 public string FieldName;
36                 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
37                 public string RelationName;
38                 public short Dimensions;
39                 public short Flags;
40
41                 #region Static Methods
42
43                 public static int ComputeLength(int n)
44                 {
45                         return (Marshal.SizeOf(typeof(ArrayDescMarshal)) + n * Marshal.SizeOf(typeof(ArrayBoundMarshal)));
46                 }
47
48                 #endregion
49         }
50
51         [StructLayout(LayoutKind.Sequential)]
52         internal struct ArrayBoundMarshal
53         {
54                 public short LowerBound;
55                 public short UpperBound;
56         }
57
58         #endregion
59 }