32 |
|
{$IFDEF FPC} |
33 |
|
{$mode delphi} |
34 |
|
{$interfaces COM} |
35 |
+ |
{$define HASREQEX} |
36 |
|
{$ENDIF} |
37 |
|
|
38 |
|
interface |
39 |
|
|
40 |
|
uses |
41 |
< |
Classes, SysUtils, {$IFDEF WINDOWS} windows, {$ENDIF} IB, FBParamBlock, FBActivityMonitor; |
41 |
> |
Classes, SysUtils, {$IFDEF WINDOWS} windows, {$ENDIF} IB, FBParamBlock, |
42 |
> |
FBActivityMonitor, FBClientAPI; |
43 |
|
|
44 |
|
type |
45 |
|
TCharsetMap = record |
59 |
|
FODSMajorVersion: integer; |
60 |
|
FODSMinorVersion: integer; |
61 |
|
FUserCharSetMap: array of TCharSetMap; |
62 |
+ |
FSecDatabase: AnsiString; |
63 |
|
protected |
64 |
|
FDatabaseName: AnsiString; |
65 |
|
FRaiseExceptionOnConnectError: boolean; |
68 |
|
FCharSetID: integer; |
69 |
|
FCodePage: TSystemCodePage; |
70 |
|
FRemoteProtocol: AnsiString; |
71 |
< |
constructor Create(DatabaseName: AnsiString; DPB: IDPB; |
71 |
> |
FAuthMethod: AnsiString; |
72 |
> |
constructor Create(api: TFBClientAPI; DatabaseName: AnsiString; DPB: IDPB; |
73 |
|
RaiseExceptionOnConnectError: boolean); |
74 |
|
procedure CheckHandle; virtual; abstract; |
75 |
|
function GenerateCreateDatabaseSQL(DatabaseName: AnsiString; aDPB: IDPB): AnsiString; |
76 |
|
procedure GetODSAndConnectionInfo; |
77 |
+ |
function GetDBInfo(ReqBuffer: PByte; ReqBufLen: integer): IDBInformation; virtual; abstract; |
78 |
|
function IsConnected: boolean; virtual; abstract; |
79 |
|
procedure EndAllTransactions; |
80 |
|
procedure DPBFromCreateSQL(CreateSQL: AnsiString); |
81 |
|
procedure SetParameters(SQLParams: ISQLParams; params: array of const); |
82 |
+ |
procedure UseServerICUChanged; virtual; |
83 |
|
public |
84 |
|
destructor Destroy; override; |
85 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
86 |
|
function getDPB: IDPB; |
87 |
|
function AllocateBPB: IBPB; |
88 |
+ |
function AllocateDIRB: IDIRB; |
89 |
|
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion): ITransaction; overload; virtual; abstract; |
90 |
|
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion): ITransaction; overload; virtual; abstract; |
91 |
|
procedure Disconnect(Force: boolean=false); virtual; abstract; |
115 |
|
function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload; virtual; abstract; |
116 |
|
function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload; |
117 |
|
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
118 |
< |
aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload; virtual; abstract; |
118 |
> |
aSQLDialect: integer; GenerateParamNames: boolean=false; |
119 |
> |
CaseSensitiveParams: boolean = false): IStatement; overload; virtual; abstract; |
120 |
|
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
121 |
< |
GenerateParamNames: boolean=false): IStatement; overload; |
121 |
> |
GenerateParamNames: boolean=false; |
122 |
> |
CaseSensitiveParams: boolean = false): IStatement; overload; |
123 |
|
function GetEventHandler(Events: TStrings): IEvents; overload; virtual; abstract; |
124 |
|
function GetEventHandler(Event: AnsiString): IEvents; overload; |
125 |
|
|
126 |
|
function GetSQLDialect: integer; |
127 |
+ |
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload; |
128 |
+ |
function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload; virtual; abstract; |
129 |
|
function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; virtual; abstract; |
130 |
+ |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
131 |
|
function OpenBlob(transaction: ITransaction; Field: ISQLData; BPB: IBPB=nil): IBlob; overload; |
132 |
+ |
function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString |
133 |
+ |
): IArray; overload; |
134 |
+ |
function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload; virtual; abstract; |
135 |
+ |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload; |
136 |
+ |
function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload; virtual; abstract; |
137 |
|
property SQLDialect: integer read FSQLDialect; |
138 |
|
property DPB: IDPB read FDPB; |
139 |
< |
public |
140 |
< |
function GetDBInformation(Requests: array of byte): IDBInformation; overload; virtual; abstract; |
141 |
< |
function GetDBInformation(Request: byte): IDBInformation; overload; virtual; abstract; |
142 |
< |
function GetConnectString: AnsiString; |
143 |
< |
function GetRemoteProtocol: AnsiString; |
144 |
< |
function GetODSMajorVersion: integer; |
145 |
< |
function GetODSMinorVersion: integer; |
146 |
< |
{Character Sets} |
147 |
< |
function HasDefaultCharSet: boolean; |
148 |
< |
function GetDefaultCharSetID: integer; |
149 |
< |
function GetCharsetName(CharSetID: integer): AnsiString; |
150 |
< |
function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean; |
151 |
< |
function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean; |
152 |
< |
function CharSetName2CharSetID(CharSetName: AnsiString; var CharSetID: integer): boolean; |
153 |
< |
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
154 |
< |
procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage; |
155 |
< |
AllowReverseLookup:boolean; out CharSetID: integer); |
156 |
< |
property CharSetID: integer read FCharSetID; |
157 |
< |
property CodePage: TSystemCodePage read FCodePage; |
139 |
> |
public |
140 |
> |
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
141 |
> |
function GetDBInformation(Request: byte): IDBInformation; overload; |
142 |
> |
function GetDBInformation(Requests: IDIRB): IDBInformation; overload; |
143 |
> |
function GetConnectString: AnsiString; |
144 |
> |
function GetRemoteProtocol: AnsiString; |
145 |
> |
function GetAuthenticationMethod: AnsiString; |
146 |
> |
function GetSecurityDatabase: AnsiString; |
147 |
> |
function GetODSMajorVersion: integer; |
148 |
> |
function GetODSMinorVersion: integer; |
149 |
> |
function HasDecFloatSupport: boolean; virtual; |
150 |
> |
|
151 |
> |
public |
152 |
> |
{Character Sets} |
153 |
> |
function HasDefaultCharSet: boolean; |
154 |
> |
function GetDefaultCharSetID: integer; |
155 |
> |
function GetCharsetName(CharSetID: integer): AnsiString; |
156 |
> |
function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean; |
157 |
> |
function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean; |
158 |
> |
function CharSetName2CharSetID(CharSetName: AnsiString; var CharSetID: integer): boolean; |
159 |
> |
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
160 |
> |
procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage; |
161 |
> |
AllowReverseLookup:boolean; out CharSetID: integer); |
162 |
> |
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; virtual; abstract; |
163 |
> |
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; virtual; abstract; |
164 |
> |
property CharSetID: integer read FCharSetID; |
165 |
> |
property CodePage: TSystemCodePage read FCodePage; |
166 |
> |
|
167 |
> |
public |
168 |
> |
{Time Zone Support} |
169 |
> |
function GetTimeZoneServices: ITimeZoneServices; virtual; |
170 |
> |
function HasTimeZoneSupport: boolean; virtual; |
171 |
> |
|
172 |
> |
end; |
173 |
> |
|
174 |
> |
{ TDPBItem } |
175 |
> |
|
176 |
> |
TDPBItem = class(TParamBlockItem,IDPBItem) |
177 |
> |
public |
178 |
> |
function getParamTypeName: AnsiString; override; |
179 |
> |
end; |
180 |
> |
|
181 |
> |
{ TDPB } |
182 |
> |
|
183 |
> |
TDPB = class (TCustomParamBlock<TDPBItem,IDPBItem>, IDPB) |
184 |
> |
protected |
185 |
> |
function LookupItemType(ParamTypeName: AnsiString): byte; override; |
186 |
> |
public |
187 |
> |
constructor Create(api: TFBClientAPI); |
188 |
> |
function GetDPBParamTypeName(ParamType: byte): Ansistring; |
189 |
|
end; |
190 |
|
|
191 |
|
implementation |
192 |
|
|
193 |
< |
uses FBMessages, FBTransaction, RegExpr; |
193 |
> |
uses FBMessages, IBUtils, FBTransaction {$IFDEF HASREQEX}, RegExpr{$ENDIF}; |
194 |
|
|
195 |
|
const |
196 |
|
CharSetMap: array [0..69] of TCharsetMap = ( |
266 |
|
(CharsetID: 69; CharSetName: 'GB18030'; CharSetWidth: 4; CodePage: 54936; AllowReverseLookup: true) |
267 |
|
); |
268 |
|
|
269 |
+ |
const |
270 |
+ |
isc_dpb_last_dpb_constant = isc_dpb_decfloat_traps; |
271 |
+ |
|
272 |
+ |
DPBConstantNames: array[1..isc_dpb_last_dpb_constant] of string = ( |
273 |
+ |
'cdd_pathname', |
274 |
+ |
'allocation', |
275 |
+ |
'journal', |
276 |
+ |
'page_size', |
277 |
+ |
'num_buffers', |
278 |
+ |
'buffer_length', |
279 |
+ |
'debug', |
280 |
+ |
'garbage_collect', |
281 |
+ |
'verify', |
282 |
+ |
'sweep', |
283 |
+ |
'enable_journal', |
284 |
+ |
'disable_journal', |
285 |
+ |
'dbkey_scope', |
286 |
+ |
'number_of_users', |
287 |
+ |
'trace', |
288 |
+ |
'no_garbage_collect', |
289 |
+ |
'damaged', |
290 |
+ |
'license', |
291 |
+ |
'sys_user_name', |
292 |
+ |
'encrypt_key', |
293 |
+ |
'activate_shadow', |
294 |
+ |
'sweep_interval', |
295 |
+ |
'delete_shadow', |
296 |
+ |
'force_write', |
297 |
+ |
'begin_log', |
298 |
+ |
'quit_log', |
299 |
+ |
'no_reserve', |
300 |
+ |
'user_name', |
301 |
+ |
'password', |
302 |
+ |
'password_enc', |
303 |
+ |
'sys_user_name_enc', |
304 |
+ |
'interp', |
305 |
+ |
'online_dump', |
306 |
+ |
'old_file_size', |
307 |
+ |
'old_num_files', |
308 |
+ |
'old_file', |
309 |
+ |
'old_start_page', |
310 |
+ |
'old_start_seqno', |
311 |
+ |
'old_start_file', |
312 |
+ |
'drop_walfile', |
313 |
+ |
'old_dump_id', |
314 |
+ |
'wal_backup_dir', |
315 |
+ |
'wal_chkptlen', |
316 |
+ |
'wal_numbufs', |
317 |
+ |
'wal_bufsize', |
318 |
+ |
'wal_grp_cmt_wait', |
319 |
+ |
'lc_messages', |
320 |
+ |
'lc_ctype', |
321 |
+ |
'cache_manager', |
322 |
+ |
'shutdown', |
323 |
+ |
'online', |
324 |
+ |
'shutdown_delay', |
325 |
+ |
'reserved', |
326 |
+ |
'overwrite', |
327 |
+ |
'sec_attach', |
328 |
+ |
'disable_wal', |
329 |
+ |
'connect_timeout', |
330 |
+ |
'dummy_packet_interval', |
331 |
+ |
'gbak_attach', |
332 |
+ |
'sql_role_name', |
333 |
+ |
'set_page_buffers', |
334 |
+ |
'working_directory', |
335 |
+ |
'sql_dialect', |
336 |
+ |
'set_db_readonly', |
337 |
+ |
'set_db_sql_dialect', |
338 |
+ |
'gfix_attach', |
339 |
+ |
'gstat_attach', |
340 |
+ |
'set_db_charset', |
341 |
+ |
'gsec_attach', |
342 |
+ |
'address_path' , |
343 |
+ |
'process_id', |
344 |
+ |
'no_db_triggers', |
345 |
+ |
'trusted_auth', |
346 |
+ |
'process_name', |
347 |
+ |
'trusted_role', |
348 |
+ |
'org_filename', |
349 |
+ |
'utf8_ilename', |
350 |
+ |
'ext_call_depth', |
351 |
+ |
'auth_block', |
352 |
+ |
'client_version', |
353 |
+ |
'remote_protocol', |
354 |
+ |
'host_name', |
355 |
+ |
'os_user', |
356 |
+ |
'specific_auth_data', |
357 |
+ |
'auth_plugin_list', |
358 |
+ |
'auth_plugin_name', |
359 |
+ |
'config', |
360 |
+ |
'nolinger', |
361 |
+ |
'reset_icu', |
362 |
+ |
'map_attach', |
363 |
+ |
'session_time_zone', |
364 |
+ |
'set_db_replica', |
365 |
+ |
'set_bind', |
366 |
+ |
'decfloat_round', |
367 |
+ |
'decfloat_traps' |
368 |
+ |
); |
369 |
|
|
370 |
|
|
371 |
|
|
392 |
|
FSQLDialect := getAsInteger; |
393 |
|
end; |
394 |
|
|
395 |
< |
if (FODSMajorVersion > 11) or ((FODSMajorVersion = 11) and (FODSMinorVersion >= 1)) then |
395 |
> |
FCharSetID := 0; |
396 |
> |
FRemoteProtocol := ''; |
397 |
> |
FAuthMethod := 'Legacy_Auth'; |
398 |
> |
FSecDatabase := 'Default'; |
399 |
> |
if FODSMajorVersion > 11 then |
400 |
> |
begin |
401 |
> |
Stmt := Prepare(StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit), |
402 |
> |
'Select MON$CHARACTER_SET_ID, MON$REMOTE_PROTOCOL, MON$AUTH_METHOD, MON$SEC_DATABASE From MON$ATTACHMENTS, MON$DATABASE '+ |
403 |
> |
'Where MON$ATTACHMENT_ID = CURRENT_CONNECTION '); |
404 |
> |
ResultSet := Stmt.OpenCursor; |
405 |
> |
if ResultSet.FetchNext then |
406 |
> |
begin |
407 |
> |
FCharSetID := ResultSet[0].AsInteger; |
408 |
> |
FRemoteProtocol := Trim(ResultSet[1].AsString); |
409 |
> |
FAuthMethod := Trim(ResultSet[2].AsString); |
410 |
> |
FSecDatabase := Trim(ResultSet[3].AsString); |
411 |
> |
end |
412 |
> |
end |
413 |
> |
else |
414 |
> |
if (FODSMajorVersion = 11) and (FODSMinorVersion >= 1) then |
415 |
|
begin |
416 |
|
Stmt := Prepare(StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit), |
417 |
|
'Select MON$CHARACTER_SET_ID, MON$REMOTE_PROTOCOL From MON$ATTACHMENTS '+ |
420 |
|
if ResultSet.FetchNext then |
421 |
|
begin |
422 |
|
FCharSetID := ResultSet[0].AsInteger; |
423 |
< |
FRemoteProtocol := ResultSet[1].AsString; |
423 |
> |
FRemoteProtocol := Trim(ResultSet[1].AsString); |
424 |
|
end |
425 |
|
end |
426 |
|
else |
429 |
|
Param := DPB.Find(isc_dpb_lc_ctype); |
430 |
|
if (Param = nil) or not CharSetName2CharSetID(Param.AsString,FCharSetID) then |
431 |
|
FCharSetID := 0; |
432 |
< |
FRemoteProtocol := ''; |
433 |
< |
end |
434 |
< |
else |
435 |
< |
begin |
436 |
< |
FCharSetID := 0; |
437 |
< |
FRemoteProtocol := ''; |
432 |
> |
case GetProtocol(FDatabaseName) of |
433 |
> |
TCP: FRemoteProtocol := 'TCPv4'; |
434 |
> |
Local: FRemoteProtocol := ''; |
435 |
> |
NamedPipe: FRemoteProtocol := 'Netbui'; |
436 |
> |
SPX: FRemoteProtocol := 'SPX' |
437 |
> |
end; |
438 |
|
end; |
439 |
|
FHasDefaultCharSet := CharSetID2CodePage(FCharSetID,FCodePage) and (FCharSetID > 1); |
440 |
|
end; |
441 |
|
|
442 |
< |
constructor TFBAttachment.Create(DatabaseName: AnsiString; DPB: IDPB; |
443 |
< |
RaiseExceptionOnConnectError: boolean); |
442 |
> |
constructor TFBAttachment.Create(api: TFBClientAPI; DatabaseName: AnsiString; |
443 |
> |
DPB: IDPB; RaiseExceptionOnConnectError: boolean); |
444 |
|
begin |
445 |
|
inherited Create; |
446 |
< |
FFirebirdAPI := FirebirdAPI; {Keep reference to interface} |
446 |
> |
FFirebirdAPI := api.GetAPI; {Keep reference to interface} |
447 |
|
FSQLDialect := 3; |
448 |
|
FDatabaseName := DatabaseName; |
449 |
|
FDPB := DPB; |
497 |
|
end; |
498 |
|
end; |
499 |
|
|
500 |
+ |
{$IFDEF HASREQEX} |
501 |
|
procedure TFBAttachment.DPBFromCreateSQL(CreateSQL: AnsiString); |
502 |
|
var RegexObj: TRegExpr; |
503 |
|
begin |
526 |
|
DPB.Add(isc_dpb_lc_ctype).AsString := GetCharSetName(FCharSetID); |
527 |
|
DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(FSQLDialect); |
528 |
|
end; |
529 |
+ |
{$ELSE} |
530 |
+ |
procedure TFBAttachment.DPBFromCreateSQL(CreateSQL: AnsiString); |
531 |
+ |
begin |
532 |
+ |
FDPB := FFirebirdAPI.AllocateDPB; |
533 |
+ |
if FCharSetID > 0 then |
534 |
+ |
DPB.Add(isc_dpb_lc_ctype).AsString := GetCharSetName(FCharSetID); |
535 |
+ |
DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(FSQLDialect); |
536 |
+ |
end; |
537 |
+ |
{$ENDIF} |
538 |
|
|
539 |
|
procedure TFBAttachment.SetParameters(SQLParams: ISQLParams; |
540 |
|
params: array of const); |
584 |
|
end; |
585 |
|
end; |
586 |
|
|
587 |
+ |
procedure TFBAttachment.UseServerICUChanged; |
588 |
+ |
begin |
589 |
+ |
// Do nothing by default |
590 |
+ |
end; |
591 |
+ |
|
592 |
|
destructor TFBAttachment.Destroy; |
593 |
|
begin |
594 |
|
Disconnect(true); |
595 |
|
inherited Destroy; |
596 |
|
end; |
597 |
|
|
598 |
+ |
function TFBAttachment.getFirebirdAPI: IFirebirdAPI; |
599 |
+ |
begin |
600 |
+ |
Result := FFirebirdAPI; |
601 |
+ |
end; |
602 |
+ |
|
603 |
|
function TFBAttachment.getDPB: IDPB; |
604 |
|
begin |
605 |
|
Result := FDPB; |
607 |
|
|
608 |
|
function TFBAttachment.AllocateBPB: IBPB; |
609 |
|
begin |
610 |
< |
Result := TBPB.Create; |
610 |
> |
Result := TBPB.Create(FFirebirdAPI as TFBClientAPI); |
611 |
> |
end; |
612 |
> |
|
613 |
> |
function TFBAttachment.AllocateDIRB: IDIRB; |
614 |
> |
begin |
615 |
> |
Result := TDIRB.Create(FFirebirdAPI as TFBClientAPI); |
616 |
|
end; |
617 |
|
|
618 |
|
procedure TFBAttachment.ExecImmediate(TPB: array of byte; sql: AnsiString; |
735 |
|
end; |
736 |
|
|
737 |
|
function TFBAttachment.PrepareWithNamedParameters(transaction: ITransaction; |
738 |
< |
sql: AnsiString; GenerateParamNames: boolean): IStatement; |
738 |
> |
sql: AnsiString; GenerateParamNames: boolean; CaseSensitiveParams: boolean): IStatement; |
739 |
|
begin |
740 |
< |
Result := PrepareWithNamedParameters(transaction,sql,FSQLDialect,GenerateParamNames); |
740 |
> |
Result := PrepareWithNamedParameters(transaction,sql,FSQLDialect,GenerateParamNames,CaseSensitiveParams); |
741 |
|
end; |
742 |
|
|
743 |
|
function TFBAttachment.GetEventHandler(Event: AnsiString): IEvents; |
757 |
|
Result := FSQLDialect; |
758 |
|
end; |
759 |
|
|
760 |
+ |
function TFBAttachment.CreateBlob(transaction: ITransaction; RelationName, |
761 |
+ |
ColumnName: AnsiString; BPB: IBPB): IBlob; |
762 |
+ |
begin |
763 |
+ |
Result := CreateBlob(transaction,GetBlobMetaData(Transaction,RelationName,ColumnName),BPB); |
764 |
+ |
end; |
765 |
+ |
|
766 |
+ |
function TFBAttachment.OpenBlob(transaction: ITransaction; RelationName, |
767 |
+ |
ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB): IBlob; |
768 |
+ |
begin |
769 |
+ |
Result := OpenBlob(Transaction, |
770 |
+ |
GetBlobMetaData(Transaction,RelationName,ColumnName), |
771 |
+ |
BlobID,BPB); |
772 |
+ |
end; |
773 |
+ |
|
774 |
|
function TFBAttachment.OpenBlob(transaction: ITransaction; Field: ISQLData; |
775 |
|
BPB: IBPB): IBlob; |
776 |
|
begin |
777 |
|
Result := OpenBlob(Transaction,Field.GetBlobMetadata, Field.AsQuad,BPB); |
778 |
|
end; |
779 |
|
|
780 |
+ |
function TFBAttachment.CreateArray(transaction: ITransaction; RelationName, |
781 |
+ |
ColumnName: AnsiString): IArray; |
782 |
+ |
begin |
783 |
+ |
Result := CreateArray(transaction,GetArrayMetaData(transaction,RelationName,ColumnName)); |
784 |
+ |
end; |
785 |
+ |
|
786 |
+ |
function TFBAttachment.OpenArray(transaction: ITransaction; RelationName, |
787 |
+ |
ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; |
788 |
+ |
begin |
789 |
+ |
Result := OpenArray(transaction, |
790 |
+ |
GetArrayMetaData(transaction,RelationName,ColumnName),ArrayID); |
791 |
+ |
end; |
792 |
+ |
|
793 |
+ |
function TFBAttachment.GetDBInformation(Requests: array of byte |
794 |
+ |
): IDBInformation; |
795 |
+ |
var ReqBuffer: PByte; |
796 |
+ |
i: integer; |
797 |
+ |
begin |
798 |
+ |
CheckHandle; |
799 |
+ |
if Length(Requests) = 1 then |
800 |
+ |
Result := GetDBInformation(Requests[0]) |
801 |
+ |
else |
802 |
+ |
begin |
803 |
+ |
GetMem(ReqBuffer,Length(Requests)); |
804 |
+ |
try |
805 |
+ |
for i := 0 to Length(Requests) - 1 do |
806 |
+ |
ReqBuffer[i] := Requests[i]; |
807 |
+ |
|
808 |
+ |
Result := GetDBInfo(ReqBuffer,Length(Requests)); |
809 |
+ |
|
810 |
+ |
finally |
811 |
+ |
FreeMem(ReqBuffer); |
812 |
+ |
end; |
813 |
+ |
end; |
814 |
+ |
end; |
815 |
+ |
|
816 |
+ |
function TFBAttachment.GetDBInformation(Request: byte): IDBInformation; |
817 |
+ |
begin |
818 |
+ |
CheckHandle; |
819 |
+ |
Result := GetDBInfo(@Request,1); |
820 |
+ |
end; |
821 |
+ |
|
822 |
+ |
function TFBAttachment.GetDBInformation(Requests: IDIRB): IDBInformation; |
823 |
+ |
begin |
824 |
+ |
CheckHandle; |
825 |
+ |
with Requests as TDIRB do |
826 |
+ |
Result := GetDBInfo(getBuffer,getDataLength); |
827 |
+ |
end; |
828 |
+ |
|
829 |
|
function TFBAttachment.GetConnectString: AnsiString; |
830 |
|
begin |
831 |
|
Result := FDatabaseName; |
836 |
|
Result := FRemoteProtocol; |
837 |
|
end; |
838 |
|
|
839 |
+ |
function TFBAttachment.GetAuthenticationMethod: AnsiString; |
840 |
+ |
begin |
841 |
+ |
Result := FAuthMethod; |
842 |
+ |
end; |
843 |
+ |
|
844 |
+ |
function TFBAttachment.GetSecurityDatabase: AnsiString; |
845 |
+ |
begin |
846 |
+ |
Result := FSecDatabase; |
847 |
+ |
end; |
848 |
+ |
|
849 |
|
function TFBAttachment.GetODSMajorVersion: integer; |
850 |
|
begin |
851 |
|
Result := FODSMajorVersion; |
856 |
|
Result := FODSMinorVersion; |
857 |
|
end; |
858 |
|
|
859 |
+ |
function TFBAttachment.HasDecFloatSupport: boolean; |
860 |
+ |
begin |
861 |
+ |
Result := false; |
862 |
+ |
end; |
863 |
+ |
|
864 |
|
function TFBAttachment.HasDefaultCharSet: boolean; |
865 |
|
begin |
866 |
|
Result := FHasDefaultCharSet |
940 |
|
begin |
941 |
|
Result := false; |
942 |
|
for i := Low(CharSetMap) to High(CharSetMap) do |
943 |
< |
if AnsiCompareStr(CharSetMap[i].CharSetName, CharSetName) = 0 then |
943 |
> |
if AnsiCompareText(CharSetMap[i].CharSetName, CharSetName) = 0 then |
944 |
|
begin |
945 |
|
CharSetID := CharSetMap[i].CharSetID; |
946 |
|
Result := true; |
948 |
|
end; |
949 |
|
|
950 |
|
for i := 0 to Length(FUserCharSetMap) - 1 do |
951 |
< |
if AnsiCompareStr(FUserCharSetMap[i].CharSetName, CharSetName) = 0 then |
951 |
> |
if AnsiCompareText(FUserCharSetMap[i].CharSetName, CharSetName) = 0 then |
952 |
|
begin |
953 |
|
CharSetID := FUserCharSetMap[i].CharSetID; |
954 |
|
Result := true; |
1005 |
|
CharSetID := CharSets[0].AsInteger; |
1006 |
|
end; |
1007 |
|
|
1008 |
+ |
function TFBAttachment.GetTimeZoneServices: ITimeZoneServices; |
1009 |
+ |
begin |
1010 |
+ |
IBError(ibxeNotSupported,[]); |
1011 |
+ |
end; |
1012 |
+ |
|
1013 |
+ |
function TFBAttachment.HasTimeZoneSupport: boolean; |
1014 |
+ |
begin |
1015 |
+ |
Result := false; |
1016 |
+ |
end; |
1017 |
+ |
|
1018 |
+ |
{ TDPBItem } |
1019 |
+ |
|
1020 |
+ |
function TDPBItem.getParamTypeName: AnsiString; |
1021 |
+ |
begin |
1022 |
+ |
Result := DPBPrefix + DPBConstantNames[getParamType]; |
1023 |
+ |
end; |
1024 |
+ |
|
1025 |
+ |
{ TDPB } |
1026 |
+ |
|
1027 |
+ |
constructor TDPB.Create(api: TFBClientAPI); |
1028 |
+ |
begin |
1029 |
+ |
inherited Create(api); |
1030 |
+ |
FDataLength := 1; |
1031 |
+ |
FBuffer^ := isc_dpb_version1; |
1032 |
+ |
end; |
1033 |
+ |
|
1034 |
+ |
function TDPB.GetDPBParamTypeName(ParamType: byte): Ansistring; |
1035 |
+ |
begin |
1036 |
+ |
if ParamType <= isc_dpb_last_dpb_constant then |
1037 |
+ |
Result := DPBConstantNames[ParamType] |
1038 |
+ |
else |
1039 |
+ |
Result := ''; |
1040 |
+ |
end; |
1041 |
+ |
|
1042 |
+ |
function TDPB.LookupItemType(ParamTypeName: AnsiString): byte; |
1043 |
+ |
var i: byte; |
1044 |
+ |
begin |
1045 |
+ |
Result := 0; |
1046 |
+ |
ParamTypeName := LowerCase(ParamTypeName); |
1047 |
+ |
if (Pos(DPBPrefix, ParamTypeName) = 1) then |
1048 |
+ |
Delete(ParamTypeName, 1, Length(DPBPrefix)); |
1049 |
+ |
|
1050 |
+ |
for i := 1 to isc_dpb_last_dpb_constant do |
1051 |
+ |
if (ParamTypeName = DPBConstantNames[i]) then |
1052 |
+ |
begin |
1053 |
+ |
Result := i; |
1054 |
+ |
break; |
1055 |
+ |
end; |
1056 |
+ |
end; |
1057 |
+ |
|
1058 |
|
end. |
1059 |
|
|