61 |
|
{IAttachment} |
62 |
|
procedure Connect; |
63 |
|
procedure Disconnect(Force: boolean=false); override; |
64 |
< |
function IsConnected: boolean; |
64 |
> |
function IsConnected: boolean; override; |
65 |
|
procedure DropDatabase; |
66 |
|
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction; override; |
67 |
|
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction; override; |
93 |
|
{Database Information} |
94 |
|
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; |
95 |
|
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; |
96 |
< |
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
97 |
< |
function GetDBInformation(Request: byte): IDBInformation; overload; |
96 |
> |
function GetDBInformation(Requests: array of byte): IDBInformation; overload; override; |
97 |
> |
function GetDBInformation(Request: byte): IDBInformation; overload; override; |
98 |
|
end; |
99 |
|
|
100 |
|
implementation |
101 |
|
|
102 |
|
uses FB30Transaction, FB30Statement, FB30Array, FB30Blob, FBMessages, |
103 |
< |
FBOutputBlock, FB30Events; |
103 |
> |
FBOutputBlock, FB30Events, IBUtils; |
104 |
|
|
105 |
|
{ TFB30Attachment } |
106 |
|
|
151 |
|
begin |
152 |
|
Disconnect; |
153 |
|
Connect; |
154 |
< |
end; |
154 |
> |
end |
155 |
> |
else |
156 |
> |
GetODSAndConnectionInfo; |
157 |
|
end; |
158 |
|
end; |
159 |
|
|
160 |
|
constructor TFB30Attachment.CreateDatabase(sql: AnsiString; aSQLDialect: integer; |
161 |
|
RaiseExceptionOnError: boolean); |
162 |
|
var IsCreateDB: boolean; |
161 |
– |
info: IDBInformation; |
162 |
– |
ConnectionType: integer; |
163 |
– |
SiteName: AnsiString; |
163 |
|
begin |
164 |
|
inherited Create('',nil,RaiseExceptionOnError); |
165 |
|
FSQLDialect := aSQLDialect; |
170 |
|
if FRaiseExceptionOnConnectError then Check4DataBaseError; |
171 |
|
if InErrorState then |
172 |
|
FAttachmentIntf := nil; |
174 |
– |
FCharSetID := 0; |
175 |
– |
FCodePage := CP_NONE; |
176 |
– |
FHasDefaultCharSet := false; |
177 |
– |
info := GetDBInformation(isc_info_db_id); |
178 |
– |
info[0].DecodeIDCluster(ConnectionType,FDatabaseName,SiteName); |
173 |
|
end; |
174 |
+ |
GetODSAndConnectionInfo; |
175 |
+ |
ExtractConnectString(sql,FDatabaseName); |
176 |
+ |
DPBFromCreateSQL(sql); |
177 |
|
end; |
178 |
|
|
179 |
|
destructor TFB30Attachment.Destroy; |
184 |
|
end; |
185 |
|
|
186 |
|
procedure TFB30Attachment.Connect; |
190 |
– |
var Param: IDPBItem; |
187 |
|
begin |
188 |
|
with Firebird30ClientAPI do |
189 |
|
begin |
194 |
|
if InErrorState then |
195 |
|
FAttachmentIntf := nil |
196 |
|
else |
197 |
< |
begin |
202 |
< |
Param := DPB.Find(isc_dpb_set_db_SQL_dialect); |
203 |
< |
if Param <> nil then |
204 |
< |
FSQLDialect := Param.AsByte; |
205 |
< |
Param := DPB.Find(isc_dpb_lc_ctype); |
206 |
< |
FHasDefaultCharSet := (Param <> nil) and |
207 |
< |
CharSetName2CharSetID(Param.AsString,FCharSetID) and |
208 |
< |
CharSetID2CodePage(FCharSetID,FCodePage) and |
209 |
< |
(FCharSetID > 1); |
210 |
< |
end; |
197 |
> |
GetODSAndConnectionInfo; |
198 |
|
end; |
199 |
|
end; |
200 |
|
|