[patch_done] Firebird 2.1 driver
Posted: 17.11.2008, 19:16
Starting from version 2.1, Firebird deprecate function isc_interprete to fb_interpret (which is claimed to be more reliable)
In order to use that driver correctly it necessary to do some changes:
Unit ZDbcInterbase6;
TZInterbase6Driver = class(TZAbstractDriver)
private
FInterbase6PlainDriver: IZInterbase6PlainDriver;
FInterbase5PlainDriver: IZInterbase5PlainDriver;
FFirebird10PlainDriver: IZFirebird10PlainDriver;
FFirebird15PlainDriver: IZFirebird15PlainDriver;
FFirebird20PlainDriver: IZFirebird20PlainDriver;
FFirebird21PlainDriver: IZFirebird21PlainDriver;
// embedded drivers
FFirebirdD15PlainDriver: IZFirebird15PlainDriver;
FFirebirdD20PlainDriver: IZFirebird20PlainDriver;
FFirebirdD21PlainDriver: IZFirebird21PlainDriver;
constructor TZInterbase6Driver.Create;
begin
FInterbase6PlainDriver := TZInterbase6PlainDriver.Create;
FInterbase5PlainDriver := TZInterbase5PlainDriver.Create;
FFirebird10PlainDriver := TZFirebird10PlainDriver.Create;
FFirebird15PlainDriver := TZFirebird15PlainDriver.Create;
FFirebird20PlainDriver := TZFirebird20PlainDriver.Create;
FFirebird21PlainDriver := TZFirebird21PlainDriver.Create;
// embedded drivers
FFirebirdD15PlainDriver := TZFirebirdD15PlainDriver.Create;
FFirebirdD20PlainDriver := TZFirebirdD20PlainDriver.Create;
FFirebirdD21PlainDriver := TZFirebirdD21PlainDriver.Create;
end;
function TZInterbase6Driver.GetPlainDriver(
const Url: string): IZInterbasePlainDriver;
var
Protocol: string;
begin
Protocol := ResolveConnectionProtocol(Url, GetSupportedProtocols);
if Protocol = FInterbase5PlainDriver.GetProtocol then
Result := FInterbase5PlainDriver
else if Protocol = FInterbase6PlainDriver.GetProtocol then
Result := FInterbase6PlainDriver
else if Protocol = FFirebird10PlainDriver.GetProtocol then
Result := FFirebird10PlainDriver
else if Protocol = FFirebird15PlainDriver.GetProtocol then
Result := FFirebird15PlainDriver
else if Protocol = FFirebird20PlainDriver.GetProtocol then
Result := FFirebird20PlainDriver
else if Protocol = FFirebird21PlainDriver.GetProtocol then
Result := FFirebird21PlainDriver
// embedded drivers
else if Protocol = FFirebirdD15PlainDriver.GetProtocol then
Result := FFirebirdD15PlainDriver
else if Protocol = FFirebirdD20PlainDriver.GetProtocol then
Result := FFirebirdD20PlainDriver
else if Protocol = FFirebirdD21PlainDriver.GetProtocol then
Result := FFirebirdD21PlainDriver
// Generic driver
else Result := FInterbase6PlainDriver;
Result.Initialize;
end;
function TZInterbase6Driver.GetSupportedProtocols: TStringDynArray;
begin
SetLength(Result, 9);
Result[0] := 'interbase-5';
Result[1] := 'interbase-6';
Result[2] := 'firebird-1.0';
Result[3] := 'firebird-1.5';
Result[4] := 'firebird-2.0';
Result[5] := 'firebird-2.1';
// embedded drivers
Result[6] := 'firebirdd-1.5';
Result[7] := 'firebirdd-2.0';
Result[8] := 'firebirdd-2.1';
end;
Inside the attached zip you found 2 files:
ZplainDriver21.pas is the new driver file
ZPlainFirebirdDriver.pas I added the IZFirebird21PlainDriver,IZFirebirdD21PlainDriver classes
Moreover it is necessary add
ZPlainFirebird21 in '..\..\src\plain\ZPlainFirebird21.pas';
on all Zplain.dpk
In order to use that driver correctly it necessary to do some changes:
Unit ZDbcInterbase6;
TZInterbase6Driver = class(TZAbstractDriver)
private
FInterbase6PlainDriver: IZInterbase6PlainDriver;
FInterbase5PlainDriver: IZInterbase5PlainDriver;
FFirebird10PlainDriver: IZFirebird10PlainDriver;
FFirebird15PlainDriver: IZFirebird15PlainDriver;
FFirebird20PlainDriver: IZFirebird20PlainDriver;
FFirebird21PlainDriver: IZFirebird21PlainDriver;
// embedded drivers
FFirebirdD15PlainDriver: IZFirebird15PlainDriver;
FFirebirdD20PlainDriver: IZFirebird20PlainDriver;
FFirebirdD21PlainDriver: IZFirebird21PlainDriver;
constructor TZInterbase6Driver.Create;
begin
FInterbase6PlainDriver := TZInterbase6PlainDriver.Create;
FInterbase5PlainDriver := TZInterbase5PlainDriver.Create;
FFirebird10PlainDriver := TZFirebird10PlainDriver.Create;
FFirebird15PlainDriver := TZFirebird15PlainDriver.Create;
FFirebird20PlainDriver := TZFirebird20PlainDriver.Create;
FFirebird21PlainDriver := TZFirebird21PlainDriver.Create;
// embedded drivers
FFirebirdD15PlainDriver := TZFirebirdD15PlainDriver.Create;
FFirebirdD20PlainDriver := TZFirebirdD20PlainDriver.Create;
FFirebirdD21PlainDriver := TZFirebirdD21PlainDriver.Create;
end;
function TZInterbase6Driver.GetPlainDriver(
const Url: string): IZInterbasePlainDriver;
var
Protocol: string;
begin
Protocol := ResolveConnectionProtocol(Url, GetSupportedProtocols);
if Protocol = FInterbase5PlainDriver.GetProtocol then
Result := FInterbase5PlainDriver
else if Protocol = FInterbase6PlainDriver.GetProtocol then
Result := FInterbase6PlainDriver
else if Protocol = FFirebird10PlainDriver.GetProtocol then
Result := FFirebird10PlainDriver
else if Protocol = FFirebird15PlainDriver.GetProtocol then
Result := FFirebird15PlainDriver
else if Protocol = FFirebird20PlainDriver.GetProtocol then
Result := FFirebird20PlainDriver
else if Protocol = FFirebird21PlainDriver.GetProtocol then
Result := FFirebird21PlainDriver
// embedded drivers
else if Protocol = FFirebirdD15PlainDriver.GetProtocol then
Result := FFirebirdD15PlainDriver
else if Protocol = FFirebirdD20PlainDriver.GetProtocol then
Result := FFirebirdD20PlainDriver
else if Protocol = FFirebirdD21PlainDriver.GetProtocol then
Result := FFirebirdD21PlainDriver
// Generic driver
else Result := FInterbase6PlainDriver;
Result.Initialize;
end;
function TZInterbase6Driver.GetSupportedProtocols: TStringDynArray;
begin
SetLength(Result, 9);
Result[0] := 'interbase-5';
Result[1] := 'interbase-6';
Result[2] := 'firebird-1.0';
Result[3] := 'firebird-1.5';
Result[4] := 'firebird-2.0';
Result[5] := 'firebird-2.1';
// embedded drivers
Result[6] := 'firebirdd-1.5';
Result[7] := 'firebirdd-2.0';
Result[8] := 'firebirdd-2.1';
end;
Inside the attached zip you found 2 files:
ZplainDriver21.pas is the new driver file
ZPlainFirebirdDriver.pas I added the IZFirebird21PlainDriver,IZFirebirdD21PlainDriver classes
Moreover it is necessary add
ZPlainFirebird21 in '..\..\src\plain\ZPlainFirebird21.pas';
on all Zplain.dpk