42 |
|
unit IBServices; |
43 |
|
|
44 |
|
{$Mode Delphi} |
45 |
+ |
{$IF FPC_FULLVERSION >= 20700 } |
46 |
+ |
{$codepage UTF8} |
47 |
+ |
{$ENDIF} |
48 |
|
|
49 |
|
interface |
50 |
|
|
140 |
|
|
141 |
|
protected |
142 |
|
procedure Loaded; override; |
143 |
< |
function Login: Boolean; |
143 |
> |
function Login(var aServerName: string): Boolean; |
144 |
|
procedure CheckActive; |
145 |
|
procedure CheckInactive; |
146 |
|
procedure HandleException(Sender: TObject); |
524 |
|
var |
525 |
|
SPB: String; |
526 |
|
ConnectString: String; |
527 |
+ |
aServerName: string; |
528 |
|
begin |
529 |
|
CheckInactive; |
530 |
|
CheckServerName; |
531 |
|
|
532 |
< |
if FLoginPrompt and not Login then |
532 |
> |
aServerName := FServerName; |
533 |
> |
if FLoginPrompt and not Login(aServerName) then |
534 |
|
IBError(ibxeOperationCancelled, [nil]); |
535 |
|
|
536 |
|
{ Generate a new SPB if necessary } |
542 |
|
Move(SPB[1], FSPB[0], FSPBLength); |
543 |
|
end; |
544 |
|
case FProtocol of |
545 |
< |
TCP: ConnectString := FServerName + ':service_mgr'; {do not localize} |
546 |
< |
SPX: ConnectString := FServerName + '@service_mgr'; {do not localize} |
547 |
< |
NamedPipe: ConnectString := '\\' + FServerName + '\service_mgr'; {do not localize} |
545 |
> |
TCP: ConnectString := aServerName + ':service_mgr'; {do not localize} |
546 |
> |
SPX: ConnectString := aServerName + '@service_mgr'; {do not localize} |
547 |
> |
NamedPipe: ConnectString := '\\' + aServerName + '\service_mgr'; {do not localize} |
548 |
|
Local: ConnectString := 'service_mgr'; {do not localize} |
549 |
|
end; |
550 |
|
if call(isc_service_attach(StatusVector, Length(ConnectString), |
575 |
|
end; |
576 |
|
end; |
577 |
|
|
578 |
< |
function TIBCustomService.Login: Boolean; |
578 |
> |
function TIBCustomService.Login(var aServerName: string): Boolean; |
579 |
|
var |
580 |
|
IndexOfUser, IndexOfPassword: Integer; |
581 |
|
Username, Password: String; |
588 |
|
LoginParams.Assign(Params); |
589 |
|
FOnLogin(Self, LoginParams); |
590 |
|
Params.Assign (LoginParams); |
591 |
+ |
aServerName := ServerName; |
592 |
|
finally |
593 |
|
LoginParams.Free; |
594 |
|
end; |
606 |
|
Password := Copy(Params[IndexOfPassword], |
607 |
|
Pos('=', Params[IndexOfPassword]) + 1, {mbcs ok} |
608 |
|
Length(Params[IndexOfPassword])); |
609 |
< |
result := IBGUIInterface.ServerLoginDialog(serverName, Username, Password); |
609 |
> |
result := IBGUIInterface.ServerLoginDialog(aServerName, Username, Password); |
610 |
|
if result then |
611 |
|
begin |
612 |
|
IndexOfPassword := IndexOfSPBConst(SPBConstantNames[isc_spb_password]); |