188 |
|
FCreateDatabase: boolean; |
189 |
|
FCreateIfNotExists: boolean; |
190 |
|
FAllowStreamedConnected: boolean; |
191 |
+ |
FFirebirdLibraryPathName: TIBFileName; |
192 |
|
FHiddenPassword: string; |
193 |
|
FOnCreateDatabase: TNotifyEvent; |
194 |
|
FOnLogin: TIBDatabaseLoginEvent; |
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); |
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} |
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 |
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; |
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 |
560 |
|
FSQLObjects.Free; |
561 |
|
FTransactions.Free; |
562 |
|
FDataSets.Free; |
563 |
+ |
FFirebirdAPI := nil; |
564 |
|
inherited Destroy; |
565 |
|
end; |
566 |
|
|
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 |
|
|
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; |
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 |
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; |
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 |
|
|
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; |
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; |