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;
21 using System.Security;
23 namespace FirebirdSql.Data.Embedded
25 [SuppressUnmanagedCodeSecurity]
26 internal sealed class FbClient
28 #region Conditional directives
32 public const string DllPath = "libfbclient";
34 public const string DllPath = "libgds";
36 public const string DllPath = "libfirebird32";
38 public const string DllPath = "fyracle";
40 public const string DllPath = "libfbembed";
44 public const string DllPath = "fbclient";
46 public const string DllPath = "gds32";
48 public const string DllPath = "firebird32";
50 public const string DllPath = "fyracle";
52 public const string DllPath = "fbembed";
66 #region Array Functions
68 [DllImport(FbClient.DllPath)]
69 public static extern int isc_array_get_slice(
70 [In, Out] int[] statusVector,
78 [DllImport(FbClient.DllPath)]
79 public static extern int isc_array_put_slice(
80 [In, Out] int[] statusVector,
89 [DllImport(FbClient.DllPath)]
90 public static extern int isc_array_get_slice(
91 [In, Out] int[] statusVector,
99 [DllImport(FbClient.DllPath)]
100 public static extern int isc_array_lookup_bounds(
101 [In, Out] int[] statusVector,
108 [DllImport(FbClient.DllPath)]
109 public static extern int isc_array_lookup_desc(
110 [In, Out] int[] statusVector,
119 #region Blob functions
121 [DllImport(FbClient.DllPath)]
122 public static extern int isc_create_blob2(
123 [In, Out] int[] statusVector,
131 [DllImport(FbClient.DllPath)]
132 public static extern int isc_open_blob2(
133 [In, Out] int[] statusVector,
141 [DllImport(FbClient.DllPath)]
142 public static extern int isc_get_segment(
143 [In, Out] int[] statusVector,
145 ref short actualSegLength,
146 short segBufferLength,
149 [DllImport(FbClient.DllPath)]
150 public static extern int isc_put_segment(
151 [In, Out] int[] statusVector,
153 short segBufferLength,
156 [DllImport(FbClient.DllPath)]
157 public static extern int isc_cancel_blob(
158 [In, Out] int[] statusVector,
161 [DllImport(FbClient.DllPath)]
162 public static extern int isc_close_blob(
163 [In, Out] int[] statusVector,
167 [DllImport(FbClient.DllPath)]
168 public static extern int isc_blob_info(
169 [In, Out] int[] statusVector,
171 short itemListBufferLength,
172 byte[] itemListBuffer,
173 short resultBufferLength,
174 byte[] resultBuffer);
179 #region Database functions
181 [DllImport(FbClient.DllPath)]
182 public static extern int isc_attach_database(
183 [In, Out] int[] statusVector,
187 short parmBufferLength,
190 [DllImport(FbClient.DllPath)]
191 public static extern int isc_detach_database(
192 [In, Out] int[] statusVector,
195 [DllImport(FbClient.DllPath)]
196 public static extern int isc_database_info(
197 [In, Out] int[] statusVector,
199 short itemListBufferLength,
200 byte[] itemListBuffer,
201 short resultBufferLength,
202 byte[] resultBuffer);
204 [DllImport(FbClient.DllPath)]
205 public static extern int isc_create_database(
206 [In, Out] int[] statusVector,
210 short parmBufferLength,
214 [DllImport(FbClient.DllPath)]
215 public static extern int isc_drop_database(
216 [In, Out] int[] statusVector,
221 #region Events functions
224 [DllImport(FbClient.DllPath)]
225 public static extern int isc_event_block(
226 ref byte[] event_buffer,
227 ref byte[] result_buffer,
231 [DllImport(FbClient.DllPath)]
232 public static extern void isc_event_counts(
233 [In, Out] int[] statusVector,
236 byte[] resultBuffer);
238 [DllImport(FbClient.DllPath)]
239 public static extern int isc_que_events(
240 [In, Out] int[] statusVector,
245 IntPtr eventFunction,
246 IntPtr eventFunctionArg);
248 [DllImport(FbClient.DllPath)]
249 public static extern int isc_cancel_events(
250 [In, Out] int[] statusVector,
254 [DllImport(FbClient.DllPath)]
255 public static extern int isc_wait_for_event(
256 [In, Out] int[] statusVector,
260 byte[] resultBuffer);
265 #region Transaction functions
267 [DllImport(FbClient.DllPath)]
268 public static extern int isc_start_multiple(
269 [In, Out] int[] statusVector,
272 IntPtr tebVectorAddress);
274 [DllImport(FbClient.DllPath)]
275 public static extern int isc_commit_transaction(
276 [In, Out] int[] statusVector,
279 [DllImport(FbClient.DllPath)]
280 public static extern int isc_commit_retaining(
281 [In, Out] int[] statusVector,
284 [DllImport(FbClient.DllPath)]
285 public static extern int isc_rollback_transaction(
286 [In, Out] int[] statusVector,
289 [DllImport(FbClient.DllPath)]
290 public static extern int isc_rollback_retaining(
291 [In, Out] int[] statusVector,
295 [DllImport(FbClient.DllPath)]
296 public static extern int isc_start_transaction(
297 [In, Out] int[] statusVector,
304 [DllImport(FbClient.DllPath)]
305 public static extern int isc_prepare_transaction(
306 [In, Out] int[] statusVector,
309 [DllImport(FbClient.DllPath)]
310 public static extern int isc_prepare_transaction2(
311 [In, Out] int[] statusVector,
319 #region DSQL functions
321 [DllImport(FbClient.DllPath)]
322 public static extern int isc_dsql_allocate_statement(
323 [In, Out] int[] statusVector,
327 [DllImport(FbClient.DllPath)]
328 public static extern int isc_dsql_describe(
329 [In, Out] int[] statusVector,
334 [DllImport(FbClient.DllPath)]
335 public static extern int isc_dsql_describe_bind(
336 [In, Out] int[] statusVector,
341 [DllImport(FbClient.DllPath)]
342 public static extern int isc_dsql_prepare(
343 [In, Out] int[] statusVector,
351 [DllImport(FbClient.DllPath)]
352 public static extern int isc_dsql_execute(
353 [In, Out] int[] statusVector,
359 [DllImport(FbClient.DllPath)]
360 public static extern int isc_dsql_execute2(
361 [In, Out] int[] statusVector,
368 [DllImport(FbClient.DllPath)]
369 public static extern int isc_dsql_fetch(
370 [In, Out] int[] statusVector,
375 [DllImport(FbClient.DllPath)]
376 public static extern int isc_dsql_free_statement(
377 [In, Out] int[] statusVector,
381 [DllImport(FbClient.DllPath)]
382 public static extern int isc_dsql_sql_info(
383 [In, Out] int[] statusVector,
390 [DllImport(FbClient.DllPath)]
391 public static extern int isc_vax_integer(
396 [DllImport(FbClient.DllPath)]
397 public static extern int isc_dsql_execute_immediate(
398 [In, Out] int[] statusVector,
406 [DllImport(FbClient.DllPath)]
407 public static extern int isc_dsql_exec_immed2(
408 [In, Out] int[] statusVector,
417 [DllImport(FbClient.DllPath)]
418 public static extern int isc_dsql_set_cursor_name(
419 [In, Out] int[] statusVector,
427 #region Services functions
429 [DllImport(FbClient.DllPath)]
430 public static extern int isc_service_attach(
431 [In, Out] int[] statusVector,
438 [DllImport(FbClient.DllPath)]
439 public static extern int isc_service_start(
440 [In, Out] int[] statusVector,
446 [DllImport(FbClient.DllPath)]
447 public static extern int isc_service_detach(
448 [In, Out] int[] statusVector,
451 [DllImport(FbClient.DllPath)]
452 public static extern int isc_service_query(
453 [In, Out] int[] statusVector,
458 short requestSpbLength,
465 #region Error handling
468 [DllImport(FbClient.DllPath)]
469 public static extern int isc_interprete(
471 ref int[] statusVector);
473 [DllImport(FbClient.DllPath)]
474 public static extern int isc_sqlcode(ref int[] statusVector);