ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBDatabase.pas
(Generate patch)

Comparing ibx/trunk/runtime/nongui/IBDatabase.pas (file contents):
Revision 262 by tony, Tue Apr 10 13:32:36 2018 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 188 | Line 188 | type
188      FCreateDatabase: boolean;
189      FCreateIfNotExists: boolean;
190      FAllowStreamedConnected: boolean;
191 +    FFirebirdLibraryPathName: TIBFileName;
192      FHiddenPassword: string;
193      FOnCreateDatabase: TNotifyEvent;
194      FOnLogin: TIBDatabaseLoginEvent;
# Line 208 | Line 209 | type
209      FLoginCalled: boolean;
210      FUseDefaultSystemCodePage: boolean;
211      FUseHiddenPassword: boolean;
212 +    FFirebirdAPI: IFirebirdAPI;
213      procedure EnsureInactive;
214      function GetAuthenticationMethod: string;
215      function GetDBSQLDialect: Integer;
216      function GetDefaultCharSetID: integer;
217      function GetDefaultCharSetName: AnsiString;
218      function GetDefaultCodePage: TSystemCodePage;
219 +    function GetFirebirdAPI: IFirebirdAPI;
220      function GetRemoteProtocol: string;
221      function GetSQLObjectsCount: Integer;
222 +    procedure SetFirebirdLibraryPathName(AValue: TIBFileName);
223      procedure SetSQLDialect(const Value: Integer);
224      procedure ValidateClientSQLDialect;
225      procedure DBParamsChange(Sender: TObject);
# Line 274 | Line 278 | type
278      procedure RemoveTransactions;
279  
280      property Attachment: IAttachment read FAttachment;
281 +    property FirebirdAPI: IFirebirdAPI read GetFirebirdAPI;
282      property DBSQLDialect : Integer read GetDBSQLDialect;
283      property IsReadOnly: Boolean read GetIsReadOnly;
284      property SQLObjectCount: Integer read GetSQLObjectCount; {ignores nil objects}
# Line 294 | Line 299 | type
299      property AllowStreamedConnected: boolean read FAllowStreamedConnected
300               write FAllowStreamedConnected;
301      property DatabaseName: TIBFileName read FDBName write SetDatabaseName;
302 +    property FirebirdLibraryPathName: TIBFileName read FFirebirdLibraryPathName
303 +                                             write SetFirebirdLibraryPathName;
304      property Params: TStrings read FDBParams write SetDBParams;
305      property LoginPrompt default True;
306      property DefaultTransaction: TIBTransaction read FDefaultTransaction
# Line 311 | Line 318 | type
318      property OnCreateDatabase: TNotifyEvent read FOnCreateDatabase write FOnCreateDatabase;
319      property OnLogin: TIBDatabaseLoginEvent read FOnLogin write FOnLogin;
320      property OnIdleTimer: TNotifyEvent read FOnIdleTimer write FOnIdleTimer;
321 <    property OnDialectDowngradeWarning: TNotifyEvent read FOnDialectDowngradeWarning write FOnDialectDowngradeWarning;
321 >    property OnDialectDowngradeWarning: TNotifyEvent read FOnDialectDowngradeWarning
322 >                                                     write FOnDialectDowngradeWarning;
323    end;
324  
325    TDefaultEndAction = TARollback..TACommit;
# Line 495 | Line 503 | type
503                                            write SetTransaction;
504    end;
505  
506 < function GenerateDPB(sl: TStrings): IDPB;
507 < function GenerateTPB(sl: TStrings): ITPB;
506 > function GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): IDPB;
507 > function GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
508  
509  
510   implementation
# Line 552 | Line 560 | begin
560    FSQLObjects.Free;
561    FTransactions.Free;
562    FDataSets.Free;
563 +  FFirebirdAPI := nil;
564    inherited Destroy;
565   end;
566  
# Line 1085 | Line 1094 | begin
1094       begin
1095         FDBParamsChanged := False;
1096         if not FUseHiddenPassword and (not LoginPrompt and not (csDesigning in ComponentState)) or (FHiddenPassword = '') then
1097 <         DPB := GenerateDPB(TempDBParams)
1097 >         DPB := GenerateDPB(FirebirdAPI,TempDBParams)
1098         else
1099         begin
1100            TempDBParams.Values['password'] := FHiddenPassword;
1101 <          DPB := GenerateDPB(TempDBParams);
1101 >          DPB := GenerateDPB(FirebirdAPI,TempDBParams);
1102         end;
1103       end;
1104  
# Line 1383 | Line 1392 | begin
1392      Result := CP_NONE;
1393   end;
1394  
1395 + function TIBDataBase.GetFirebirdAPI: IFirebirdAPI;
1396 + var fblib: IFirebirdLibrary;
1397 + begin
1398 +  if FFirebirdAPI = nil then
1399 +  begin
1400 +    if (csDesigning in ComponentState) or (Trim(FFirebirdLibraryPathName) = '') then
1401 +      FFirebirdAPI := IB.FirebirdAPI
1402 +    else
1403 +    begin
1404 +      fblib := IB.LoadFBLibrary(FFirebirdLibraryPathName);
1405 +      if assigned(fblib) then
1406 +        FFirebirdAPI := fblib.GetFirebirdAPI;
1407 +    end;
1408 +  end;
1409 +  Result := FFirebirdAPI;
1410 + end;
1411 +
1412   function TIBDataBase.GetRemoteProtocol: string;
1413   begin
1414    CheckActive;
# Line 1394 | Line 1420 | begin
1420    Result := FSQLObjects.Count;
1421   end;
1422  
1423 + procedure TIBDataBase.SetFirebirdLibraryPathName(AValue: TIBFileName);
1424 + begin
1425 +  if FFirebirdLibraryPathName = AValue then Exit;
1426 +  FFirebirdLibraryPathName := AValue;
1427 +  ForceClose;
1428 +  FFirebirdAPI := nil;
1429 + end;
1430 +
1431   procedure TIBDataBase.ValidateClientSQLDialect;
1432   begin
1433    if (DBSQLDialect < FSQLDialect) then
# Line 2061 | Line 2095 | begin
2095      if FTRParamsChanged then
2096      begin
2097        FTRParamsChanged := False;
2098 <      FTPB :=  GenerateTPB(FTRParams);
2098 >      FTPB :=  GenerateTPB(Databases[0].FirebirdAPI,FTRParams);
2099      end;
2100  
2101      ValidDatabaseCount := 0;
# Line 2077 | Line 2111 | begin
2111          if Databases[i] <> nil then
2112            Attachments[i] := Databases[i].Attachment;
2113  
2114 <      FTransactionIntf := FirebirdAPI.StartTransaction(Attachments,FTPB,DefaultAction);
2114 >      FTransactionIntf := Databases[0].FirebirdAPI.StartTransaction(Attachments,FTPB,DefaultAction);
2115      end;
2116    end;
2117  
# Line 2282 | Line 2316 | end;
2316    parameter buffer, and return it and its length
2317    in DPB and DPBLength, respectively. }
2318  
2319 < function GenerateDPB(sl: TStrings): IDPB;
2319 > function GenerateDPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): IDPB;
2320   var
2321    i, j: Integer;
2322    DPBVal: UShort;
# Line 2360 | Line 2394 | end;
2394    of the transaction parameters, generate a transaction
2395    parameter buffer, and return it and its length in
2396    TPB and TPBLength, respectively. }
2397 < function GenerateTPB(sl: TStrings): ITPB;
2397 > function GenerateTPB(FirebirdAPI: IFirebirdAPI; sl: TStrings): ITPB;
2398   var
2399    i, j, TPBVal: Integer;
2400    ParamName, ParamValue: string;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines