2 * Firebird ADO.NET Data provider for .NET and Mono
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
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.
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16 * All Rights Reserved.
20 using System.Runtime.InteropServices;
22 using FirebirdSql.Data.Common;
24 namespace FirebirdSql.Data.Embedded
26 internal sealed class FesConnection
30 private FesConnection()
36 #region Static Methods
38 public static int[] GetNewStatusVector()
40 return new int[IscCodes.ISC_STATUS_LENGTH];
43 public static IscException ParseStatusVector(int[] statusVector)
45 IscException exception = null;
48 for (int i = 0; i < statusVector.Length; )
50 int arg = statusVector[i++];
54 case IscCodes.isc_arg_gds:
55 int er = statusVector[i++];
58 if (exception == null)
60 exception = new IscException();
62 exception.Errors.Add(arg, er);
66 case IscCodes.isc_arg_end:
67 if (exception != null && exception.Errors.Count != 0)
69 exception.BuildExceptionMessage();
74 case IscCodes.isc_arg_interpreted:
75 case IscCodes.isc_arg_string:
77 IntPtr ptr = new IntPtr(statusVector[i++]);
78 string arg_value = Marshal.PtrToStringAnsi(ptr);
79 exception.Errors.Add(arg, arg_value);
83 case IscCodes.isc_arg_cstring:
87 IntPtr ptr = new IntPtr(statusVector[i++]);
88 string arg_value = Marshal.PtrToStringAnsi(ptr);
89 exception.Errors.Add(arg, arg_value);
93 case IscCodes.isc_arg_win32:
94 case IscCodes.isc_arg_number:
95 exception.Errors.Add(arg, statusVector[i++]);
100 int e = statusVector[i++];
103 if (exception == null)
105 exception = new IscException();
107 exception.Errors.Add(arg, e);