📄 ibintf.pas
字号:
isc_decode_timestamp := isc_decode_timestamp_stub;
isc_encode_sql_date := isc_encode_sql_date_stub;
isc_encode_sql_time := isc_encode_sql_time_stub;
isc_encode_timestamp := isc_encode_timestamp_stub;
end;
end;
end;
procedure FreeIBLibrary;
begin
{$IFDEF MSWINDOWS}
if IBLibrary > HINSTANCE_ERROR then
begin
FreeLibrary(IBLibrary);
IBLibrary := 0;
end;
{$ENDIF}
{$IFDEF LINUX}
// The Linux loader is freeing the IBLibrary by here. Freeing agina causes a
// segmentation fault on closing so let Linux clean up for us.
if IBCrypt <> nil then
begin
dlclose(IBCrypt);
IBCrypt := nil;
end;
{$ENDIF}
end;
procedure LoadIBInstallLibrary;
{$IFDEF MSWINDOWS}
function GetProcAddr(ProcName: PChar): Pointer;
begin
Result := GetProcAddress(IBInstallLibrary, ProcName);
if not Assigned(Result) then
RaiseLastOSError;
end;
{$ENDIF}
{$IFDEF LINUX}
function GetProcAddr(ProcName : PChar) : Pointer;
begin
Result := dlsym(IBInstallLibrary, ProcName);
if not Assigned(Result) then
raise EIBClientError.Create(Format('Error loading %s, Error Code = %s', [ProcName, dlerror])); {do not localize}
end;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
IBInstallLibrary := LoadLibrary(PChar(IB_INSTALL_DLL));
if (IBInstallLibrary > HINSTANCE_ERROR) then
{$ENDIF}
{$IFDEF LINUX}
IBInstallLibrary := dlopen(PChar(IB_INSTALL_DLL), 0);
if (IBInstallLibrary <> nil) then
{$ENDIF}
begin
isc_install_clear_options := GetProcAddr('isc_install_clear_options'); {do not localize}
isc_install_execute := GetProcAddr('isc_install_execute'); {do not localize}
isc_install_get_info := GetProcAddr('isc_install_get_info'); {do not localize}
isc_install_get_message := GetProcAddr('isc_install_get_message'); {do not localize}
isc_install_load_external_text := GetProcAddr('isc_install_load_external_text'); {do not localize}
isc_install_precheck := GetProcAddr('isc_install_precheck'); {do not localize}
isc_install_set_option := GetProcAddr('isc_install_set_option'); {do not localize}
isc_uninstall_execute := GetProcAddr('isc_uninstall_execute'); {do not localize}
isc_uninstall_precheck := GetProcAddr('isc_uninstall_precheck'); {do not localize}
isc_install_unset_option := GetProcAddr('isc_install_unset_option'); {do not localize}
end
else
begin
isc_install_clear_options := isc_install_clear_options_stub;
isc_install_execute := isc_install_execute_stub;
isc_install_get_info := isc_install_get_info_stub;
isc_install_get_message := isc_install_get_message_stub;
isc_install_load_external_text := isc_install_load_external_text_stub;
isc_install_precheck := isc_install_precheck_stub;
isc_install_set_option := isc_install_set_option_stub;
isc_uninstall_execute := isc_uninstall_execute_stub;
isc_uninstall_precheck := isc_uninstall_precheck_stub;
isc_install_unset_option := isc_install_unset_option_stub;
end;
end;
procedure FreeIBInstallLibrary;
begin
{$IFDEF MSWINDOWS}
if IBInstallLibrary > HINSTANCE_ERROR then
begin
FreeLibrary(IBInstallLibrary);
IBInstallLibrary := 0;
end;
{$ENDIF}
{$IFDEF LINUX}
if IBInstallLibrary <> nil then
begin
dlclose(IBInstallLibrary);
IBInstallLibrary := nil;
end;
{$ENDIF}
end;
function TryIBLoad: Boolean;
begin
{$IFDEF MSWINDOWS}
if (IBLibrary <= HINSTANCE_ERROR) then
LoadIBLibrary;
if (IBLibrary <= HINSTANCE_ERROR) then
result := False
else
result := True;
{$ENDIF}
{$IFDEF LINUX}
if (IBLibrary = nil) then
LoadIBLibrary;
Result := IBLibrary <> nil;
{$ENDIF}
end;
procedure CheckIBLoaded;
begin
if not TryIBLoad then
IBError(ibxeInterBaseMissing, [nil]);
end;
function GetIBClientVersion: Integer;
begin
CheckIBLoaded;
result := IBClientVersion;
end;
procedure CheckIBInstallLoaded;
begin
{$IFDEF MSWINDOWS}
if (IBInstallLibrary <= HINSTANCE_ERROR) then
LoadIBInstallLibrary;
if (IBInstallLibrary <= HINSTANCE_ERROR) then
IBError(ibxeInterBaseInstallMissing, [nil]);
{$ENDIF}
{$IFDEF LINUX}
if (IBInstallLibrary = nil) then
LoadIBInstallLibrary;
if (IBInstallLibrary = nil) then
IBError(ibxeInterBaseInstallMissing, [nil]);
{$ENDIF}
end;
function isc_rollback_retaining_stub(status_vector : PISC_STATUS;
tran_handle : PISC_TR_HANDLE):
ISC_STATUS; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_rollback_retaining']); {do not localize}
end;
function isc_service_attach_stub(status_vector : PISC_STATUS;
isc_arg2 : UShort;
isc_arg3 : PChar;
service_handle : PISC_SVC_HANDLE;
isc_arg5 : UShort;
isc_arg6 : PChar):
ISC_STATUS; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_service_attach']); {do not localize}
end;
function isc_service_detach_stub(status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE):
ISC_STATUS; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_service_detach']); {do not localize}
end;
function isc_service_query_stub(status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE;
recv_handle : PISC_SVC_HANDLE;
isc_arg4 : UShort;
isc_arg5 : PChar;
isc_arg6 : UShort;
isc_arg7 : PChar;
isc_arg8 : UShort;
isc_arg9 : PChar):
ISC_STATUS; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_service_query']); {do not localize}
end;
function isc_service_start_stub(status_vector : PISC_STATUS;
service_handle : PISC_SVC_HANDLE;
recv_handle : PISC_SVC_HANDLE;
isc_arg4 : UShort;
isc_arg5 : PChar):
ISC_STATUS; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_service_start']); {do not localize}
end;
procedure isc_encode_sql_date_stub(tm_date : PCTimeStructure;
ib_date : PISC_DATE);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_encode_sql_date']); {do not localize}
end;
procedure isc_encode_sql_time_stub(tm_date : PCTimeStructure;
ib_time : PISC_TIME);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_encode_sql_time']); {do not localize}
end;
procedure isc_encode_timestamp_stub(tm_date : PCTimeStructure;
ib_timestamp : PISC_TIMESTAMP);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_encode_sql_timestamp']); {do not localize}
end;
procedure isc_decode_sql_date_stub(ib_date : PISC_DATE;
tm_date : PCTimeStructure);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_decode_sql_date']); {do not localize}
end;
procedure isc_decode_sql_time_stub(ib_time : PISC_TIME;
tm_date : PCTimeStructure);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_decode_sql_time']); {do not localize}
end;
procedure isc_decode_timestamp_stub(ib_timestamp : PISC_TIMESTAMP;
tm_date : PCTimeStructure);
{$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
IBError(ibxeIB60feature, ['isc_decode_timestamp']); {do not localize}
end;
function isc_install_clear_options_stub(hOption: POPTIONS_HANDLE):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_execute_stub(hOption: OPTIONS_HANDLE;
src_dir: TEXT;
dest_dir: TEXT;
status_func: FP_STATUS;
status_data: pointer;
error_func: FP_ERROR;
error_data: pointer;
uninstal_file_name: TEXT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_get_info_stub(info_type :integer;
option :OPT;
info_buffer : Pointer;
buf_len : Cardinal): MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_get_message_stub(hOption: OPTIONS_HANDLE;
message_no: MSG_NO;
message_txt: Pointer;
message_len: Cardinal):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_load_external_text_stub(msg_file_name: TEXT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_precheck_stub(hOption: OPTIONS_HANDLE;
src_dir: TEXT;
dest_dir: TEXT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_set_option_stub(hOption: POPTIONS_HANDLE;
option: OPT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_uninstall_execute_stub(uninstall_file_name: TEXT;
status_func: FP_STATUS;
status_data: pointer;
error_func: FP_ERROR;
error_data: pointer):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_uninstall_precheck_stub(uninstall_file_name: TEXT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
function isc_install_unset_option_stub(hOption: POPTIONS_HANDLE;
option: OPT):MSG_NO; {$IFDEF MSWINDOWS} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
begin
Result := 0;
IBError(ibxeIB60feature, ['isc_install_xxx ']); {do not localize}
end;
initialization
finalization
FreeIBLibrary;
FreeIBInstallLibrary;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -