35 |
|
|
36 |
|
uses |
37 |
|
Classes, SysUtils, IB, FBAttachment, FB25ClientAPI, IBHeader, |
38 |
< |
FBParamBlock, FBOutputBlock, FBActivityMonitor; |
38 |
> |
FBParamBlock, FBOutputBlock, FBActivityMonitor, IBExternals; |
39 |
|
|
40 |
|
type |
41 |
|
{ TFB25Attachment } |
48 |
|
public |
49 |
|
constructor Create(DatabaseName: string; aDPB: IDPB; |
50 |
|
RaiseExceptionOnConnectError: boolean); |
51 |
< |
constructor CreateDatabase(DatabaseName: string; aDPB: IDPB; RaiseExceptionOnError: boolean); |
51 |
> |
constructor CreateDatabase(DatabaseName: string; aDPB: IDPB; RaiseExceptionOnError: boolean); overload; |
52 |
> |
constructor CreateDatabase(sql: string; aSQLDialect: integer; |
53 |
> |
RaiseExceptionOnError: boolean); overload; |
54 |
|
property Handle: TISC_DB_HANDLE read FHandle; |
55 |
|
|
56 |
|
public |
77 |
|
function CreateArray(transaction: ITransaction; RelationName, ColumnName: string |
78 |
|
): IArray; overload; |
79 |
|
function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload; |
80 |
+ |
function CreateArrayMetaData(SQLType: cardinal; tableName: string; columnName: string; |
81 |
+ |
Scale: integer; size: cardinal; |
82 |
+ |
acharSetID: cardinal; dimensions: cardinal; bounds: TArrayBounds |
83 |
+ |
): IArrayMetaData; |
84 |
|
|
85 |
|
{Database Information} |
86 |
|
|
136 |
|
end; |
137 |
|
end; |
138 |
|
|
139 |
+ |
constructor TFB25Attachment.CreateDatabase(sql: string; aSQLDialect: integer; |
140 |
+ |
RaiseExceptionOnError: boolean); |
141 |
+ |
var tr_handle: TISC_TR_HANDLE; |
142 |
+ |
info: IDBInformation; |
143 |
+ |
ConnectionType: integer; |
144 |
+ |
SiteName: string; |
145 |
+ |
begin |
146 |
+ |
inherited Create('',nil,RaiseExceptionOnError); |
147 |
+ |
FSQLDialect := aSQLDialect; |
148 |
+ |
tr_handle := nil; |
149 |
+ |
with Firebird25ClientAPI do |
150 |
+ |
begin |
151 |
+ |
if (isc_dsql_execute_immediate(StatusVector, @FHandle, @tr_handle, 0, PChar(sql), |
152 |
+ |
aSQLDialect, nil) > 0) and RaiseExceptionOnError then |
153 |
+ |
IBDataBaseError; |
154 |
+ |
|
155 |
+ |
FCharSetID := 0; |
156 |
+ |
FCodePage := CP_NONE; |
157 |
+ |
FHasDefaultCharSet := false; |
158 |
+ |
info := GetDBInformation(isc_info_db_id); |
159 |
+ |
info[0].DecodeIDCluster(ConnectionType,FDatabaseName,SiteName); |
160 |
+ |
end; |
161 |
+ |
end; |
162 |
+ |
|
163 |
|
procedure TFB25Attachment.Connect; |
164 |
|
var Param: IDPBItem; |
165 |
|
begin |
332 |
|
Result := TFB25Array.Create(self,transaction as TFB25Transaction,ArrayMetaData); |
333 |
|
end; |
334 |
|
|
335 |
+ |
function TFB25Attachment.CreateArrayMetaData(SQLType: cardinal; |
336 |
+ |
tableName: string; columnName: string; Scale: integer; size: cardinal; |
337 |
+ |
acharSetID: cardinal; dimensions: cardinal; bounds: TArrayBounds |
338 |
+ |
): IArrayMetaData; |
339 |
+ |
begin |
340 |
+ |
Result := TFB25ArrayMetaData.Create(SQLType,tableName,ColumnName,Scale,size,acharSetID,dimensions,bounds); |
341 |
+ |
end; |
342 |
+ |
|
343 |
|
function TFB25Attachment.GetBlobMetaData(Transaction: ITransaction; tableName, |
344 |
|
columnName: string): IBlobMetaData; |
345 |
|
begin |