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.
21 using FirebirdSql.Data.Common;
23 namespace FirebirdSql.Data.Embedded
25 internal sealed class FesServiceManager : IServiceManager
37 get { return this.handle; }
40 public bool IsLittleEndian
42 get { return BitConverter.IsLittleEndian; }
49 public FesServiceManager()
57 public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
59 int[] statusVector = FesConnection.GetNewStatusVector();
60 int svcHandle = this.Handle;
62 FbClient.isc_service_attach(
64 (short)service.Length,
70 // Parse status vector
71 this.ParseStatusVector(statusVector);
73 // Update status vector
74 this.handle = svcHandle;
79 int[] statusVector = FesConnection.GetNewStatusVector();
80 int svcHandle = this.Handle;
82 FbClient.isc_service_detach(statusVector, ref svcHandle);
84 // Parse status vector
85 this.ParseStatusVector(statusVector);
87 // Update status vector
88 this.handle = svcHandle;
91 public void Start(ServiceParameterBuffer spb)
93 int[] statusVector = FesConnection.GetNewStatusVector();
94 int svcHandle = this.Handle;
97 FbClient.isc_service_start(
104 // Parse status vector
105 this.ParseStatusVector(statusVector);
109 ServiceParameterBuffer spb,
111 byte[] requestBuffer,
115 int[] statusVector = FesConnection.GetNewStatusVector();
116 int svcHandle = this.Handle;
119 FbClient.isc_service_query(
125 (short)requestLength,
127 (short)buffer.Length,
130 // Parse status vector
131 this.ParseStatusVector(statusVector);
136 #region Buffer Creation methods
138 public ServiceParameterBuffer CreateParameterBuffer()
140 return new ServiceParameterBuffer();
145 #region Private Methods
147 private void ParseStatusVector(int[] statusVector)
149 IscException ex = FesConnection.ParseStatusVector(statusVector);
151 if (ex != null && !ex.IsWarning)