1 |
{************************************************************************}
|
2 |
{ }
|
3 |
{ Borland Delphi Visual Component Library }
|
4 |
{ InterBase Express core components }
|
5 |
{ }
|
6 |
{ Copyright (c) 1998-2000 Inprise Corporation }
|
7 |
{ }
|
8 |
{ InterBase Express is based in part on the product }
|
9 |
{ Free IB Components, written by Gregory H. Deatz for }
|
10 |
{ Hoagland, Longo, Moran, Dunst & Doukas Company. }
|
11 |
{ Free IB Components is used under license. }
|
12 |
{ }
|
13 |
{ The contents of this file are subject to the InterBase }
|
14 |
{ Public License Version 1.0 (the "License"); you may not }
|
15 |
{ use this file except in compliance with the License. You }
|
16 |
{ may obtain a copy of the License at http://www.Inprise.com/IPL.html }
|
17 |
{ Software distributed under the License is distributed on }
|
18 |
{ an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either }
|
19 |
{ express or implied. See the License for the specific language }
|
20 |
{ governing rights and limitations under the License. }
|
21 |
{ The Original Code was created by InterBase Software Corporation }
|
22 |
{ and its successors. }
|
23 |
{ Portions created by Inprise Corporation are Copyright (C) Inprise }
|
24 |
{ Corporation. All Rights Reserved. }
|
25 |
{ Contributor(s): Jeff Overcash }
|
26 |
{ }
|
27 |
{ IBX For Lazarus (Firebird Express) }
|
28 |
{ Contributor: Tony Whyman, MWA Software http://www.mwasoftware.co.uk }
|
29 |
{ Portions created by MWA Software are copyright McCallum Whyman }
|
30 |
{ Associates Ltd 2011 }
|
31 |
{ }
|
32 |
{************************************************************************}
|
33 |
|
34 |
unit IBIntf;
|
35 |
|
36 |
{$Mode Delphi}
|
37 |
|
38 |
{$IF FPC_FULLVERSION >= 20700 }
|
39 |
{$codepage UTF8}
|
40 |
{$ENDIF}
|
41 |
|
42 |
interface
|
43 |
|
44 |
uses
|
45 |
{$IFDEF WINDOWS }
|
46 |
Windows,
|
47 |
{$ELSE}
|
48 |
unix,
|
49 |
{$ENDIF}
|
50 |
IBHeader,IBExternals;
|
51 |
|
52 |
var
|
53 |
BLOB_get: TBLOB_get;
|
54 |
BLOB_put: TBLOB_put;
|
55 |
isc_sqlcode: Tisc_sqlcode;
|
56 |
isc_sql_interprete: Tisc_sql_interprete;
|
57 |
isc_interprete: Tisc_interprete;
|
58 |
isc_vax_integer: Tisc_vax_integer;
|
59 |
isc_portable_integer: Tisc_portable_integer;
|
60 |
isc_blob_info: Tisc_blob_info;
|
61 |
isc_blob_lookup_desc: Tisc_blob_lookup_desc;
|
62 |
isc_open_blob2: Tisc_open_blob2;
|
63 |
isc_close_blob: Tisc_close_blob;
|
64 |
isc_get_segment: Tisc_get_segment;
|
65 |
isc_put_segment: Tisc_put_segment;
|
66 |
isc_create_blob2: Tisc_create_blob2;
|
67 |
isc_service_attach: Tisc_service_attach;
|
68 |
isc_service_detach: Tisc_service_detach;
|
69 |
isc_service_query: Tisc_service_query;
|
70 |
isc_service_start: Tisc_service_start;
|
71 |
isc_decode_date: Tisc_decode_date;
|
72 |
isc_decode_sql_date: Tisc_decode_sql_date;
|
73 |
isc_decode_sql_time: Tisc_decode_sql_time;
|
74 |
isc_decode_timestamp: Tisc_decode_timestamp;
|
75 |
isc_encode_date: Tisc_encode_date;
|
76 |
isc_encode_sql_date: Tisc_encode_sql_date;
|
77 |
isc_encode_sql_time: Tisc_encode_sql_time;
|
78 |
isc_encode_timestamp: Tisc_encode_timestamp;
|
79 |
isc_dsql_free_statement: Tisc_dsql_free_statement;
|
80 |
isc_dsql_execute2: Tisc_dsql_execute2;
|
81 |
isc_dsql_execute: Tisc_dsql_execute;
|
82 |
isc_dsql_set_cursor_name: Tisc_dsql_set_cursor_name;
|
83 |
isc_dsql_fetch: Tisc_dsql_fetch;
|
84 |
isc_dsql_sql_info: Tisc_dsql_sql_info;
|
85 |
isc_dsql_alloc_statement2: Tisc_dsql_alloc_statement2;
|
86 |
isc_dsql_prepare: Tisc_dsql_prepare;
|
87 |
isc_dsql_describe_bind: Tisc_dsql_describe_bind;
|
88 |
isc_dsql_describe: Tisc_dsql_describe;
|
89 |
isc_dsql_execute_immediate: Tisc_dsql_execute_immediate;
|
90 |
isc_drop_database: Tisc_drop_database;
|
91 |
isc_detach_database: Tisc_detach_database;
|
92 |
isc_attach_database: Tisc_attach_database;
|
93 |
isc_database_info: Tisc_database_info;
|
94 |
isc_start_multiple: Tisc_start_multiple;
|
95 |
isc_commit_transaction: Tisc_commit_transaction;
|
96 |
isc_commit_retaining: Tisc_commit_retaining;
|
97 |
isc_rollback_transaction: Tisc_rollback_transaction;
|
98 |
isc_rollback_retaining: Tisc_rollback_retaining;
|
99 |
isc_cancel_events: Tisc_cancel_events;
|
100 |
isc_que_events: Tisc_que_events;
|
101 |
isc_event_counts: Tisc_event_counts;
|
102 |
isc_event_block: Tisc_event_block;
|
103 |
isc_free: Tisc_free;
|
104 |
isc_add_user : Tisc_add_user;
|
105 |
isc_delete_user: Tisc_delete_user;
|
106 |
isc_modify_user: Tisc_modify_user;
|
107 |
|
108 |
FBLibraryName: string;
|
109 |
|
110 |
|
111 |
{ Library Initialization }
|
112 |
procedure LoadIBLibrary;
|
113 |
procedure FreeIBLibrary;
|
114 |
function TryIBLoad: Boolean;
|
115 |
procedure CheckIBLoaded;
|
116 |
|
117 |
{Utility}
|
118 |
function IsEmbeddedServer: boolean;
|
119 |
|
120 |
{ Stubs for 6.0 only functions }
|
121 |
function isc_rollback_retaining_stub(status_vector : PISC_STATUS;
|
122 |
tran_handle : PISC_TR_HANDLE):
|
123 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
124 |
function isc_service_attach_stub(status_vector : PISC_STATUS;
|
125 |
isc_arg2 : UShort;
|
126 |
isc_arg3 : PChar;
|
127 |
service_handle : PISC_SVC_HANDLE;
|
128 |
isc_arg5 : UShort;
|
129 |
isc_arg6 : PChar):
|
130 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
131 |
function isc_service_detach_stub(status_vector : PISC_STATUS;
|
132 |
service_handle : PISC_SVC_HANDLE):
|
133 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
134 |
function isc_service_query_stub(status_vector : PISC_STATUS;
|
135 |
service_handle : PISC_SVC_HANDLE;
|
136 |
recv_handle : PISC_SVC_HANDLE;
|
137 |
isc_arg4 : UShort;
|
138 |
isc_arg5 : PChar;
|
139 |
isc_arg6 : UShort;
|
140 |
isc_arg7 : PChar;
|
141 |
isc_arg8 : UShort;
|
142 |
isc_arg9 : PChar):
|
143 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
144 |
function isc_service_start_stub(status_vector : PISC_STATUS;
|
145 |
service_handle : PISC_SVC_HANDLE;
|
146 |
recv_handle : PISC_SVC_HANDLE;
|
147 |
isc_arg4 : UShort;
|
148 |
isc_arg5 : PChar):
|
149 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
150 |
|
151 |
procedure isc_encode_sql_date_stub(tm_date : PCTimeStructure;
|
152 |
ib_date : PISC_DATE);
|
153 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
154 |
|
155 |
procedure isc_encode_sql_time_stub(tm_date : PCTimeStructure;
|
156 |
ib_time : PISC_TIME);
|
157 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
158 |
|
159 |
procedure isc_encode_timestamp_stub(tm_date : PCTimeStructure;
|
160 |
ib_timestamp : PISC_TIMESTAMP);
|
161 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
162 |
|
163 |
procedure isc_decode_sql_date_stub(ib_date : PISC_DATE;
|
164 |
tm_date : PCTimeStructure);
|
165 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
166 |
|
167 |
procedure isc_decode_sql_time_stub(ib_time : PISC_TIME;
|
168 |
tm_date : PCTimeStructure);
|
169 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
170 |
|
171 |
procedure isc_decode_timestamp_stub(ib_timestamp : PISC_TIMESTAMP;
|
172 |
tm_date : PCTimeStructure);
|
173 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
174 |
|
175 |
|
176 |
var IBServiceAPIPresent: boolean;
|
177 |
|
178 |
type
|
179 |
TOnGetLibraryName = procedure(var libname: string);
|
180 |
|
181 |
const
|
182 |
OnGetLibraryName: TOnGetLibraryName = nil;
|
183 |
|
184 |
|
185 |
implementation
|
186 |
|
187 |
uses Sysutils, IB, Dynlibs, Classes
|
188 |
{$IFDEF WINDOWS}
|
189 |
, Registry, WinDirs
|
190 |
{$ENDIF}
|
191 |
;
|
192 |
|
193 |
var
|
194 |
IBLibrary: TLibHandle;
|
195 |
|
196 |
procedure LoadIBLibrary;
|
197 |
|
198 |
function GetProcAddr(ProcName: PChar): Pointer;
|
199 |
begin
|
200 |
Result := GetProcAddress(IBLibrary, ProcName);
|
201 |
if not Assigned(Result) then
|
202 |
raise Exception.Create('Unable to load Firebird Client Library');
|
203 |
end;
|
204 |
{$IFDEF UNIX }
|
205 |
function FindLibrary(LibNameList: string): TLibHandle;
|
206 |
var LibNames: TStringList;
|
207 |
i: integer;
|
208 |
begin
|
209 |
Result := NilHandle;
|
210 |
LibNames := TStringList.Create;
|
211 |
try
|
212 |
LibNames.Delimiter := ':';
|
213 |
LibNames.StrictDelimiter := true;
|
214 |
LibNames.DelimitedText := LibNameList; {Split list on semi-colon}
|
215 |
for i := 0 to LibNames.Count - 1 do
|
216 |
begin
|
217 |
Result := LoadLibrary(LibNames[i]);
|
218 |
if Result <> NilHandle then
|
219 |
begin
|
220 |
FBLibraryName := LibNames[i];
|
221 |
Exit;
|
222 |
end;
|
223 |
end;
|
224 |
finally
|
225 |
LibNames.Free;
|
226 |
end;
|
227 |
end;
|
228 |
|
229 |
function InternalLoadLibrary: TLibHandle;
|
230 |
var LibName: string;
|
231 |
begin
|
232 |
//Use default unless FBLIB overrides
|
233 |
LibName := GetEnvironmentVariable('FBLIB');
|
234 |
if LibName = '' then
|
235 |
begin
|
236 |
if assigned(OnGetLibraryName) then
|
237 |
OnGetLibraryName(LibName)
|
238 |
else
|
239 |
LibName := FIREBIRD_SO2;
|
240 |
end;
|
241 |
Result := FindLibrary(LibName);
|
242 |
{$IFDEF DARWIN}
|
243 |
if Result = NilHandle then
|
244 |
begin
|
245 |
{See http://paulbeachsblog.blogspot.co.uk/2008/03/where-is-libfbclientdylib-on-macosx.html
|
246 |
Try loading direct from Firebird Framework}
|
247 |
|
248 |
LibName := '/Library/Frameworks/Firebird.framework/Firebird';
|
249 |
Result := LoadLibrary(LibName);
|
250 |
if Result = NilHandle then
|
251 |
begin
|
252 |
LibName := '/Library/Frameworks/Firebird.framework/Libraries/libfbclient.dylib';
|
253 |
Result := LoadLibrary(LibName);
|
254 |
end;
|
255 |
if Result <> NilHandle then
|
256 |
FBLibraryName := ExtractFileName(LibName);
|
257 |
end
|
258 |
{$ENDIF}
|
259 |
end;
|
260 |
{$ENDIF}
|
261 |
{$IFDEF WINDOWS}
|
262 |
function DoLoadLibrary(LibName: string): TLibHandle;
|
263 |
begin
|
264 |
Result := LoadLibrary(LibName);
|
265 |
if Result <> NilHandle then
|
266 |
FBLibraryName := ExtractFileName(LibName);
|
267 |
end;
|
268 |
|
269 |
function InternalLoadLibrary: TLibHandle;
|
270 |
var InstallDir: string;
|
271 |
dllPathName: string;
|
272 |
begin
|
273 |
Result := NilHandle;
|
274 |
{If OnGetLibraryName given then use this}
|
275 |
if assigned(OnGetLibraryName) then
|
276 |
begin
|
277 |
OnGetLibraryName(dllPathName);
|
278 |
Result := DoLoadLibrary(dllPathName);
|
279 |
Exit
|
280 |
end;
|
281 |
|
282 |
{Then look in application installation directory}
|
283 |
InstallDir := ExtractFilePath(Paramstr(0)); {Using ParamStr(0) assumes windows conventions}
|
284 |
|
285 |
//First look for Firebird Embedded Server in installation dir
|
286 |
if FileExists(InstallDir + FIREBIRD_EMBEDDED) then
|
287 |
begin
|
288 |
dllPathName := InstallDir + FIREBIRD_EMBEDDED;
|
289 |
Result := DoLoadLibrary(dllPathName)
|
290 |
end
|
291 |
else
|
292 |
//Otherwise look for Firebird Client in installation dir
|
293 |
if FileExists(InstallDir + FIREBIRD_CLIENT) then
|
294 |
begin
|
295 |
//assume firebird.conf and firebird.msg in same dir
|
296 |
SetEnvironmentVariable('FIREBIRD',PChar(InstallDir));
|
297 |
dllPathName := InstallDir +FIREBIRD_CLIENT;
|
298 |
Result := DoLoadLibrary(dllPathName)
|
299 |
end;
|
300 |
|
301 |
{If FIREBIRD environment variable available then try this}
|
302 |
if Result = NilHandle then
|
303 |
begin
|
304 |
InstallDir := GetEnvironmentVariable('FIREBIRD');
|
305 |
if (InstallDir <> '') and FileExists(InstallDir + FIREBIRD_CLIENT) then
|
306 |
begin
|
307 |
//assume firebird.conf and firebird.msg in same dir
|
308 |
dllPathName := InstallDir + FIREBIRD_CLIENT;
|
309 |
Result := DoLoadLibrary(dllPathName)
|
310 |
end
|
311 |
else
|
312 |
if (InstallDir <> '') and FileExists(InstallDir + 'bin' + DirectorySeparator + FIREBIRD_CLIENT) then
|
313 |
begin
|
314 |
dllPathName := InstallDir + FIREBIRD_CLIENT;
|
315 |
Result := DoLoadLibrary(dllPathName)
|
316 |
end
|
317 |
end;
|
318 |
|
319 |
if Result = NilHandle then
|
320 |
{Use Registry key if it exists to locate library}
|
321 |
begin
|
322 |
with TRegistry.Create do
|
323 |
try
|
324 |
RootKey := HKEY_LOCAL_MACHINE;
|
325 |
if OpenKey('SOFTWARE\Firebird Project\Firebird Server\Instances',false) then
|
326 |
begin
|
327 |
if ValueExists('DefaultInstance') then
|
328 |
begin
|
329 |
InstallDir := ReadString('DefaultInstance') + 'bin' + DirectorySeparator ;
|
330 |
dllPathName := InstallDir + FIREBIRD_CLIENT;
|
331 |
Result := DoLoadLibrary(dllPathName)
|
332 |
end
|
333 |
end
|
334 |
finally
|
335 |
Free
|
336 |
end;
|
337 |
|
338 |
{Now try default install dir}
|
339 |
if Result = NilHandle then
|
340 |
begin
|
341 |
InstallDir := GetWindowsSpecialDir(CSIDL_PROGRAM_FILES) +
|
342 |
DirectorySeparator + 'Firebird' +
|
343 |
DirectorySeparator + 'Firebird_2_5' +
|
344 |
DirectorySeparator + 'bin' + DirectorySeparator;
|
345 |
dllPathName := InstallDir + FIREBIRD_CLIENT;
|
346 |
Result := DoLoadLibrary(dllPathName)
|
347 |
end;
|
348 |
|
349 |
//Otherwise see if Firebird client is in path
|
350 |
//and rely on registry for location of firebird.conf and firebird.msg
|
351 |
if Result = NilHandle then
|
352 |
begin
|
353 |
Result := DoLoadLibrary(FIREBIRD_CLIENT);
|
354 |
if Result <= HINSTANCE_ERROR then
|
355 |
//well maybe InterBase is present...
|
356 |
Result := DoLoadLibrary(IBASE_DLL);
|
357 |
end;
|
358 |
end
|
359 |
end;
|
360 |
{$ENDIF}
|
361 |
|
362 |
begin
|
363 |
IBLibrary := InternalLoadLibrary;
|
364 |
if (IBLibrary <> NilHandle) then
|
365 |
begin
|
366 |
BLOB_get := GetProcAddr('BLOB_get'); {do not localize}
|
367 |
BLOB_put := GetProcAddr('BLOB_put'); {do not localize}
|
368 |
isc_sqlcode := GetProcAddr('isc_sqlcode'); {do not localize}
|
369 |
isc_sql_interprete := GetProcAddr('isc_sql_interprete'); {do not localize}
|
370 |
isc_interprete := GetProcAddr('isc_interprete'); {do not localize}
|
371 |
isc_vax_integer := GetProcAddr('isc_vax_integer'); {do not localize}
|
372 |
isc_portable_integer := GetProcAddr('isc_portable_integer'); {do not localize}
|
373 |
isc_blob_info := GetProcAddr('isc_blob_info'); {do not localize}
|
374 |
isc_blob_lookup_desc := GetProcAddr('isc_blob_lookup_desc'); {do not localize}
|
375 |
isc_open_blob2 := GetProcAddr('isc_open_blob2'); {do not localize}
|
376 |
isc_close_blob := GetProcAddr('isc_close_blob'); {do not localize}
|
377 |
isc_get_segment := GetProcAddr('isc_get_segment'); {do not localize}
|
378 |
isc_put_segment := GetProcAddr('isc_put_segment'); {do not localize}
|
379 |
isc_create_blob2 := GetProcAddr('isc_create_blob2'); {do not localize}
|
380 |
isc_decode_date := GetProcAddr('isc_decode_date'); {do not localize}
|
381 |
isc_encode_date := GetProcAddr('isc_encode_date'); {do not localize}
|
382 |
isc_dsql_free_statement := GetProcAddr('isc_dsql_free_statement'); {do not localize}
|
383 |
isc_dsql_execute2 := GetProcAddr('isc_dsql_execute2'); {do not localize}
|
384 |
isc_dsql_execute := GetProcAddr('isc_dsql_execute'); {do not localize}
|
385 |
isc_dsql_set_cursor_name := GetProcAddr('isc_dsql_set_cursor_name'); {do not localize}
|
386 |
isc_dsql_fetch := GetProcAddr('isc_dsql_fetch'); {do not localize}
|
387 |
isc_dsql_sql_info := GetProcAddr('isc_dsql_sql_info'); {do not localize}
|
388 |
isc_dsql_alloc_statement2 := GetProcAddr('isc_dsql_alloc_statement2'); {do not localize}
|
389 |
isc_dsql_prepare := GetProcAddr('isc_dsql_prepare'); {do not localize}
|
390 |
isc_dsql_describe_bind := GetProcAddr('isc_dsql_describe_bind'); {do not localize}
|
391 |
isc_dsql_describe := GetProcAddr('isc_dsql_describe'); {do not localize}
|
392 |
isc_dsql_execute_immediate := GetProcAddr('isc_dsql_execute_immediate'); {do not localize}
|
393 |
isc_drop_database := GetProcAddr('isc_drop_database'); {do not localize}
|
394 |
isc_detach_database := GetProcAddr('isc_detach_database'); {do not localize}
|
395 |
isc_attach_database := GetProcAddr('isc_attach_database'); {do not localize}
|
396 |
isc_database_info := GetProcAddr('isc_database_info'); {do not localize}
|
397 |
isc_start_multiple := GetProcAddr('isc_start_multiple'); {do not localize}
|
398 |
isc_commit_transaction := GetProcAddr('isc_commit_transaction'); {do not localize}
|
399 |
isc_commit_retaining := GetProcAddr('isc_commit_retaining'); {do not localize}
|
400 |
isc_rollback_transaction := GetProcAddr('isc_rollback_transaction'); {do not localize}
|
401 |
isc_cancel_events := GetProcAddr('isc_cancel_events'); {do not localize}
|
402 |
isc_que_events := GetProcAddr('isc_que_events'); {do not localize}
|
403 |
isc_event_counts := GetProcAddr('isc_event_counts'); {do not localize}
|
404 |
isc_event_block := GetProcAddr('isc_event_block'); {do not localize}
|
405 |
isc_free := GetProcAddr('isc_free'); {do not localize}
|
406 |
isc_add_user := GetProcAddr('isc_add_user'); {do not localize}
|
407 |
isc_delete_user := GetProcAddr('isc_delete_user'); {do not localize}
|
408 |
isc_modify_user := GetProcAddr('isc_modify_user'); {do not localize}
|
409 |
|
410 |
IBServiceAPIPresent := true;
|
411 |
isc_rollback_retaining := GetProcAddress(IBLibrary, 'isc_rollback_retaining'); {do not localize}
|
412 |
if Assigned(isc_rollback_retaining) then
|
413 |
begin
|
414 |
isc_service_attach := GetProcAddr('isc_service_attach'); {do not localize}
|
415 |
isc_service_detach := GetProcAddr('isc_service_detach'); {do not localize}
|
416 |
isc_service_query := GetProcAddr('isc_service_query'); {do not localize}
|
417 |
isc_service_start := GetProcAddr('isc_service_start'); {do not localize}
|
418 |
isc_decode_sql_date := GetProcAddr('isc_decode_sql_date'); {do not localize}
|
419 |
isc_decode_sql_time := GetProcAddr('isc_decode_sql_time'); {do not localize}
|
420 |
isc_decode_timestamp := GetProcAddr('isc_decode_timestamp'); {do not localize}
|
421 |
isc_encode_sql_date := GetProcAddr('isc_encode_sql_date'); {do not localize}
|
422 |
isc_encode_sql_time := GetProcAddr('isc_encode_sql_time'); {do not localize}
|
423 |
isc_encode_timestamp := GetProcAddr('isc_encode_timestamp'); {do not localize}
|
424 |
end else
|
425 |
begin
|
426 |
IBServiceAPIPresent := false;
|
427 |
isc_rollback_retaining := isc_rollback_retaining_stub;
|
428 |
isc_service_attach := isc_service_attach_stub;
|
429 |
isc_service_detach := isc_service_detach_stub;
|
430 |
isc_service_query := isc_service_query_stub;
|
431 |
isc_service_start := isc_service_start_stub;
|
432 |
isc_decode_sql_date := isc_decode_sql_date_stub;
|
433 |
isc_decode_sql_time := isc_decode_sql_time_stub;
|
434 |
isc_decode_timestamp := isc_decode_timestamp_stub;
|
435 |
isc_encode_sql_date := isc_encode_sql_date_stub;
|
436 |
isc_encode_sql_time := isc_encode_sql_time_stub;
|
437 |
isc_encode_timestamp := isc_encode_timestamp_stub;
|
438 |
end;
|
439 |
end;
|
440 |
end;
|
441 |
|
442 |
procedure FreeIBLibrary;
|
443 |
begin
|
444 |
if IBLibrary <> NilHandle then
|
445 |
begin
|
446 |
FreeLibrary(IBLibrary);
|
447 |
IBLibrary := 0;
|
448 |
end;
|
449 |
end;
|
450 |
|
451 |
function TryIBLoad: Boolean;
|
452 |
begin
|
453 |
if (IBLibrary = NilHandle) then
|
454 |
LoadIBLibrary;
|
455 |
if (IBLibrary = NilHandle) then
|
456 |
result := False
|
457 |
else
|
458 |
result := True;
|
459 |
end;
|
460 |
|
461 |
procedure CheckIBLoaded;
|
462 |
begin
|
463 |
if not TryIBLoad then
|
464 |
IBError(ibxeInterBaseMissing, [nil]);
|
465 |
end;
|
466 |
|
467 |
function IsEmbeddedServer: boolean;
|
468 |
begin
|
469 |
Result := false;
|
470 |
{$IFDEF UNIX}
|
471 |
Result := Pos('libfbembed',FBLibraryName) = 1;
|
472 |
{$ENDIF}
|
473 |
{$IFDEF WINDOWS}
|
474 |
Result := CompareText(FBLibraryName,FIREBIRD_EMBEDDED) = 0
|
475 |
{$ENDIF}
|
476 |
end;
|
477 |
|
478 |
function isc_rollback_retaining_stub(status_vector : PISC_STATUS;
|
479 |
tran_handle : PISC_TR_HANDLE):
|
480 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
481 |
begin
|
482 |
Result := 0;
|
483 |
IBError(ibxeIB60feature, ['isc_rollback_retaining']); {do not localize}
|
484 |
end;
|
485 |
|
486 |
function isc_service_attach_stub(status_vector : PISC_STATUS;
|
487 |
isc_arg2 : UShort;
|
488 |
isc_arg3 : PChar;
|
489 |
service_handle : PISC_SVC_HANDLE;
|
490 |
isc_arg5 : UShort;
|
491 |
isc_arg6 : PChar):
|
492 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
493 |
begin
|
494 |
Result := 0;
|
495 |
IBError(ibxeIB60feature, ['isc_service_attach']); {do not localize}
|
496 |
end;
|
497 |
|
498 |
function isc_service_detach_stub(status_vector : PISC_STATUS;
|
499 |
service_handle : PISC_SVC_HANDLE):
|
500 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
501 |
begin
|
502 |
Result := 0;
|
503 |
IBError(ibxeIB60feature, ['isc_service_detach']); {do not localize}
|
504 |
end;
|
505 |
|
506 |
function isc_service_query_stub(status_vector : PISC_STATUS;
|
507 |
service_handle : PISC_SVC_HANDLE;
|
508 |
recv_handle : PISC_SVC_HANDLE;
|
509 |
isc_arg4 : UShort;
|
510 |
isc_arg5 : PChar;
|
511 |
isc_arg6 : UShort;
|
512 |
isc_arg7 : PChar;
|
513 |
isc_arg8 : UShort;
|
514 |
isc_arg9 : PChar):
|
515 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
516 |
begin
|
517 |
Result := 0;
|
518 |
IBError(ibxeIB60feature, ['isc_service_query']); {do not localize}
|
519 |
end;
|
520 |
|
521 |
function isc_service_start_stub(status_vector : PISC_STATUS;
|
522 |
service_handle : PISC_SVC_HANDLE;
|
523 |
recv_handle : PISC_SVC_HANDLE;
|
524 |
isc_arg4 : UShort;
|
525 |
isc_arg5 : PChar):
|
526 |
ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
527 |
begin
|
528 |
Result := 0;
|
529 |
IBError(ibxeIB60feature, ['isc_service_start']); {do not localize}
|
530 |
end;
|
531 |
|
532 |
procedure isc_encode_sql_date_stub(tm_date : PCTimeStructure;
|
533 |
ib_date : PISC_DATE);
|
534 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
535 |
begin
|
536 |
IBError(ibxeIB60feature, ['isc_encode_sql_date']); {do not localize}
|
537 |
end;
|
538 |
|
539 |
procedure isc_encode_sql_time_stub(tm_date : PCTimeStructure;
|
540 |
ib_time : PISC_TIME);
|
541 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
542 |
begin
|
543 |
IBError(ibxeIB60feature, ['isc_encode_sql_time']); {do not localize}
|
544 |
end;
|
545 |
|
546 |
procedure isc_encode_timestamp_stub(tm_date : PCTimeStructure;
|
547 |
ib_timestamp : PISC_TIMESTAMP);
|
548 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
549 |
begin
|
550 |
IBError(ibxeIB60feature, ['isc_encode_sql_timestamp']); {do not localize}
|
551 |
end;
|
552 |
|
553 |
procedure isc_decode_sql_date_stub(ib_date : PISC_DATE;
|
554 |
tm_date : PCTimeStructure);
|
555 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
556 |
begin
|
557 |
IBError(ibxeIB60feature, ['isc_decode_sql_date']); {do not localize}
|
558 |
end;
|
559 |
|
560 |
procedure isc_decode_sql_time_stub(ib_time : PISC_TIME;
|
561 |
tm_date : PCTimeStructure);
|
562 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
563 |
begin
|
564 |
IBError(ibxeIB60feature, ['isc_decode_sql_time']); {do not localize}
|
565 |
end;
|
566 |
|
567 |
procedure isc_decode_timestamp_stub(ib_timestamp : PISC_TIMESTAMP;
|
568 |
tm_date : PCTimeStructure);
|
569 |
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
|
570 |
begin
|
571 |
IBError(ibxeIB60feature, ['isc_decode_timestamp']); {do not localize}
|
572 |
end;
|
573 |
initialization
|
574 |
|
575 |
finalization
|
576 |
FreeIBLibrary;
|
577 |
end.
|