00001 {*********************************************************}
00002 { }
00003 { Zeos Database Objects }
00004 { Abstract Database Connectivity Classes }
00005 { }
00006 { Originally written by Sergey Seroukhov }
00007 { }
00008 {*********************************************************}
00009
00010 {@********************************************************}
00011 { Copyright (c) 1999-2006 Zeos Development Group }
00012 { }
00013 { License Agreement: }
00014 { }
00015 { This library is distributed in the hope that it will be }
00016 { useful, but WITHOUT ANY WARRANTY; without even the }
00017 { implied warranty of MERCHANTABILITY or FITNESS FOR }
00018 { A PARTICULAR PURPOSE. See the GNU Lesser General }
00019 { Public License for more details. }
00020 { }
00021 { The source code of the ZEOS Libraries and packages are }
00022 { distributed under the Library GNU General Public }
00023 { License (see the file COPYING / COPYING.ZEOS) }
00024 { with the following modification: }
00025 { As a special exception, the copyright holders of this }
00026 { library give you permission to link this library with }
00027 { independent modules to produce an executable, }
00028 { regardless of the license terms of these independent }
00029 { modules, and to copy and distribute the resulting }
00030 { executable under terms of your choice, provided that }
00031 { you also meet, for each linked independent module, }
00032 { the terms and conditions of the license of that module. }
00033 { An independent module is a module which is not derived }
00034 { from or based on this library. If you modify this }
00035 { library, you may extend this exception to your version }
00036 { of the library, but you are not obligated to do so. }
00037 { If you do not wish to do so, delete this exception }
00038 { statement from your version. }
00039 { }
00040 { }
00041 { The project web site is located on: }
00042 { http:
00043 { http:
00044 { svn:
00045 { }
00046 { http:
00047 { http:
00048 { }
00049 { }
00050 { }
00051 { Zeos Development Group. }
00052 {********************************************************@}
00053
00054 unit ZDbcMetadata;
00055
00056 interface
00057
00058 {$I ZDbc.inc}
00059
00060 uses
00061 {$IFNDEF VER130BELOW}
00062 Types,
00063 {$ENDIF}
00064 {$IFDEF VER130BELOW}
00065 {$IFDEF WIN32}
00066 Comobj,
00067 {$ENDIF}
00068 {$ENDIF}
00069 Classes, SysUtils, Contnrs, ZSysUtils, ZClasses, ZDbcIntfs,
00070 ZDbcResultSetMetadata, ZDbcCachedResultSet, ZDbcCache, ZCompatibility,
00071 ZSelectSchema;
00072
00073 const
00074 procedureColumnUnknown = 0;
00075 procedureColumnIn = 1;
00076 procedureColumnInOut = 2;
00077 procedureColumnOut = 4;
00078 procedureColumnReturn = 5;
00079 procedureColumnResult = 3;
00080 procedureNoNulls = 0;
00081 procedureNullable = 1;
00082 procedureNullableUnknown = 2;
00083
00084 type
00085 TZWildcardsSet= set of Char;
00086
00087 {** Defines a metadata resultset column definition. }
00088 TZMetadataColumnDef = packed record
00089 Name: string;
00090 SQLType: TZSQLType;
00091 Length: Integer
00092 end;
00093
00094 {** Defines a dynamic array of metadata column definitions. }
00095 TZMetadataColumnDefs = array of TZMetadataColumnDef;
00096
00097 {** Represents a Virtual ResultSet interface. }
00098 IZVirtualResultSet = interface(IZCachedResultSet)
00099 ['{D84055AC-BCD5-40CD-B408-6F11AF000C96}']
00100 procedure SetType(Value: TZResultSetType);
00101 procedure SetConcurrency(Value: TZResultSetConcurrency);
00102 end;
00103
00104 {** Implements Virtual ResultSet. }
00105 TZVirtualResultSet = class(TZAbstractCachedResultSet, IZVirtualResultSet)
00106 protected
00107 procedure CalculateRowDefaults(RowAccessor: TZRowAccessor); override;
00108 procedure PostRowUpdates(OldRowAccessor, NewRowAccessor: TZRowAccessor);
00109 override;
00110 public
00111 constructor CreateWithStatement(const SQL: string; Statement: IZStatement);
00112 constructor CreateWithColumns(ColumnsInfo: TObjectList; const SQL: string);
00113 destructor Destroy; override;
00114 end;
00115
00116 {** Implements Abstract Database Metadata. }
00117 TZAbstractDatabaseMetadata = class(TContainedObject, IZDatabaseMetadata)
00118 private
00119 FConnection: Pointer;
00120 FUrl: string;
00121 FInfo: TStrings;
00122 FCachedResultSets: IZHashMap;
00123 protected
00124 WildcardsArray: array of char;
00125 { Metadata ResultSets Caching. }
00126 procedure AddResultSetToCache(const Key: string; ResultSet: IZResultSet);
00127 function GetResultSetFromCache(const Key: string): IZResultSet;
00128 function ConstructVirtualResultSet(ColumnsDefs: TZMetadataColumnDefs):
00129 IZVirtualResultSet;
00130 function CopyToVirtualResultSet(SrcResultSet: IZResultSet;
00131 DestResultSet: IZVirtualResultSet): IZVirtualResultSet;
00132 function CloneCachedResultSet(ResultSet: IZResultSet): IZResultSet;
00133
00134 function AddEscapeCharToWildcards(const Pattern:string): string;
00135 function GetWildcardsSet:TZWildcardsSet;
00136 procedure FillWildcards; virtual;
00137
00138
00139 property Url: string read FUrl;
00140 property Info: TStrings read FInfo;
00141 property CachedResultSets: IZHashMap read FCachedResultSets
00142 write FCachedResultSets;
00143
00144 protected
00145 function UncachedGetTables(const Catalog: string; const SchemaPattern: string;
00146 const TableNamePattern: string; const Types: TStringDynArray): IZResultSet; virtual;
00147 function UncachedGetSchemas: IZResultSet; virtual;
00148 function UncachedGetCatalogs: IZResultSet; virtual;
00149 function UncachedGetTableTypes: IZResultSet; virtual;
00150 function UncachedGetColumns(const Catalog: string; const SchemaPattern: string;
00151 const TableNamePattern: string; const ColumnNamePattern: string): IZResultSet; virtual;
00152 function UncachedGetTablePrivileges(const Catalog: string; const SchemaPattern: string;
00153 const TableNamePattern: string): IZResultSet; virtual;
00154 function UncachedGetColumnPrivileges(const Catalog: string; const Schema: string;
00155 const Table: string; const ColumnNamePattern: string): IZResultSet; virtual;
00156
00157 function UncachedGetPrimaryKeys(const Catalog: string; const Schema: string;
00158 const Table: string): IZResultSet; virtual;
00159 function UncachedGetImportedKeys(const Catalog: string; const Schema: string;
00160 const Table: string): IZResultSet; virtual;
00161 function UncachedGetExportedKeys(const Catalog: string; const Schema: string;
00162 const Table: string): IZResultSet; virtual;
00163 function UncachedGetCrossReference(const PrimaryCatalog: string; const PrimarySchema: string;
00164 const PrimaryTable: string; const ForeignCatalog: string; const ForeignSchema: string;
00165 const ForeignTable: string): IZResultSet; virtual;
00166 function UncachedGetIndexInfo(const Catalog: string; const Schema: string; const Table: string;
00167 Unique: Boolean; Approximate: Boolean): IZResultSet; virtual;
00168 function UncachedGetSequences(const Catalog: string; const SchemaPattern: string;
00169 const SequenceNamePattern: string): IZResultSet; virtual;
00170 function UncachedGetProcedures(const Catalog: string; const SchemaPattern: string;
00171 const ProcedureNamePattern: string): IZResultSet; virtual;
00172 function UncachedGetProcedureColumns(const Catalog: string; const SchemaPattern: string;
00173 const ProcedureNamePattern: string; const ColumnNamePattern: string):
00174 IZResultSet; virtual;
00175 function UncachedGetBestRowIdentifier(const Catalog: string; const Schema: string;
00176 const Table: string; Scope: Integer; Nullable: Boolean): IZResultSet; virtual;
00177 function UncachedGetVersionColumns(const Catalog: string; const Schema: string;
00178 const Table: string): IZResultSet; virtual;
00179 function UncachedGetTypeInfo: IZResultSet; virtual;
00180 function UncachedGetUDTs(const Catalog: string; const SchemaPattern: string;
00181 const TypeNamePattern: string; const Types: TIntegerDynArray): IZResultSet; virtual;
00182
00183 public
00184 constructor Create(ParentConnection: IZConnection;
00185 const Url: string; Info: TStrings);
00186 destructor Destroy; override;
00187
00188 function AllProceduresAreCallable: Boolean; virtual;
00189 function AllTablesAreSelectable: Boolean; virtual;
00190 function GetURL: string; virtual;
00191 function GetUserName: string; virtual;
00192 function IsReadOnly: Boolean; virtual;
00193 function NullsAreSortedHigh: Boolean; virtual;
00194 function NullsAreSortedLow: Boolean; virtual;
00195 function NullsAreSortedAtStart: Boolean; virtual;
00196 function NullsAreSortedAtEnd: Boolean; virtual;
00197 function GetDatabaseProductName: string; virtual;
00198 function GetDatabaseProductVersion: string; virtual;
00199 function GetDriverName: string; virtual;
00200 function GetDriverVersion: string; virtual;
00201 function GetDriverMajorVersion: Integer; virtual;
00202 function GetDriverMinorVersion: Integer; virtual;
00203 function UsesLocalFiles: Boolean; virtual;
00204 function UsesLocalFilePerTable: Boolean; virtual;
00205 function SupportsMixedCaseIdentifiers: Boolean; virtual;
00206 function StoresUpperCaseIdentifiers: Boolean; virtual;
00207 function StoresLowerCaseIdentifiers: Boolean; virtual;
00208 function StoresMixedCaseIdentifiers: Boolean; virtual;
00209 function SupportsMixedCaseQuotedIdentifiers: Boolean; virtual;
00210 function StoresUpperCaseQuotedIdentifiers: Boolean; virtual;
00211 function StoresLowerCaseQuotedIdentifiers: Boolean; virtual;
00212 function StoresMixedCaseQuotedIdentifiers: Boolean; virtual;
00213 function GetIdentifierQuoteString: string; virtual;
00214 function GetSQLKeywords: string; virtual;
00215 function GetNumericFunctions: string; virtual;
00216 function GetStringFunctions: string; virtual;
00217 function GetSystemFunctions: string; virtual;
00218 function GetTimeDateFunctions: string; virtual;
00219 function GetSearchStringEscape: string; virtual;
00220 function GetExtraNameCharacters: string; virtual;
00221
00222 function SupportsAlterTableWithAddColumn: Boolean; virtual;
00223 function SupportsAlterTableWithDropColumn: Boolean; virtual;
00224 function SupportsColumnAliasing: Boolean; virtual;
00225 function NullPlusNonNullIsNull: Boolean; virtual;
00226 function SupportsConvert: Boolean; virtual;
00227 function SupportsConvertForTypes(FromType: TZSQLType; ToType: TZSQLType):
00228 Boolean; virtual;
00229 function SupportsTableCorrelationNames: Boolean; virtual;
00230 function SupportsDifferentTableCorrelationNames: Boolean; virtual;
00231 function SupportsExpressionsInOrderBy: Boolean; virtual;
00232 function SupportsOrderByUnrelated: Boolean; virtual;
00233 function SupportsGroupBy: Boolean; virtual;
00234 function SupportsGroupByUnrelated: Boolean; virtual;
00235 function SupportsGroupByBeyondSelect: Boolean; virtual;
00236 function SupportsLikeEscapeClause: Boolean; virtual;
00237 function SupportsMultipleResultSets: Boolean; virtual;
00238 function SupportsMultipleTransactions: Boolean; virtual;
00239 function SupportsNonNullableColumns: Boolean; virtual;
00240 function SupportsMinimumSQLGrammar: Boolean; virtual;
00241 function SupportsCoreSQLGrammar: Boolean; virtual;
00242 function SupportsExtendedSQLGrammar: Boolean; virtual;
00243 function SupportsANSI92EntryLevelSQL: Boolean; virtual;
00244 function SupportsANSI92IntermediateSQL: Boolean; virtual;
00245 function SupportsANSI92FullSQL: Boolean; virtual;
00246 function SupportsIntegrityEnhancementFacility: Boolean; virtual;
00247 function SupportsOuterJoins: Boolean; virtual;
00248 function SupportsFullOuterJoins: Boolean; virtual;
00249 function SupportsLimitedOuterJoins: Boolean; virtual;
00250 function GetSchemaTerm: string; virtual;
00251 function GetProcedureTerm: string; virtual;
00252 function GetCatalogTerm: string; virtual;
00253 function IsCatalogAtStart: Boolean; virtual;
00254 function GetCatalogSeparator: string; virtual;
00255 function SupportsSchemasInDataManipulation: Boolean; virtual;
00256 function SupportsSchemasInProcedureCalls: Boolean; virtual;
00257 function SupportsSchemasInTableDefinitions: Boolean; virtual;
00258 function SupportsSchemasInIndexDefinitions: Boolean; virtual;
00259 function SupportsSchemasInPrivilegeDefinitions: Boolean; virtual;
00260 function SupportsCatalogsInDataManipulation: Boolean; virtual;
00261 function SupportsCatalogsInProcedureCalls: Boolean; virtual;
00262 function SupportsCatalogsInTableDefinitions: Boolean; virtual;
00263 function SupportsCatalogsInIndexDefinitions: Boolean; virtual;
00264 function SupportsCatalogsInPrivilegeDefinitions: Boolean; virtual;
00265 function SupportsPositionedDelete: Boolean; virtual;
00266 function SupportsPositionedUpdate: Boolean; virtual;
00267 function SupportsSelectForUpdate: Boolean; virtual;
00268 function SupportsStoredProcedures: Boolean; virtual;
00269 function SupportsSubqueriesInComparisons: Boolean; virtual;
00270 function SupportsSubqueriesInExists: Boolean; virtual;
00271 function SupportsSubqueriesInIns: Boolean; virtual;
00272 function SupportsSubqueriesInQuantifieds: Boolean; virtual;
00273 function SupportsCorrelatedSubqueries: Boolean; virtual;
00274 function SupportsUnion: Boolean; virtual;
00275 function SupportsUnionAll: Boolean; virtual;
00276 function SupportsOpenCursorsAcrossCommit: Boolean; virtual;
00277 function SupportsOpenCursorsAcrossRollback: Boolean; virtual;
00278 function SupportsOpenStatementsAcrossCommit: Boolean; virtual;
00279 function SupportsOpenStatementsAcrossRollback: Boolean; virtual;
00280
00281 function GetMaxBinaryLiteralLength: Integer; virtual;
00282 function GetMaxCharLiteralLength: Integer; virtual;
00283 function GetMaxColumnNameLength: Integer; virtual;
00284 function GetMaxColumnsInGroupBy: Integer; virtual;
00285 function GetMaxColumnsInIndex: Integer; virtual;
00286 function GetMaxColumnsInOrderBy: Integer; virtual;
00287 function GetMaxColumnsInSelect: Integer; virtual;
00288 function GetMaxColumnsInTable: Integer; virtual;
00289 function GetMaxConnections: Integer; virtual;
00290 function GetMaxCursorNameLength: Integer; virtual;
00291 function GetMaxIndexLength: Integer; virtual;
00292 function GetMaxSchemaNameLength: Integer; virtual;
00293 function GetMaxProcedureNameLength: Integer; virtual;
00294 function GetMaxCatalogNameLength: Integer; virtual;
00295 function GetMaxRowSize: Integer; virtual;
00296 function DoesMaxRowSizeIncludeBlobs: Boolean; virtual;
00297 function GetMaxStatementLength: Integer; virtual;
00298 function GetMaxStatements: Integer; virtual;
00299 function GetMaxTableNameLength: Integer; virtual;
00300 function GetMaxTablesInSelect: Integer; virtual;
00301 function GetMaxUserNameLength: Integer; virtual;
00302
00303 function GetDefaultTransactionIsolation: TZTransactIsolationLevel; virtual;
00304 function SupportsTransactions: Boolean; virtual;
00305 function SupportsTransactionIsolationLevel(Level: TZTransactIsolationLevel):
00306 Boolean; virtual;
00307 function SupportsDataDefinitionAndDataManipulationTransactions: Boolean; virtual;
00308 function SupportsDataManipulationTransactionsOnly: Boolean; virtual;
00309 function DataDefinitionCausesTransactionCommit: Boolean; virtual;
00310 function DataDefinitionIgnoredInTransactions: Boolean; virtual;
00311
00312 function GetTables(const Catalog: string; const SchemaPattern: string;
00313 const TableNamePattern: string; const Types: TStringDynArray): IZResultSet;
00314 function GetSchemas: IZResultSet;
00315 function GetCatalogs: IZResultSet;
00316 function GetTableTypes: IZResultSet;
00317 function GetColumns(const Catalog: string; const SchemaPattern: string;
00318 const TableNamePattern: string; const ColumnNamePattern: string): IZResultSet;
00319 function GetTablePrivileges(const Catalog: string; const SchemaPattern: string;
00320 const TableNamePattern: string): IZResultSet;
00321 function GetColumnPrivileges(const Catalog: string; const Schema: string;
00322 const Table: string; const ColumnNamePattern: string): IZResultSet;
00323 function GetPrimaryKeys(const Catalog: string; const Schema: string;
00324 const Table: string): IZResultSet;
00325 function GetImportedKeys(const Catalog: string; const Schema: string;
00326 const Table: string): IZResultSet;
00327 function GetExportedKeys(const Catalog: string; const Schema: string;
00328 const Table: string): IZResultSet;
00329 function GetCrossReference(const PrimaryCatalog: string; const PrimarySchema: string;
00330 const PrimaryTable: string; const ForeignCatalog: string; const ForeignSchema: string;
00331 const ForeignTable: string): IZResultSet;
00332 function GetIndexInfo(const Catalog: string; const Schema: string; const Table: string;
00333 Unique: Boolean; Approximate: Boolean): IZResultSet;
00334 function GetSequences(const Catalog: string; const SchemaPattern: string;
00335 const SequenceNamePattern: string): IZResultSet;
00336 function GetProcedures(const Catalog: string; const SchemaPattern: string;
00337 const ProcedureNamePattern: string): IZResultSet;
00338 function GetProcedureColumns(const Catalog: string; const SchemaPattern: string;
00339 const ProcedureNamePattern: string; const ColumnNamePattern: string):
00340 IZResultSet;
00341 function GetBestRowIdentifier(const Catalog: string; const Schema: string;
00342 const Table: string; Scope: Integer; Nullable: Boolean): IZResultSet;
00343 function GetVersionColumns(const Catalog: string; const Schema: string;
00344 const Table: string): IZResultSet;
00345 function GetTypeInfo: IZResultSet;
00346 function GetUDTs(const Catalog: string; const SchemaPattern: string;
00347 const TypeNamePattern: string; const Types: TIntegerDynArray): IZResultSet;
00348
00349
00350 function SupportsResultSetType(_Type: TZResultSetType): Boolean; virtual;
00351 function SupportsResultSetConcurrency(_Type: TZResultSetType;
00352 Concurrency: TZResultSetConcurrency): Boolean; virtual;
00353 function SupportsBatchUpdates: Boolean; virtual;
00354
00355
00356 function GetConnection: IZConnection; virtual;
00357
00358 function GetIdentifierConvertor: IZIdentifierConvertor; virtual;
00359 procedure ClearCache; overload;virtual;
00360 procedure ClearCache(const Key: string);overload;virtual;
00361
00362
00363 function GetTablesCacheKey(const Catalog: string; const SchemaPattern: string;
00364 const TableNamePattern: string; const Types: TStringDynArray): string;
00365 function GetSchemasCacheKey: string;
00366 function GetCatalogsCacheKey: string;
00367 function GetTableTypesCacheKey: string;
00368 function GetColumnsCacheKey(const Catalog: string; const SchemaPattern: string;
00369 const TableNamePattern: string; const ColumnNamePattern: string): string;
00370 function GetColumnPrivilegesCacheKey(const Catalog: string; const Schema: string;
00371 const Table: string; const ColumnNamePattern: string): string;
00372 function GetTablePrivilegesCacheKey(const Catalog: string; const SchemaPattern: string;
00373 const TableNamePattern: string): string;
00374 function GetPrimaryKeysCacheKey(const Catalog: string; const Schema: string;
00375 const Table: string): string;
00376 function GetImportedKeysCacheKey(const Catalog: string; const Schema: string;
00377 const Table: string): string;
00378 function GetExportedKeysCacheKey(const Catalog: string; const Schema: string;
00379 const Table: string): string;
00380 function GetCrossReferenceCacheKey(const PrimaryCatalog: string; const PrimarySchema: string;
00381 const PrimaryTable: string; const ForeignCatalog: string; const ForeignSchema: string;
00382 const ForeignTable: string): string;
00383 function GetIndexInfoCacheKey(const Catalog: string; const Schema: string; const Table: string;
00384 const Unique: Boolean; const Approximate: Boolean): string;
00385 function GetSequencesCacheKey(const Catalog: string; const SchemaPattern: string;
00386 const SequenceNamePattern: string): string;
00387 function GetProceduresCacheKey(const Catalog: string; const SchemaPattern: string;
00388 const ProcedureNamePattern: string): string;
00389 function GetProcedureColumnsCacheKey(const Catalog: string; const SchemaPattern: string;
00390 const ProcedureNamePattern: string; const ColumnNamePattern: string): string;
00391 function GetBestRowIdentifierCacheKey(const Catalog: string; const Schema: string;
00392 const Table: string; const Scope: Integer; const Nullable: Boolean): string;
00393 function GetVersionColumnsCacheKey(const Catalog: string; const Schema: string;
00394 const Table: string): string;
00395 function GetTypeInfoCacheKey: string;
00396 function GetUDTsCacheKey(const Catalog: string; const SchemaPattern: string;
00397 const TypeNamePattern: string; const Types: TIntegerDynArray): string;
00398
00399 procedure GetCacheKeys(List: TStrings);
00400
00401 end;
00402
00403 {** Implements a default Case Sensitive/Unsensitive identifier convertor. }
00404 TZDefaultIdentifierConvertor = class (TZAbstractObject,
00405 IZIdentifierConvertor)
00406 private
00407 FMetadata: IZDatabaseMetadata;
00408 protected
00409 property Metadata: IZDatabaseMetadata read FMetadata write FMetadata;
00410
00411 function IsLowerCase(const Value: string): Boolean;
00412 function IsUpperCase(const Value: string): Boolean;
00413 function IsSpecialCase(const Value: string): Boolean;
00414 public
00415 constructor Create(Metadata: IZDatabaseMetadata);
00416
00417 function IsCaseSensitive(const Value: string): Boolean;
00418 function IsQuoted(const Value: string): Boolean;
00419 function Quote(const Value: string): string;
00420 function ExtractQuote(const Value: string): string;
00421 end;
00422
00423 function GetTablesMetaDataCacheKey(Const Catalog:String;
00424 Const SchemaPattern:String; Const TableNamePattern:String;const Types: TStringDynArray):String;
00425 {$IFNDEF VER130BELOW}deprecated; {$ENDIF}
00426
00427
00428 var
00429 ProceduresColumnsDynArray: TZMetadataColumnDefs;
00430 ProceduresColColumnsDynArray: TZMetadataColumnDefs;
00431 TableColumnsDynArray: TZMetadataColumnDefs;
00432 SchemaColumnsDynArray: TZMetadataColumnDefs;
00433 CatalogColumnsDynArray: TZMetadataColumnDefs;
00434 TableTypeColumnsDynArray: TZMetadataColumnDefs;
00435 TableColColumnsDynArray: TZMetadataColumnDefs;
00436 TableColPrivColumnsDynArray: TZMetadataColumnDefs;
00437 TablePrivColumnsDynArray: TZMetadataColumnDefs;
00438 BestRowIdentColumnsDynArray: TZMetadataColumnDefs;
00439 TableColVerColumnsDynArray: TZMetadataColumnDefs;
00440 PrimaryKeyColumnsDynArray: TZMetadataColumnDefs;
00441 ImportedKeyColumnsDynArray: TZMetadataColumnDefs;
00442 ExportedKeyColumnsDynArray: TZMetadataColumnDefs;
00443 CrossRefColumnsDynArray: TZMetadataColumnDefs;
00444 TypeInfoColumnsDynArray: TZMetadataColumnDefs;
00445 IndexInfoColumnsDynArray: TZMetadataColumnDefs;
00446 SequenceColumnsDynArray: TZMetadataColumnDefs;
00447 UDTColumnsDynArray: TZMetadataColumnDefs;
00448
00449 implementation
00450
00451 uses ZVariant, ZCollections;
00452
00453 { TZAbstractDatabaseMetadata }
00454
00455 {**
00456 Constructs this object and assignes the main properties.
00457 @param Connection a database connection object.
00458 @param Url a database connection url string.
00459 @param Info an extra connection properties.
00460 }
00461 constructor TZAbstractDatabaseMetadata.Create(
00462 ParentConnection: IZConnection; const Url: string; Info: TStrings);
00463 begin
00464 inherited Create(ParentConnection);
00465 FConnection := Pointer(ParentConnection);
00466 FUrl := Url;
00467 FInfo := Info;
00468 FCachedResultSets := TZHashMap.Create;
00469 FillWildcards;
00470 end;
00471
00472 {** Destroys this object and cleanups the memory.
00473 }
00474 destructor TZAbstractDatabaseMetadata.Destroy;
00475 begin
00476 FCachedResultSets.Clear;
00477 FCachedResultSets := nil;
00478
00479 inherited Destroy;
00480 end;
00481
00482 {**
00483 Retrieves the connection that produced this metadata object.
00484 @return the connection that produced this metadata object
00485 }
00486 function TZAbstractDatabaseMetadata.GetConnection: IZConnection;
00487 begin
00488 Result := IZConnection(FConnection);
00489 end;
00490
00491 {**
00492 Constructs a virtual result set object.
00493 @param ColumnsDefs an array of column definition objects.
00494 @return a created result set.
00495 }
00496 function TZAbstractDatabaseMetadata.ConstructVirtualResultSet(
00497 ColumnsDefs: TZMetadataColumnDefs): IZVirtualResultSet;
00498 var
00499 I: Integer;
00500 ColumnInfo: TZColumnInfo;
00501 ColumnsInfo: TObjectList;
00502 begin
00503 ColumnsInfo := TObjectList.Create;
00504 try
00505 for I := 0 to High(ColumnsDefs) do
00506 begin
00507 ColumnInfo := TZColumnInfo.Create;
00508 with ColumnInfo do
00509 begin
00510 ColumnLabel := ColumnsDefs[I].Name;
00511 ColumnType := ColumnsDefs[I].SQLType;
00512 ColumnDisplaySize := ColumnsDefs[I].Length;
00513 Precision := ColumnsDefs[I].Length;
00514 end;
00515 ColumnsInfo.Add(ColumnInfo);
00516 end;
00517
00518 Result := TZVirtualResultSet.CreateWithColumns(ColumnsInfo, '');
00519 with Result do
00520 begin
00521 SetType(rtScrollInsensitive);
00522 SetConcurrency(rcUpdatable);
00523 end;
00524 finally
00525 ColumnsInfo.Free;
00526 end;
00527 end;
00528
00529 {**
00530 Clears all cached metadata.
00531 }
00532 procedure TZAbstractDatabaseMetadata.ClearCache;
00533 begin
00534 FCachedResultSets.Clear;
00535 end;
00536
00537 {**
00538 Clears specific cached metadata.
00539 }
00540 procedure TZAbstractDatabaseMetadata.ClearCache(const Key: string);
00541 var
00542 TempKey: IZAnyValue;
00543 begin
00544 TempKey := TZAnyValue.CreateWithString(Key);
00545 FCachedResultSets.Remove(TempKey);
00546 end;
00547
00548 {**
00549 Adds resultset to the internal cache.
00550 @param Key a resultset unique key value.
00551 @param ResultSet a resultset interface.
00552 }
00553 procedure TZAbstractDatabaseMetadata.AddResultSetToCache(const Key: string;
00554 ResultSet: IZResultSet);
00555 var
00556 TempKey: IZAnyValue;
00557 begin
00558 TempKey := TZAnyValue.CreateWithString(Key);
00559 FCachedResultSets.Put(TempKey, CloneCachedResultSet(ResultSet));
00560 end;
00561
00562 {**
00563 Gets a resultset interface from the internal cache by key.
00564 @param Key a resultset unique key value.
00565 @returns a cached resultset interface or <code>nil</code> otherwise.
00566 }
00567 function TZAbstractDatabaseMetadata.GetResultSetFromCache(
00568 const Key: string): IZResultSet;
00569 var
00570 TempKey: IZAnyValue;
00571 begin
00572 TempKey := TZAnyValue.CreateWithString(Key);
00573 Result := FCachedResultSets.Get(TempKey) as IZResultSet;
00574 if Result <> nil then
00575 Result := CloneCachedResultSet(Result);
00576 end;
00577
00578 {**
00579 Copies on result set to another one from the current position.
00580 @param SrcResultSet a source result set.
00581 @param DestResultSet a destination result set.
00582 @returns a destination result set.
00583 }
00584 function TZAbstractDatabaseMetadata.CopyToVirtualResultSet(
00585 SrcResultSet: IZResultSet; DestResultSet: IZVirtualResultSet):
00586 IZVirtualResultSet;
00587 var
00588 I: Integer;
00589 Metadata: IZResultSetMetadata;
00590 begin
00591 DestResultSet.SetType(rtScrollInsensitive);
00592 DestResultSet.SetConcurrency(rcUpdatable);
00593
00594 Metadata := SrcResultSet.GetMetadata;
00595 while SrcResultSet.Next do
00596 begin
00597 DestResultSet.MoveToInsertRow;
00598 for I := 1 to Metadata.GetColumnCount do
00599 begin
00600 case Metadata.GetColumnType(I) of
00601 stBoolean:
00602 DestResultSet.UpdateBoolean(I, SrcResultSet.GetBoolean(I));
00603 stByte:
00604 DestResultSet.UpdateByte(I, SrcResultSet.GetByte(I));
00605 stShort:
00606 DestResultSet.UpdateShort(I, SrcResultSet.GetShort(I));
00607 stInteger:
00608 DestResultSet.UpdateInt(I, SrcResultSet.GetInt(I));
00609 stLong:
00610 DestResultSet.UpdateLong(I, SrcResultSet.GetLong(I));
00611 stFloat:
00612 DestResultSet.UpdateFloat(I, SrcResultSet.GetFloat(I));
00613 stDouble:
00614 DestResultSet.UpdateDouble(I, SrcResultSet.GetDouble(I));
00615 stBigDecimal:
00616 DestResultSet.UpdateBigDecimal(I, SrcResultSet.GetBigDecimal(I));
00617 stString:
00618 DestResultSet.UpdateString(I, SrcResultSet.GetString(I));
00619 stUnicodeString:
00620 DestResultSet.UpdateUnicodeString(I, SrcResultSet.GetUnicodeString(I));
00621 stBytes:
00622 DestResultSet.UpdateBytes(I, SrcResultSet.GetBytes(I));
00623 stDate:
00624 DestResultSet.UpdateDate(I, SrcResultSet.GetDate(I));
00625 stTime:
00626 DestResultSet.UpdateTime(I, SrcResultSet.GetTime(I));
00627 stTimestamp:
00628 DestResultSet.UpdateTimestamp(I, SrcResultSet.GetTimestamp(I));
00629 stAsciiStream,
00630 stUnicodeStream,
00631 stBinaryStream:
00632 DestResultSet.UpdateString(I, SrcResultSet.GetString(I));
00633 end;
00634 if SrcResultSet.WasNull then
00635 DestResultSet.UpdateNull(I);
00636 end;
00637 DestResultSet.InsertRow;
00638 end;
00639
00640 DestResultSet.BeforeFirst;
00641 DestResultSet.SetConcurrency(rcReadOnly);
00642 Result := DestResultSet;
00643 end;
00644
00645 {**
00646 Clones the cached resultset.
00647 @param ResultSet the resultset to be cloned.
00648 @returns the clone of the specified resultset.
00649 }
00650 function TZAbstractDatabaseMetadata.CloneCachedResultSet(
00651 ResultSet: IZResultSet): IZResultSet;
00652 var
00653 I: Integer;
00654 Metadata: IZResultSetMetadata;
00655 ColumnInfo: TZColumnInfo;
00656 ColumnsInfo: TObjectList;
00657 begin
00658 Result := nil;
00659 Metadata := ResultSet.GetMetadata;
00660 ColumnsInfo := TObjectList.Create;
00661 try
00662 for I := 1 to Metadata.GetColumnCount do
00663 begin
00664 ColumnInfo := TZColumnInfo.Create;
00665 with ColumnInfo do
00666 begin
00667 ColumnLabel := Metadata.GetColumnLabel(I);
00668 ColumnType := Metadata.GetColumnType(I);
00669 ColumnDisplaySize := Metadata.GetPrecision(I);
00670 Precision := Metadata.GetPrecision(I);
00671 end;
00672 ColumnsInfo.Add(ColumnInfo);
00673 end;
00674
00675 ResultSet.BeforeFirst;
00676 Result := CopyToVirtualResultSet(ResultSet,
00677 TZVirtualResultSet.CreateWithColumns(ColumnsInfo, ''));
00678 ResultSet.BeforeFirst;
00679 finally
00680 ColumnsInfo.Free;
00681 end;
00682 end;
00683
00684
00685
00686
00687
00688 {**
00689 Can all the procedures returned by getProcedures be called by the
00690 current user?
00691 @return <code>true</code> if so; <code>false</code> otherwise
00692 }
00693 function TZAbstractDatabaseMetadata.AllProceduresAreCallable: Boolean;
00694 begin
00695 Result := True;
00696 end;
00697
00698 {**
00699 Can all the tables returned by getTable be SELECTed by the
00700 current user?
00701 @return <code>true</code> if so; <code>false</code> otherwise
00702 }
00703 function TZAbstractDatabaseMetadata.AllTablesAreSelectable: Boolean;
00704 begin
00705 Result := True;
00706 end;
00707
00708 {**
00709 What's the url for this database?
00710 @return the url or null if it cannot be generated
00711 }
00712 function TZAbstractDatabaseMetadata.GetURL: string;
00713 begin
00714 Result := FUrl;
00715 end;
00716
00717 {**
00718 What's our user name as known to the database?
00719 @return our database user name
00720 }
00721 function TZAbstractDatabaseMetadata.GetUserName: string;
00722 begin
00723 Result := FInfo.Values['UID'];
00724 if Result = '' then
00725 Result := FInfo.Values['username'];
00726 end;
00727
00728 {**
00729 Is the database in read-only mode?
00730 @return <code>true</code> if so; <code>false</code> otherwise
00731 }
00732 function TZAbstractDatabaseMetadata.IsReadOnly: Boolean;
00733 begin
00734 Result := False;
00735 end;
00736
00737 {**
00738 Are NULL values sorted high?
00739 @return <code>true</code> if so; <code>false</code> otherwise
00740 }
00741 function TZAbstractDatabaseMetadata.NullsAreSortedHigh: Boolean;
00742 begin
00743 Result := False;
00744 end;
00745
00746 {**
00747 Are NULL values sorted low?
00748 @return <code>true</code> if so; <code>false</code> otherwise
00749 }
00750 function TZAbstractDatabaseMetadata.NullsAreSortedLow: Boolean;
00751 begin
00752 Result := False;
00753 end;
00754
00755 {**
00756 Are NULL values sorted at the start regardless of sort order?
00757 @return <code>true</code> if so; <code>false</code> otherwise
00758 }
00759 function TZAbstractDatabaseMetadata.NullsAreSortedAtStart: Boolean;
00760 begin
00761 Result := False;
00762 end;
00763
00764 {**
00765 Are NULL values sorted at the end regardless of sort order?
00766 @return <code>true</code> if so; <code>false</code> otherwise
00767 }
00768 function TZAbstractDatabaseMetadata.NullsAreSortedAtEnd: Boolean;
00769 begin
00770 Result := False;
00771 end;
00772
00773 {**
00774 What's the name of this database product?
00775 @return database product name
00776 }
00777 function TZAbstractDatabaseMetadata.GetDatabaseProductName: string;
00778 begin
00779 Result := '';
00780 end;
00781
00782 {**
00783 What's the version of this database product?
00784 @return database version
00785 }
00786 function TZAbstractDatabaseMetadata.GetDatabaseProductVersion: string;
00787 begin
00788 Result := '';
00789 end;
00790
00791 {**
00792 What's the name of this JDBC driver?
00793 @return JDBC driver name
00794 }
00795 function TZAbstractDatabaseMetadata.GetDriverName: string;
00796 begin
00797 Result := 'Zeos Database Connectivity Driver';
00798 end;
00799
00800 {**
00801 What's the version of this JDBC driver?
00802 @return JDBC driver version
00803 }
00804 function TZAbstractDatabaseMetadata.GetDriverVersion: string;
00805 begin
00806 Result := Format('%d.%d', [GetDriverMajorVersion, GetDriverMinorVersion]);
00807 end;
00808
00809 {**
00810 What's this JDBC driver's major version number?
00811 @return JDBC driver major version
00812 }
00813 function TZAbstractDatabaseMetadata.GetDriverMajorVersion: Integer;
00814 begin
00815 Result := 1;
00816 end;
00817
00818 {**
00819 What's this JDBC driver's minor version number?
00820 @return JDBC driver minor version number
00821 }
00822 function TZAbstractDatabaseMetadata.GetDriverMinorVersion: Integer;
00823 begin
00824 Result := 0;
00825 end;
00826
00827 {**
00828 Does the database store tables in a local file?
00829 @return <code>true</code> if so; <code>false</code> otherwise
00830 }
00831 function TZAbstractDatabaseMetadata.UsesLocalFiles: Boolean;
00832 begin
00833 Result := True;
00834 end;
00835
00836 {**
00837 Does the database use a file for each table?
00838 @return true if the database uses a local file for each table
00839 }
00840 function TZAbstractDatabaseMetadata.UsesLocalFilePerTable: Boolean;
00841 begin
00842 Result := False;
00843 end;
00844
00845 {**
00846 Does the database treat mixed case unquoted SQL identifiers as
00847 case sensitive and as a result store them in mixed case?
00848 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return false.
00849 @return <code>true</code> if so; <code>false</code> otherwise
00850 }
00851 function TZAbstractDatabaseMetadata.SupportsMixedCaseIdentifiers: Boolean;
00852 begin
00853 Result := False;
00854 end;
00855
00856 {**
00857 Does the database treat mixed case unquoted SQL identifiers as
00858 case insensitive and store them in upper case?
00859 @return <code>true</code> if so; <code>false</code> otherwise
00860 }
00861 function TZAbstractDatabaseMetadata.StoresUpperCaseIdentifiers: Boolean;
00862 begin
00863 Result := False;
00864 end;
00865
00866 {**
00867 Does the database treat mixed case unquoted SQL identifiers as
00868 case insensitive and store them in lower case?
00869 @return <code>true</code> if so; <code>false</code> otherwise
00870 }
00871 function TZAbstractDatabaseMetadata.StoresLowerCaseIdentifiers: Boolean;
00872 begin
00873 Result := False;
00874 end;
00875
00876 {**
00877 Does the database treat mixed case unquoted SQL identifiers as
00878 case insensitive and store them in mixed case?
00879 @return <code>true</code> if so; <code>false</code> otherwise
00880 }
00881 function TZAbstractDatabaseMetadata.StoresMixedCaseIdentifiers: Boolean;
00882 begin
00883 Result := True;
00884 end;
00885
00886 {**
00887 Does the database treat mixed case quoted SQL identifiers as
00888 case sensitive and as a result store them in mixed case?
00889 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return true.
00890 @return <code>true</code> if so; <code>false</code> otherwise
00891 }
00892 function TZAbstractDatabaseMetadata.SupportsMixedCaseQuotedIdentifiers: Boolean;
00893 begin
00894 Result := True;
00895 end;
00896
00897 {**
00898 Does the database treat mixed case quoted SQL identifiers as
00899 case insensitive and store them in upper case?
00900 @return <code>true</code> if so; <code>false</code> otherwise
00901 }
00902 function TZAbstractDatabaseMetadata.StoresUpperCaseQuotedIdentifiers: Boolean;
00903 begin
00904 Result := False;
00905 end;
00906
00907 {**
00908 Does the database treat mixed case quoted SQL identifiers as
00909 case insensitive and store them in lower case?
00910 @return <code>true</code> if so; <code>false</code> otherwise
00911 }
00912 function TZAbstractDatabaseMetadata.StoresLowerCaseQuotedIdentifiers: Boolean;
00913 begin
00914 Result := False;
00915 end;
00916
00917 {**
00918 Does the database treat mixed case quoted SQL identifiers as
00919 case insensitive and store them in mixed case?
00920 @return <code>true</code> if so; <code>false</code> otherwise
00921 }
00922 function TZAbstractDatabaseMetadata.StoresMixedCaseQuotedIdentifiers: Boolean;
00923 begin
00924 Result := False;
00925 end;
00926
00927 {**
00928 What's the string used to quote SQL identifiers?
00929 This returns a space " " if identifier quoting isn't supported.
00930 A JDBC Compliant<sup><font size=-2>TM</font></sup>
00931 driver always uses a double quote character.
00932 @return the quoting string
00933 }
00934 function TZAbstractDatabaseMetadata.GetIdentifierQuoteString: string;
00935 begin
00936 Result := '"';
00937 end;
00938
00939 {**
00940 Gets a comma-separated list of all a database's SQL keywords
00941 that are NOT also SQL92 keywords.
00942 @return the list
00943 }
00944 function TZAbstractDatabaseMetadata.GetSQLKeywords: string;
00945 begin
00946 Result := '';
00947 end;
00948
00949 {**
00950 Gets a comma-separated list of math functions. These are the
00951 X/Open CLI math function names used in the JDBC function escape
00952 clause.
00953 @return the list
00954 }
00955 function TZAbstractDatabaseMetadata.GetNumericFunctions: string;
00956 begin
00957 Result := '';
00958 end;
00959
00960 {**
00961 Gets a comma-separated list of string functions. These are the
00962 X/Open CLI string function names used in the JDBC function escape
00963 clause.
00964 @return the list
00965 }
00966 function TZAbstractDatabaseMetadata.GetStringFunctions: string;
00967 begin
00968 Result := '';
00969 end;
00970
00971 {**
00972 Gets a comma-separated list of system functions. These are the
00973 X/Open CLI system function names used in the JDBC function escape
00974 clause.
00975 @return the list
00976 }
00977 function TZAbstractDatabaseMetadata.GetSystemFunctions: string;
00978 begin
00979 Result := '';
00980 end;
00981
00982 {**
00983 Gets a comma-separated list of time and date functions.
00984 @return the list
00985 }
00986 function TZAbstractDatabaseMetadata.GetTimeDateFunctions: string;
00987 begin
00988 Result := '';
00989 end;
00990
00991 {**
00992 Gets the string that can be used to escape wildcard characters.
00993 This is the string that can be used to escape '_' or '%' in
00994 the string pattern style catalog search parameters.
00995
00996 <P>The '_' character represents any single character.
00997 <P>The '%' character represents any sequence of zero or
00998 more characters.
00999
01000 @return the string used to escape wildcard characters
01001 }
01002 function TZAbstractDatabaseMetadata.GetSearchStringEscape: string;
01003 begin
01004 Result := '%';
01005 end;
01006
01007 {**
01008 Gets all the "extra" characters that can be used in unquoted
01009 identifier names (those beyond a-z, A-Z, 0-9 and _).
01010 @return the string containing the extra characters
01011 }
01012 function TZAbstractDatabaseMetadata.GetExtraNameCharacters: string;
01013 begin
01014 Result := '';
01015 end;
01016
01017 //--------------------------------------------------------------------
01018 // Functions describing which features are supported.
01019
01020 {**
01021 Is "ALTER TABLE" with add column supported?
01022 @return <code>true</code> if so; <code>false</code> otherwise
01023 }
01024 function TZAbstractDatabaseMetadata.SupportsAlterTableWithAddColumn: Boolean;
01025 begin
01026 Result := True;
01027 end;
01028
01029 {**
01030 Is "ALTER TABLE" with drop column supported?
01031 @return <code>true</code> if so; <code>false</code> otherwise
01032 }
01033 function TZAbstractDatabaseMetadata.SupportsAlterTableWithDropColumn: Boolean;
01034 begin
01035 Result := True;
01036 end;
01037
01038 {**
01039 Is column aliasing supported?
01040
01041 <P>If so, the SQL AS clause can be used to provide names for
01042 computed columns or to provide alias names for columns as
01043 required.
01044 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01045 @return <code>true</code> if so; <code>false</code> otherwise
01046 }
01047 function TZAbstractDatabaseMetadata.SupportsColumnAliasing: Boolean;
01048 begin
01049 Result := True;
01050 end;
01051
01052 {**
01053 Are concatenations between NULL and non-NULL values NULL?
01054 For SQL-92 compliance, a JDBC technology-enabled driver will
01055 return <code>true</code>.
01056 @return <code>true</code> if so; <code>false</code> otherwise
01057 }
01058 function TZAbstractDatabaseMetadata.NullPlusNonNullIsNull: Boolean;
01059 begin
01060 Result := True;
01061 end;
01062
01063 {**
01064 Is the CONVERT function between SQL types supported?
01065 @return <code>true</code> if so; <code>false</code> otherwise
01066 }
01067 function TZAbstractDatabaseMetadata.SupportsConvert: Boolean;
01068 begin
01069 Result := False;
01070 end;
01071
01072 {**
01073 Is CONVERT between the given SQL types supported?
01074 @param fromType the type to convert from
01075 @param toType the type to convert to
01076 @return <code>true</code> if so; <code>false</code> otherwise
01077 @see Types
01078 }
01079 function TZAbstractDatabaseMetadata.SupportsConvertForTypes(
01080 FromType: TZSQLType; ToType: TZSQLType): Boolean;
01081 begin
01082 Result := False;
01083 end;
01084
01085 {**
01086 Are table correlation names supported?
01087 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01088 @return <code>true</code> if so; <code>false</code> otherwise
01089 }
01090 function TZAbstractDatabaseMetadata.SupportsTableCorrelationNames: Boolean;
01091 begin
01092 Result := True;
01093 end;
01094
01095 {**
01096 If table correlation names are supported, are they restricted
01097 to be different from the names of the tables?
01098 @return <code>true</code> if so; <code>false</code> otherwise
01099 }
01100 function TZAbstractDatabaseMetadata.SupportsDifferentTableCorrelationNames: Boolean;
01101 begin
01102 Result := False;
01103 end;
01104
01105 {**
01106 Are expressions in "ORDER BY" lists supported?
01107 @return <code>true</code> if so; <code>false</code> otherwise
01108 }
01109 function TZAbstractDatabaseMetadata.SupportsExpressionsInOrderBy: Boolean;
01110 begin
01111 Result := True;
01112 end;
01113
01114 {**
01115 Can an "ORDER BY" clause use columns not in the SELECT statement?
01116 @return <code>true</code> if so; <code>false</code> otherwise
01117 }
01118 function TZAbstractDatabaseMetadata.SupportsOrderByUnrelated: Boolean;
01119 begin
01120 Result := True;
01121 end;
01122
01123 {**
01124 Is some form of "GROUP BY" clause supported?
01125 @return <code>true</code> if so; <code>false</code> otherwise
01126 }
01127 function TZAbstractDatabaseMetadata.SupportsGroupBy: Boolean;
01128 begin
01129 Result := True;
01130 end;
01131
01132 {**
01133 Can a "GROUP BY" clause use columns not in the SELECT?
01134 @return <code>true</code> if so; <code>false</code> otherwise
01135 }
01136 function TZAbstractDatabaseMetadata.SupportsGroupByUnrelated: Boolean;
01137 begin
01138 Result := True;
01139 end;
01140
01141 {**
01142 Can a "GROUP BY" clause add columns not in the SELECT
01143 provided it specifies all the columns in the SELECT?
01144 @return <code>true</code> if so; <code>false</code> otherwise
01145 }
01146 function TZAbstractDatabaseMetadata.SupportsGroupByBeyondSelect: Boolean;
01147 begin
01148 Result := False;
01149 end;
01150
01151 {**
01152 Is the escape character in "LIKE" clauses supported?
01153 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01154 @return <code>true</code> if so; <code>false</code> otherwise
01155 }
01156 function TZAbstractDatabaseMetadata.SupportsLikeEscapeClause: Boolean;
01157 begin
01158 Result := True;
01159 end;
01160
01161 {**
01162 Are multiple <code>ResultSet</code> from a single execute supported?
01163 @return <code>true</code> if so; <code>false</code> otherwise
01164 }
01165 function TZAbstractDatabaseMetadata.SupportsMultipleResultSets: Boolean;
01166 begin
01167 Result := True;
01168 end;
01169
01170 {**
01171 Can we have multiple transactions open at once (on different
01172 connections)?
01173 @return <code>true</code> if so; <code>false</code> otherwise
01174 }
01175 function TZAbstractDatabaseMetadata.SupportsMultipleTransactions: Boolean;
01176 begin
01177 Result := True;
01178 end;
01179
01180 {**
01181 Can columns be defined as non-nullable?
01182 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01183 @return <code>true</code> if so; <code>false</code> otherwise
01184 }
01185 function TZAbstractDatabaseMetadata.SupportsNonNullableColumns: Boolean;
01186 begin
01187 Result := True;
01188 end;
01189
01190 {**
01191 Is the ODBC Minimum SQL grammar supported?
01192 All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
01193 @return <code>true</code> if so; <code>false</code> otherwise
01194 }
01195 function TZAbstractDatabaseMetadata.SupportsMinimumSQLGrammar: Boolean;
01196 begin
01197 Result := True;
01198 end;
01199
01200 {**
01201 Is the ODBC Core SQL grammar supported?
01202 @return <code>true</code> if so; <code>false</code> otherwise
01203 }
01204 function TZAbstractDatabaseMetadata.SupportsCoreSQLGrammar: Boolean;
01205 begin
01206 Result := True;
01207 end;
01208
01209 {**
01210 Is the ODBC Extended SQL grammar supported?
01211 @return <code>true</code> if so; <code>false</code> otherwise
01212 }
01213 function TZAbstractDatabaseMetadata.SupportsExtendedSQLGrammar: Boolean;
01214 begin
01215 Result := True;
01216 end;
01217
01218 {**
01219 Is the ANSI92 entry level SQL grammar supported?
01220 All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
01221 @return <code>true</code> if so; <code>false</code> otherwise
01222 }
01223 function TZAbstractDatabaseMetadata.SupportsANSI92EntryLevelSQL: Boolean;
01224 begin
01225 Result := True;
01226 end;
01227
01228 {**
01229 Is the ANSI92 intermediate SQL grammar supported?
01230 @return <code>true</code> if so; <code>false</code> otherwise
01231 }
01232 function TZAbstractDatabaseMetadata.SupportsANSI92IntermediateSQL: Boolean;
01233 begin
01234 Result := True;
01235 end;
01236
01237 {**
01238 Is the ANSI92 full SQL grammar supported?
01239 @return <code>true</code> if so; <code>false</code> otherwise
01240 }
01241 function TZAbstractDatabaseMetadata.SupportsANSI92FullSQL: Boolean;
01242 begin
01243 Result := True;
01244 end;
01245
01246 {**
01247 Is the SQL Integrity Enhancement Facility supported?
01248 @return <code>true</code> if so; <code>false</code> otherwise
01249 }
01250 function TZAbstractDatabaseMetadata.SupportsIntegrityEnhancementFacility: Boolean;
01251 begin
01252 Result := False;
01253 end;
01254
01255 {**
01256 Is some form of outer join supported?
01257 @return <code>true</code> if so; <code>false</code> otherwise
01258 }
01259 function TZAbstractDatabaseMetadata.SupportsOuterJoins: Boolean;
01260 begin
01261 Result := True;
01262 end;
01263
01264 {**
01265 Are full nested outer joins supported?
01266 @return <code>true</code> if so; <code>false</code> otherwise
01267 }
01268 function TZAbstractDatabaseMetadata.SupportsFullOuterJoins: Boolean;
01269 begin
01270 Result := True;
01271 end;
01272
01273 {**
01274 Is there limited support for outer joins? (This will be true
01275 if supportFullOuterJoins is true.)
01276 @return <code>true</code> if so; <code>false</code> otherwise
01277 }
01278 function TZAbstractDatabaseMetadata.SupportsLimitedOuterJoins: Boolean;
01279 begin
01280 Result := True;
01281 end;
01282
01283 {**
01284 What's the database vendor's preferred term for "schema"?
01285 @return the vendor term
01286 }
01287 function TZAbstractDatabaseMetadata.GetSchemaTerm: string;
01288 begin
01289 Result := 'Schema';
01290 end;
01291
01292 {**
01293 What's the database vendor's preferred term for "procedure"?
01294 @return the vendor term
01295 }
01296 function TZAbstractDatabaseMetadata.GetProcedureTerm: string;
01297 begin
01298 Result := 'Procedure';
01299 end;
01300
01301 {**
01302 What's the database vendor's preferred term for "catalog"?
01303 @return the vendor term
01304 }
01305 function TZAbstractDatabaseMetadata.GetCatalogTerm: string;
01306 begin
01307 Result := 'Catalog';
01308 end;
01309
01310 {**
01311 Does a catalog appear at the start of a qualified table name?
01312 (Otherwise it appears at the end)
01313 @return true if it appears at the start
01314 }
01315 function TZAbstractDatabaseMetadata.IsCatalogAtStart: Boolean;
01316 begin
01317 Result := False;
01318 end;
01319
01320 {**
01321 What's the separator between catalog and table name?
01322 @return the separator string
01323 }
01324 function TZAbstractDatabaseMetadata.GetCatalogSeparator: string;
01325 begin
01326 Result := '.';
01327 end;
01328
01329 {**
01330 Can a schema name be used in a data manipulation statement?
01331 @return <code>true</code> if so; <code>false</code> otherwise
01332 }
01333 function TZAbstractDatabaseMetadata.SupportsSchemasInDataManipulation: Boolean;
01334 begin
01335 Result := False;
01336 end;
01337
01338 {**
01339 Can a schema name be used in a procedure call statement?
01340 @return <code>true</code> if so; <code>false</code> otherwise
01341 }
01342 function TZAbstractDatabaseMetadata.SupportsSchemasInProcedureCalls: Boolean;
01343 begin
01344 Result := False;
01345 end;
01346
01347 {**
01348 Can a schema name be used in a table definition statement?
01349 @return <code>true</code> if so; <code>false</code> otherwise
01350 }
01351 function TZAbstractDatabaseMetadata.SupportsSchemasInTableDefinitions: Boolean;
01352 begin
01353 Result := False;
01354 end;
01355
01356 {**
01357 Can a schema name be used in an index definition statement?
01358 @return <code>true</code> if so; <code>false</code> otherwise
01359 }
01360 function TZAbstractDatabaseMetadata.SupportsSchemasInIndexDefinitions: Boolean;
01361 begin
01362 Result := False;
01363 end;
01364
01365 {**
01366 Can a schema name be used in a privilege definition statement?
01367 @return <code>true</code> if so; <code>false</code> otherwise
01368 }
01369 function TZAbstractDatabaseMetadata.SupportsSchemasInPrivilegeDefinitions: Boolean;
01370 begin
01371 Result := False;
01372 end;
01373
01374 {**
01375 Can a catalog name be used in a data manipulation statement?
01376 @return <code>true</code> if so; <code>false</code> otherwise
01377 }
01378 function TZAbstractDatabaseMetadata.SupportsCatalogsInDataManipulation: Boolean;
01379 begin
01380 Result := False;
01381 end;
01382
01383 {**
01384 Can a catalog name be used in a procedure call statement?
01385 @return <code>true</code> if so; <code>false</code> otherwise
01386 }
01387 function TZAbstractDatabaseMetadata.SupportsCatalogsInProcedureCalls: Boolean;
01388 begin
01389 Result := False;
01390 end;
01391
01392 {**
01393 Can a catalog name be used in a table definition statement?
01394 @return <code>true</code> if so; <code>false</code> otherwise
01395 }
01396 function TZAbstractDatabaseMetadata.SupportsCatalogsInTableDefinitions: Boolean;
01397 begin
01398 Result := False;
01399 end;
01400
01401 {**
01402 Can a catalog name be used in an index definition statement?
01403 @return <code>true</code> if so; <code>false</code> otherwise
01404 }
01405 function TZAbstractDatabaseMetadata.SupportsCatalogsInIndexDefinitions: Boolean;
01406 begin
01407 Result := False;
01408 end;
01409
01410 {**
01411 Can a catalog name be used in a privilege definition statement?
01412 @return <code>true</code> if so; <code>false</code> otherwise
01413 }
01414 function TZAbstractDatabaseMetadata.SupportsCatalogsInPrivilegeDefinitions: Boolean;
01415 begin
01416 Result := False;
01417 end;
01418
01419 {**
01420 Is positioned DELETE supported?
01421 @return <code>true</code> if so; <code>false</code> otherwise
01422 }
01423 function TZAbstractDatabaseMetadata.SupportsPositionedDelete: Boolean;
01424 begin
01425 Result := False;
01426 end;
01427
01428 {**
01429 Is positioned UPDATE supported?
01430 @return <code>true</code> if so; <code>false</code> otherwise
01431 }
01432 function TZAbstractDatabaseMetadata.SupportsPositionedUpdate: Boolean;
01433 begin
01434 Result := False;
01435 end;
01436
01437 {**
01438 Is SELECT for UPDATE supported?
01439 @return <code>true</code> if so; <code>false</code> otherwise
01440 }
01441 function TZAbstractDatabaseMetadata.SupportsSelectForUpdate: Boolean;
01442 begin
01443 Result := False;
01444 end;
01445
01446 {**
01447 Are stored procedure calls using the stored procedure escape
01448 syntax supported?
01449 @return <code>true</code> if so; <code>false</code> otherwise
01450 }
01451 function TZAbstractDatabaseMetadata.SupportsStoredProcedures: Boolean;
01452 begin
01453 Result := False;
01454 end;
01455
01456 {**
01457 Are subqueries in comparison expressions supported?
01458 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01459 @return <code>true</code> if so; <code>false</code> otherwise
01460 }
01461 function TZAbstractDatabaseMetadata.SupportsSubqueriesInComparisons: Boolean;
01462 begin
01463 Result := False;
01464 end;
01465
01466 {**
01467 Are subqueries in 'exists' expressions supported?
01468 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01469 @return <code>true</code> if so; <code>false</code> otherwise
01470 }
01471 function TZAbstractDatabaseMetadata.SupportsSubqueriesInExists: Boolean;
01472 begin
01473 Result := False;
01474 end;
01475
01476 {**
01477 Are subqueries in 'in' statements supported?
01478 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01479 @return <code>true</code> if so; <code>false</code> otherwise
01480 }
01481 function TZAbstractDatabaseMetadata.SupportsSubqueriesInIns: Boolean;
01482 begin
01483 Result := False;
01484 end;
01485
01486 {**
01487 Are subqueries in quantified expressions supported?
01488 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01489 @return <code>true</code> if so; <code>false</code> otherwise
01490 }
01491 function TZAbstractDatabaseMetadata.SupportsSubqueriesInQuantifieds: Boolean;
01492 begin
01493 Result := False;
01494 end;
01495
01496 {**
01497 Are correlated subqueries supported?
01498 A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
01499 @return <code>true</code> if so; <code>false</code> otherwise
01500 }
01501 function TZAbstractDatabaseMetadata.SupportsCorrelatedSubqueries: Boolean;
01502 begin
01503 Result := False;
01504 end;
01505
01506 {**
01507 Is SQL UNION supported?
01508 @return <code>true</code> if so; <code>false</code> otherwise
01509 }
01510 function TZAbstractDatabaseMetadata.SupportsUnion: Boolean;
01511 begin
01512 Result := False;
01513 end;
01514
01515 {**
01516 Is SQL UNION ALL supported?
01517 @return <code>true</code> if so; <code>false</code> otherwise
01518 }
01519 function TZAbstractDatabaseMetadata.SupportsUnionAll: Boolean;
01520 begin
01521 Result := False;
01522 end;
01523
01524 {**
01525 Can cursors remain open across commits?
01526 @return <code>true</code> if cursors always remain open;
01527 <code>false</code> if they might not remain open
01528 }
01529 function TZAbstractDatabaseMetadata.SupportsOpenCursorsAcrossCommit: Boolean;
01530 begin
01531 Result := False;
01532 end;
01533
01534 {**
01535 Can cursors remain open across rollbacks?
01536 @return <code>true</code> if cursors always remain open;
01537 <code>false</code> if they might not remain open
01538 }
01539 function TZAbstractDatabaseMetadata.SupportsOpenCursorsAcrossRollback: Boolean;
01540 begin
01541 Result := False;
01542 end;
01543
01544 {**
01545 Can statements remain open across commits?
01546 @return <code>true</code> if statements always remain open;
01547 <code>false</code> if they might not remain open
01548 }
01549 function TZAbstractDatabaseMetadata.SupportsOpenStatementsAcrossCommit: Boolean;
01550 begin
01551 Result := True;
01552 end;
01553
01554 {**
01555 Can statements remain open across rollbacks?
01556 @return <code>true</code> if statements always remain open;
01557 <code>false</code> if they might not remain open
01558 }
01559 function TZAbstractDatabaseMetadata.SupportsOpenStatementsAcrossRollback: Boolean;
01560 begin
01561 Result := True;
01562 end;
01563
01564
01565
01566
01567
01568
01569
01570 {**
01571 How many hex characters can you have in an inline binary literal?
01572 @return max binary literal length in hex characters;
01573 a result of zero means that there is no limit or the limit is not known
01574 }
01575 function TZAbstractDatabaseMetadata.GetMaxBinaryLiteralLength: Integer;
01576 begin
01577 Result := 0;
01578 end;
01579
01580 {**
01581 What's the max length for a character literal?
01582 @return max literal length;
01583 a result of zero means that there is no limit or the limit is not known
01584 }
01585 function TZAbstractDatabaseMetadata.GetMaxCharLiteralLength: Integer;
01586 begin
01587 Result := 0;
01588 end;
01589
01590 {**
01591 What's the limit on column name length?
01592 @return max column name length;
01593 a result of zero means that there is no limit or the limit is not known
01594 }
01595 function TZAbstractDatabaseMetadata.GetMaxColumnNameLength: Integer;
01596 begin
01597 Result := 0;
01598 end;
01599
01600 {**
01601 What's the maximum number of columns in a "GROUP BY" clause?
01602 @return max number of columns;
01603 a result of zero means that there is no limit or the limit is not known
01604 }
01605 function TZAbstractDatabaseMetadata.GetMaxColumnsInGroupBy: Integer;
01606 begin
01607 Result := 0;
01608 end;
01609
01610 {**
01611 What's the maximum number of columns allowed in an index?
01612 @return max number of columns;
01613 a result of zero means that there is no limit or the limit is not known
01614 }
01615 function TZAbstractDatabaseMetadata.GetMaxColumnsInIndex: Integer;
01616 begin
01617 Result := 0;
01618 end;
01619
01620 {**
01621 What's the maximum number of columns in an "ORDER BY" clause?
01622 @return max number of columns;
01623 a result of zero means that there is no limit or the limit is not known
01624 }
01625 function TZAbstractDatabaseMetadata.GetMaxColumnsInOrderBy: Integer;
01626 begin
01627 Result := 0;
01628 end;
01629
01630 {**
01631 What's the maximum number of columns in a "SELECT" list?
01632 @return max number of columns;
01633 a result of zero means that there is no limit or the limit is not known
01634 }
01635 function TZAbstractDatabaseMetadata.GetMaxColumnsInSelect: Integer;
01636 begin
01637 Result := 0;
01638 end;
01639
01640 {**
01641 What's the maximum number of columns in a table?
01642 @return max number of columns;
01643 a result of zero means that there is no limit or the limit is not known
01644 }
01645 function TZAbstractDatabaseMetadata.GetMaxColumnsInTable: Integer;
01646 begin
01647 Result := 0;
01648 end;
01649
01650 {**
01651 How many active connections can we have at a time to this database?
01652 @return max number of active connections;
01653 a result of zero means that there is no limit or the limit is not known
01654 }
01655 function TZAbstractDatabaseMetadata.GetMaxConnections: Integer;
01656 begin
01657 Result := 0;
01658 end;
01659
01660 {**
01661 What's the maximum cursor name length?
01662 @return max cursor name length in bytes;
01663 a result of zero means that there is no limit or the limit is not known
01664 }
01665 function TZAbstractDatabaseMetadata.GetMaxCursorNameLength: Integer;
01666 begin
01667 Result := 0;
01668 end;
01669
01670 {**
01671 Retrieves the maximum number of bytes for an index, including all
01672 of the parts of the index.
01673 @return max index length in bytes, which includes the composite of all
01674 the constituent parts of the index;
01675 a result of zero means that there is no limit or the limit is not known
01676 }
01677 function TZAbstractDatabaseMetadata.GetMaxIndexLength: Integer;
01678 begin
01679 Result := 0;
01680 end;
01681
01682 {**
01683 What's the maximum length allowed for a schema name?
01684 @return max name length in bytes;
01685 a result of zero means that there is no limit or the limit is not known
01686 }
01687 function TZAbstractDatabaseMetadata.GetMaxSchemaNameLength: Integer;
01688 begin
01689 Result := 0;
01690 end;
01691
01692 {**
01693 What's the maximum length of a procedure name?
01694 @return max name length in bytes;
01695 a result of zero means that there is no limit or the limit is not known
01696 }
01697 function TZAbstractDatabaseMetadata.GetMaxProcedureNameLength: Integer;
01698 begin
01699 Result := 0;
01700 end;
01701
01702 {**
01703 What's the maximum length of a catalog name?
01704 @return max name length in bytes;
01705 a result of zero means that there is no limit or the limit is not known
01706 }
01707 function TZAbstractDatabaseMetadata.GetMaxCatalogNameLength: Integer;
01708 begin
01709 Result := 0;
01710 end;
01711
01712 {**
01713 What's the maximum length of a single row?
01714 @return max row size in bytes;
01715 a result of zero means that there is no limit or the limit is not known
01716 }
01717 function TZAbstractDatabaseMetadata.GetMaxRowSize: Integer;
01718 begin
01719 Result := 0;
01720 end;
01721
01722 {**
01723 Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY
01724 blobs?
01725 @return <code>true</code> if so; <code>false</code> otherwise
01726 }
01727 function TZAbstractDatabaseMetadata.DoesMaxRowSizeIncludeBlobs: Boolean;
01728 begin
01729 Result := True;
01730 end;
01731
01732 {**
01733 What's the maximum length of an SQL statement?
01734 @return max length in bytes;
01735 a result of zero means that there is no limit or the limit is not known
01736 }
01737 function TZAbstractDatabaseMetadata.GetMaxStatementLength: Integer;
01738 begin
01739 Result := 0;
01740 end;
01741
01742 {**
01743 How many active statements can we have open at one time to this
01744 database?
01745 @return the maximum number of statements that can be open at one time;
01746 a result of zero means that there is no limit or the limit is not known
01747 }
01748 function TZAbstractDatabaseMetadata.GetMaxStatements: Integer;
01749 begin
01750 Result := 0;
01751 end;
01752
01753 {**
01754 What's the maximum length of a table name?
01755 @return max name length in bytes;
01756 a result of zero means that there is no limit or the limit is not known
01757 }
01758 function TZAbstractDatabaseMetadata.GetMaxTableNameLength: Integer;
01759 begin
01760 Result := 0;
01761 end;
01762
01763 {**
01764 What's the maximum number of tables in a SELECT statement?
01765 @return the maximum number of tables allowed in a SELECT statement;
01766 a result of zero means that there is no limit or the limit is not known
01767 }
01768 function TZAbstractDatabaseMetadata.GetMaxTablesInSelect: Integer;
01769 begin
01770 Result := 0;
01771 end;
01772
01773 {**
01774 What's the maximum length of a user name?
01775 @return max user name length in bytes;
01776 a result of zero means that there is no limit or the limit is not known
01777 }
01778 function TZAbstractDatabaseMetadata.GetMaxUserNameLength: Integer;
01779 begin
01780 Result := 0;
01781 end;
01782
01783
01784
01785 {**
01786 What's the database's default transaction isolation level? The
01787 values are defined in <code>java.sql.Connection</code>.
01788 @return the default isolation level
01789 @see Connection
01790 }
01791 function TZAbstractDatabaseMetadata.GetDefaultTransactionIsolation:
01792 TZTransactIsolationLevel;
01793 begin
01794 Result := tiReadCommitted;
01795 end;
01796
01797 {**
01798 Are transactions supported? If not, invoking the method
01799 <code>commit</code> is a noop and the isolation level is TRANSACTION_NONE.
01800 @return <code>true</code> if transactions are supported; <code>false</code> otherwise
01801 }
01802 function TZAbstractDatabaseMetadata.SupportsTransactions: Boolean;
01803 begin
01804 Result := True;
01805 end;
01806
01807 {**
01808 Does this database support the given transaction isolation level?
01809 @param level the values are defined in <code>java.sql.Connection</code>
01810 @return <code>true</code> if so; <code>false</code> otherwise
01811 @see Connection
01812 }
01813 function TZAbstractDatabaseMetadata.SupportsTransactionIsolationLevel(
01814 Level: TZTransactIsolationLevel): Boolean;
01815 begin
01816 Result := True;
01817 end;
01818
01819 {**
01820 Are both data definition and data manipulation statements
01821 within a transaction supported?
01822 @return <code>true</code> if so; <code>false</code> otherwise
01823 }
01824 function TZAbstractDatabaseMetadata.
01825 SupportsDataDefinitionAndDataManipulationTransactions: Boolean;
01826 begin
01827 Result := True;
01828 end;
01829
01830 {**
01831 Are only data manipulation statements within a transaction
01832 supported?
01833 @return <code>true</code> if so; <code>false</code> otherwise
01834 }
01835 function TZAbstractDatabaseMetadata.
01836 SupportsDataManipulationTransactionsOnly: Boolean;
01837 begin
01838 Result := False;
01839 end;
01840
01841 {**
01842 Does a data definition statement within a transaction force the
01843 transaction to commit?
01844 @return <code>true</code> if so; <code>false</code> otherwise
01845 }
01846 function TZAbstractDatabaseMetadata.DataDefinitionCausesTransactionCommit: Boolean;
01847 begin
01848 Result := True;
01849 end;
01850
01851 {**
01852 Is a data definition statement within a transaction ignored?
01853 @return <code>true</code> if so; <code>false</code> otherwise
01854 }
01855 function TZAbstractDatabaseMetadata.DataDefinitionIgnoredInTransactions: Boolean;
01856 begin
01857 Result := False;
01858 end;
01859
01860 {**
01861 Gets a description of the stored procedures available in a
01862 catalog.
01863
01864 <P>Only procedure descriptions matching the schema and
01865 procedure name criteria are returned. They are ordered by
01866 PROCEDURE_SCHEM, and PROCEDURE_NAME.
01867
01868 <P>Each procedure description has the the following columns:
01869 <OL>
01870 <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
01871 <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
01872 <LI><B>PROCEDURE_NAME</B> String => procedure name
01873 <LI> reserved for future use
01874 <LI> reserved for future use
01875 <LI> reserved for future use
01876 <LI><B>REMARKS</B> String => explanatory comment on the procedure
01877 <LI><B>PROCEDURE_TYPE</B> short => kind of procedure:
01878 <UL>
01879 <LI> procedureResultUnknown - May return a result
01880 <LI> procedureNoResult - Does not return a result
01881 <LI> procedureReturnsResult - Returns a result
01882 </UL>
01883 </OL>
01884
01885 @param catalog a catalog name; "" retrieves those without a
01886 catalog; null means drop catalog name from the selection criteria
01887 @param schemaPattern a schema name pattern; "" retrieves those
01888 without a schema
01889 @param procedureNamePattern a procedure name pattern
01890 @return <code>ResultSet</code> - each row is a procedure description
01891 @see #getSearchStringEscape
01892 }
01893 function TZAbstractDatabaseMetadata.GetProcedures(const Catalog: string;
01894 const SchemaPattern: string; const ProcedureNamePattern: string): IZResultSet;
01895 var
01896 Key: string;
01897 begin
01898 Key := GetProceduresCacheKey(Catalog, SchemaPattern, ProcedureNamePattern);
01899
01900 Result := GetResultSetFromCache(Key);
01901 if Result = nil then
01902 begin
01903 Result := UncachedGetProcedures(Catalog, SchemaPattern, ProcedureNamePattern);
01904 AddResultSetToCache(Key, Result);
01905 end;
01906 end;
01907
01908 {**
01909 Gets a description of the stored procedures available in a
01910 catalog.
01911
01912 <P>Only procedure descriptions matching the schema and
01913 procedure name criteria are returned. They are ordered by
01914 PROCEDURE_SCHEM, and PROCEDURE_NAME.
01915
01916 <P>Each procedure description has the the following columns:
01917 <OL>
01918 <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
01919 <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
01920 <LI><B>PROCEDURE_NAME</B> String => procedure name
01921 <LI> reserved for future use
01922 <LI> reserved for future use
01923 <LI> reserved for future use
01924 <LI><B>REMARKS</B> String => explanatory comment on the procedure
01925 <LI><B>PROCEDURE_TYPE</B> short => kind of procedure:
01926 <UL>
01927 <LI> procedureResultUnknown - May return a result
01928 <LI> procedureNoResult - Does not return a result
01929 <LI> procedureReturnsResult - Returns a result
01930 </UL>
01931 </OL>
01932
01933 @param catalog a catalog name; "" retrieves those without a
01934 catalog; null means drop catalog name from the selection criteria
01935 @param schemaPattern a schema name pattern; "" retrieves those
01936 without a schema
01937 @param procedureNamePattern a procedure name pattern
01938 @return <code>ResultSet</code> - each row is a procedure description
01939 @see #getSearchStringEscape
01940 }
01941 function TZAbstractDatabaseMetadata.UncachedGetProcedures(const Catalog: string;
01942 const SchemaPattern: string; const ProcedureNamePattern: string): IZResultSet;
01943 begin
01944 Result := ConstructVirtualResultSet(ProceduresColumnsDynArray);
01945 end;
01946
01947 {**
01948 Gets a description of a catalog's stored procedure parameters
01949 and result columns.
01950
01951 <P>Only descriptions matching the schema, procedure and
01952 parameter name criteria are returned. They are ordered by
01953 PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value,
01954 if any, is first. Next are the parameter descriptions in call
01955 order. The column descriptions follow in column number order.
01956
01957 <P>Each row in the <code>ResultSet</code> is a parameter description or
01958 column description with the following fields:
01959 <OL>
01960 <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
01961 <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
01962 <LI><B>PROCEDURE_NAME</B> String => procedure name
01963 <LI><B>COLUMN_NAME</B> String => column/parameter name
01964 <LI><B>COLUMN_TYPE</B> Short => kind of column/parameter:
01965 <UL>
01966 <LI> procedureColumnUnknown - nobody knows
01967 <LI> procedureColumnIn - IN parameter
01968 <LI> procedureColumnInOut - INOUT parameter
01969 <LI> procedureColumnOut - OUT parameter
01970 <LI> procedureColumnReturn - procedure return value
01971 <LI> procedureColumnResult - result column in <code>ResultSet</code>
01972 </UL>
01973 <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
01974 <LI><B>TYPE_NAME</B> String => SQL type name, for a UDT type the
01975 type name is fully qualified
01976 <LI><B>PRECISION</B> int => precision
01977 <LI><B>LENGTH</B> int => length in bytes of data
01978 <LI><B>SCALE</B> short => scale
01979 <LI><B>RADIX</B> short => radix
01980 <LI><B>NULLABLE</B> short => can it contain NULL?
01981 <UL>
01982 <LI> procedureNoNulls - does not allow NULL values
01983 <LI> procedureNullable - allows NULL values
01984 <LI> procedureNullableUnknown - nullability unknown
01985 </UL>
01986 <LI><B>REMARKS</B> String => comment describing parameter/column
01987 </OL>
01988
01989 <P><B>Note:</B> Some databases may not return the column
01990 descriptions for a procedure. Additional columns beyond
01991 REMARKS can be defined by the database.
01992
01993 @param catalog a catalog name; "" retrieves those without a
01994 catalog; null means drop catalog name from the selection criteria
01995 @param schemaPattern a schema name pattern; "" retrieves those
01996 without a schema
01997 @param procedureNamePattern a procedure name pattern
01998 @param columnNamePattern a column name pattern
01999 @return <code>ResultSet</code> - each row describes a stored procedure parameter or
02000 column
02001 @see #getSearchStringEscape
02002 }
02003 function TZAbstractDatabaseMetadata.GetProcedureColumns(const Catalog: string;
02004 const SchemaPattern: string; const ProcedureNamePattern: string;
02005 const ColumnNamePattern: string): IZResultSet;
02006 var
02007 Key: string;
02008 begin
02009 Key := GetProcedureColumnsCacheKey(Catalog, SchemaPattern, ProcedureNamePattern,
02010 ColumnNamePattern);
02011
02012 Result := GetResultSetFromCache(Key);
02013 if Result = nil then
02014 begin
02015 Result := UncachedGetProcedureColumns(Catalog, SchemaPattern, ProcedureNamePattern, ColumnNamePattern);
02016 AddResultSetToCache(Key, Result);
02017 end;
02018 end;
02019
02020 {**
02021 Gets a description of a catalog's stored procedure parameters
02022 and result columns.
02023
02024 <P>Only descriptions matching the schema, procedure and
02025 parameter name criteria are returned. They are ordered by
02026 PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value,
02027 if any, is first. Next are the parameter descriptions in call
02028 order. The column descriptions follow in column number order.
02029
02030 <P>Each row in the <code>ResultSet</code> is a parameter description or
02031 column description with the following fields:
02032 <OL>
02033 <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
02034 <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
02035 <LI><B>PROCEDURE_NAME</B> String => procedure name
02036 <LI><B>COLUMN_NAME</B> String => column/parameter name
02037 <LI><B>COLUMN_TYPE</B> Short => kind of column/parameter:
02038 <UL>
02039 <LI> procedureColumnUnknown - nobody knows
02040 <LI> procedureColumnIn - IN parameter
02041 <LI> procedureColumnInOut - INOUT parameter
02042 <LI> procedureColumnOut - OUT parameter
02043 <LI> procedureColumnReturn - procedure return value
02044 <LI> procedureColumnResult - result column in <code>ResultSet</code>
02045 </UL>
02046 <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
02047 <LI><B>TYPE_NAME</B> String => SQL type name, for a UDT type the
02048 type name is fully qualified
02049 <LI><B>PRECISION</B> int => precision
02050 <LI><B>LENGTH</B> int => length in bytes of data
02051 <LI><B>SCALE</B> short => scale
02052 <LI><B>RADIX</B> short => radix
02053 <LI><B>NULLABLE</B> short => can it contain NULL?
02054 <UL>
02055 <LI> procedureNoNulls - does not allow NULL values
02056 <LI> procedureNullable - allows NULL values
02057 <LI> procedureNullableUnknown - nullability unknown
02058 </UL>
02059 <LI><B>REMARKS</B> String => comment describing parameter/column
02060 </OL>
02061
02062 <P><B>Note:</B> Some databases may not return the column
02063 descriptions for a procedure. Additional columns beyond
02064 REMARKS can be defined by the database.
02065
02066 @param catalog a catalog name; "" retrieves those without a
02067 catalog; null means drop catalog name from the selection criteria
02068 @param schemaPattern a schema name pattern; "" retrieves those
02069 without a schema
02070 @param procedureNamePattern a procedure name pattern
02071 @param columnNamePattern a column name pattern
02072 @return <code>ResultSet</code> - each row describes a stored procedure parameter or
02073 column
02074 @see #getSearchStringEscape
02075 }
02076 function TZAbstractDatabaseMetadata.UncachedGetProcedureColumns(const Catalog: string;
02077 const SchemaPattern: string; const ProcedureNamePattern: string;
02078 const ColumnNamePattern: string): IZResultSet;
02079 begin
02080 Result := ConstructVirtualResultSet(ProceduresColColumnsDynArray);
02081 end;
02082
02083 {**
02084 Gets a description of tables available in a catalog.
02085
02086 <P>Only table descriptions matching the catalog, schema, table
02087 name and type criteria are returned. They are ordered by
02088 TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
02089
02090 <P>Each table description has the following columns:
02091 <OL>
02092 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02093 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02094 <LI><B>TABLE_NAME</B> String => table name
02095 <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
02096 "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
02097 "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
02098 <LI><B>REMARKS</B> String => explanatory comment on the table
02099 </OL>
02100
02101 <P><B>Note:</B> Some databases may not return information for
02102 all tables.
02103
02104 @param catalog a catalog name; "" retrieves those without a
02105 catalog; null means drop catalog name from the selection criteria
02106 @param schemaPattern a schema name pattern; "" retrieves those
02107 without a schema
02108 @param tableNamePattern a table name pattern
02109 @param types a list of table types to include; null returns all types
02110 @return <code>ResultSet</code> - each row is a table description
02111 @see #getSearchStringEscape
02112 }
02113 function TZAbstractDatabaseMetadata.GetTables(const Catalog: string;
02114 const SchemaPattern: string; const TableNamePattern: string;
02115 const Types: TStringDynArray): IZResultSet;
02116 var
02117 Key: string;
02118 begin
02119 Key := GetTablesCacheKey(Catalog, SchemaPattern, TableNamePattern, Types);
02120 Result := GetResultSetFromCache(Key);
02121 if Result = nil then
02122 begin
02123 Result := UncachedGetTables(Catalog, SchemaPattern, TableNamePattern, Types);
02124 AddResultSetToCache(Key, Result);
02125 end;
02126 end;
02127
02128 {**
02129 Gets a description of tables available in a catalog.
02130
02131 <P>Only table descriptions matching the catalog, schema, table
02132 name and type criteria are returned. They are ordered by
02133 TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
02134
02135 <P>Each table description has the following columns:
02136 <OL>
02137 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02138 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02139 <LI><B>TABLE_NAME</B> String => table name
02140 <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
02141 "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
02142 "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
02143 <LI><B>REMARKS</B> String => explanatory comment on the table
02144 </OL>
02145
02146 <P><B>Note:</B> Some databases may not return information for
02147 all tables.
02148
02149 @param catalog a catalog name; "" retrieves those without a
02150 catalog; null means drop catalog name from the selection criteria
02151 @param schemaPattern a schema name pattern; "" retrieves those
02152 without a schema
02153 @param tableNamePattern a table name pattern
02154 @param types a list of table types to include; null returns all types
02155 @return <code>ResultSet</code> - each row is a table description
02156 @see #getSearchStringEscape
02157 }
02158 function TZAbstractDatabaseMetadata.UncachedGetTables(const Catalog: string;
02159 const SchemaPattern: string; const TableNamePattern: string;
02160 const Types: TStringDynArray): IZResultSet;
02161 begin
02162 Result := ConstructVirtualResultSet(TableColumnsDynArray);
02163 end;
02164
02165 {**
02166 Gets the schema names available in this database. The results
02167 are ordered by schema name.
02168
02169 <P>The schema column is:
02170 <OL>
02171 <LI><B>TABLE_SCHEM</B> String => schema name
02172 </OL>
02173
02174 @return <code>ResultSet</code> - each row has a single String column that is a
02175 schema name
02176 }
02177 function TZAbstractDatabaseMetadata.GetSchemas: IZResultSet;
02178 var
02179 Key: string;
02180 begin
02181 Key := GetSchemasCacheKey;
02182
02183 Result := GetResultSetFromCache(Key);
02184 if Result = nil then
02185 begin
02186 Result := UncachedGetSchemas;
02187 AddResultSetToCache(Key, Result);
02188 end;
02189 end;
02190
02191 {**
02192 Gets the schema names available in this database. The results
02193 are ordered by schema name.
02194
02195 <P>The schema column is:
02196 <OL>
02197 <LI><B>TABLE_SCHEM</B> String => schema name
02198 </OL>
02199
02200 @return <code>ResultSet</code> - each row has a single String column that is a
02201 schema name
02202 }
02203 function TZAbstractDatabaseMetadata.UncachedGetSchemas: IZResultSet;
02204 begin
02205 Result := ConstructVirtualResultSet(SchemaColumnsDynArray);
02206 end;
02207
02208 {**
02209 Gets the catalog names available in this database. The results
02210 are ordered by catalog name.
02211
02212 <P>The catalog column is:
02213 <OL>
02214 <LI><B>TABLE_CAT</B> String => catalog name
02215 </OL>
02216
02217 @return <code>ResultSet</code> - each row has a single String column that is a
02218 catalog name
02219 }
02220 function TZAbstractDatabaseMetadata.GetCatalogs: IZResultSet;
02221 var
02222 Key: string;
02223 begin
02224 Key := GetCatalogsCacheKey;
02225
02226 Result := GetResultSetFromCache(Key);
02227 if Result = nil then
02228 begin
02229 Result := UncachedGetCatalogs;
02230 AddResultSetToCache(Key, Result);
02231 end;
02232 end;
02233
02234 {**
02235 Gets the catalog names available in this database. The results
02236 are ordered by catalog name.
02237
02238 <P>The catalog column is:
02239 <OL>
02240 <LI><B>TABLE_CAT</B> String => catalog name
02241 </OL>
02242
02243 @return <code>ResultSet</code> - each row has a single String column that is a
02244 catalog name
02245 }
02246 function TZAbstractDatabaseMetadata.UncachedGetCatalogs: IZResultSet;
02247 begin
02248 Result := ConstructVirtualResultSet(CatalogColumnsDynArray);
02249 end;
02250
02251 {**
02252 Gets the table types available in this database. The results
02253 are ordered by table type.
02254
02255 <P>The table type is:
02256 <OL>
02257 <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
02258 "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
02259 "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
02260 </OL>
02261
02262 @return <code>ResultSet</code> - each row has a single String column that is a
02263 table type
02264 }
02265 function TZAbstractDatabaseMetadata.GetTableTypes: IZResultSet;
02266 var
02267 Key: string;
02268 begin
02269 Key := GetTableTypesCacheKey;
02270
02271 Result := GetResultSetFromCache(Key);
02272 if Result = nil then
02273 begin
02274 Result := UncachedGetTableTypes;
02275 AddResultSetToCache(Key, Result);
02276 end;
02277 end;
02278
02279 {**
02280 Gets the table types available in this database. The results
02281 are ordered by table type.
02282
02283 <P>The table type is:
02284 <OL>
02285 <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
02286 "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
02287 "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
02288 </OL>
02289
02290 @return <code>ResultSet</code> - each row has a single String column that is a
02291 table type
02292 }
02293 function TZAbstractDatabaseMetadata.UncachedGetTableTypes: IZResultSet;
02294 begin
02295 Result := ConstructVirtualResultSet(TableTypeColumnsDynArray);
02296 end;
02297
02298 {**
02299 Gets a description of table columns available in
02300 the specified catalog.
02301
02302 <P>Only column descriptions matching the catalog, schema, table
02303 and column name criteria are returned. They are ordered by
02304 TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
02305
02306 <P>Each column description has the following columns:
02307 <OL>
02308 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02309 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02310 <LI><B>TABLE_NAME</B> String => table name
02311 <LI><B>COLUMN_NAME</B> String => column name
02312 <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
02313 <LI><B>TYPE_NAME</B> String => Data source dependent type name,
02314 for a UDT the type name is fully qualified
02315 <LI><B>COLUMN_SIZE</B> int => column size. For char or date
02316 types this is the maximum number of characters, for numeric or
02317 decimal types this is precision.
02318 <LI><B>BUFFER_LENGTH</B> is not used.
02319 <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
02320 <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
02321 <LI><B>NULLABLE</B> int => is NULL allowed?
02322 <UL>
02323 <LI> columnNoNulls - might not allow NULL values
02324 <LI> columnNullable - definitely allows NULL values
02325 <LI> columnNullableUnknown - nullability unknown
02326 </UL>
02327 <LI><B>REMARKS</B> String => comment describing column (may be null)
02328 <LI><B>COLUMN_DEF</B> String => default value (may be null)
02329 <LI><B>SQL_DATA_TYPE</B> int => unused
02330 <LI><B>SQL_DATETIME_SUB</B> int => unused
02331 <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
02332 maximum number of bytes in the column
02333 <LI><B>ORDINAL_POSITION</B> int => index of column in table
02334 (starting at 1)
02335 <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
02336 does not allow NULL values; "YES" means the column might
02337 allow NULL values. An empty string means nobody knows.
02338 </OL>
02339
02340 @param catalog a catalog name; "" retrieves those without a
02341 catalog; null means drop catalog name from the selection criteria
02342 @param schemaPattern a schema name pattern; "" retrieves those
02343 without a schema
02344 @param tableNamePattern a table name pattern
02345 @param columnNamePattern a column name pattern
02346 @return <code>ResultSet</code> - each row is a column description
02347 @see #getSearchStringEscape
02348 }
02349 function TZAbstractDatabaseMetadata.GetColumns(const Catalog: string;
02350 const SchemaPattern: string; const TableNamePattern: string;
02351 const ColumnNamePattern: string): IZResultSet;
02352 var
02353 Key: string;
02354 begin
02355 Key := GetColumnsCacheKey(Catalog, SchemaPattern, TableNamePattern,
02356 ColumnNamePattern);
02357
02358 Result := GetResultSetFromCache(Key);
02359 if Result = nil then
02360 begin
02361 Result := UncachedGetColumns(Catalog, SchemaPattern, TableNamePattern, ColumnNamePattern);
02362 AddResultSetToCache(Key, Result);
02363 end;
02364 end;
02365
02366 {**
02367 Gets a description of table columns available in
02368 the specified catalog.
02369
02370 <P>Only column descriptions matching the catalog, schema, table
02371 and column name criteria are returned. They are ordered by
02372 TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
02373
02374 <P>Each column description has the following columns:
02375 <OL>
02376 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02377 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02378 <LI><B>TABLE_NAME</B> String => table name
02379 <LI><B>COLUMN_NAME</B> String => column name
02380 <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
02381 <LI><B>TYPE_NAME</B> String => Data source dependent type name,
02382 for a UDT the type name is fully qualified
02383 <LI><B>COLUMN_SIZE</B> int => column size. For char or date
02384 types this is the maximum number of characters, for numeric or
02385 decimal types this is precision.
02386 <LI><B>BUFFER_LENGTH</B> is not used.
02387 <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
02388 <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
02389 <LI><B>NULLABLE</B> int => is NULL allowed?
02390 <UL>
02391 <LI> columnNoNulls - might not allow NULL values
02392 <LI> columnNullable - definitely allows NULL values
02393 <LI> columnNullableUnknown - nullability unknown
02394 </UL>
02395 <LI><B>REMARKS</B> String => comment describing column (may be null)
02396 <LI><B>COLUMN_DEF</B> String => default value (may be null)
02397 <LI><B>SQL_DATA_TYPE</B> int => unused
02398 <LI><B>SQL_DATETIME_SUB</B> int => unused
02399 <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
02400 maximum number of bytes in the column
02401 <LI><B>ORDINAL_POSITION</B> int => index of column in table
02402 (starting at 1)
02403 <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
02404 does not allow NULL values; "YES" means the column might
02405 allow NULL values. An empty string means nobody knows.
02406 </OL>
02407
02408 @param catalog a catalog name; "" retrieves those without a
02409 catalog; null means drop catalog name from the selection criteria
02410 @param schemaPattern a schema name pattern; "" retrieves those
02411 without a schema
02412 @param tableNamePattern a table name pattern
02413 @param columnNamePattern a column name pattern
02414 @return <code>ResultSet</code> - each row is a column description
02415 @see #getSearchStringEscape
02416 }
02417 function TZAbstractDatabaseMetadata.UncachedGetColumns(const Catalog: string;
02418 const SchemaPattern: string; const TableNamePattern: string;
02419 const ColumnNamePattern: string): IZResultSet;
02420 begin
02421 Result := ConstructVirtualResultSet(TableColColumnsDynArray);
02422 end;
02423
02424 {**
02425 Gets a description of the access rights for a table's columns.
02426
02427 <P>Only privileges matching the column name criteria are
02428 returned. They are ordered by COLUMN_NAME and PRIVILEGE.
02429
02430 <P>Each privilige description has the following columns:
02431 <OL>
02432 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02433 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02434 <LI><B>TABLE_NAME</B> String => table name
02435 <LI><B>COLUMN_NAME</B> String => column name
02436 <LI><B>GRANTOR</B> => grantor of access (may be null)
02437 <LI><B>GRANTEE</B> String => grantee of access
02438 <LI><B>PRIVILEGE</B> String => name of access (SELECT,
02439 INSERT, UPDATE, REFRENCES, ...)
02440 <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
02441 to grant to others; "NO" if not; null if unknown
02442 </OL>
02443
02444 @param catalog a catalog name; "" retrieves those without a
02445 catalog; null means drop catalog name from the selection criteria
02446 @param schema a schema name; "" retrieves those without a schema
02447 @param table a table name
02448 @param columnNamePattern a column name pattern
02449 @return <code>ResultSet</code> - each row is a column privilege description
02450 @see #getSearchStringEscape
02451 }
02452 function TZAbstractDatabaseMetadata.GetColumnPrivileges(const Catalog: string;
02453 const Schema: string; const Table: string; const ColumnNamePattern: string): IZResultSet;
02454 var
02455 Key: string;
02456 begin
02457 Key := GetColumnPrivilegesCacheKey(Catalog, Schema, Table,
02458 ColumnNamePattern);
02459
02460 Result := GetResultSetFromCache(Key);
02461 if Result = nil then
02462 begin
02463 Result := UncachedGetColumnPrivileges(Catalog, Schema, Table, ColumnNamePattern);
02464 AddResultSetToCache(Key, Result);
02465 end;
02466 end;
02467
02468 {**
02469 Gets a description of the access rights for a table's columns.
02470
02471 <P>Only privileges matching the column name criteria are
02472 returned. They are ordered by COLUMN_NAME and PRIVILEGE.
02473
02474 <P>Each privilige description has the following columns:
02475 <OL>
02476 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02477 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02478 <LI><B>TABLE_NAME</B> String => table name
02479 <LI><B>COLUMN_NAME</B> String => column name
02480 <LI><B>GRANTOR</B> => grantor of access (may be null)
02481 <LI><B>GRANTEE</B> String => grantee of access
02482 <LI><B>PRIVILEGE</B> String => name of access (SELECT,
02483 INSERT, UPDATE, REFRENCES, ...)
02484 <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
02485 to grant to others; "NO" if not; null if unknown
02486 </OL>
02487
02488 @param catalog a catalog name; "" retrieves those without a
02489 catalog; null means drop catalog name from the selection criteria
02490 @param schema a schema name; "" retrieves those without a schema
02491 @param table a table name
02492 @param columnNamePattern a column name pattern
02493 @return <code>ResultSet</code> - each row is a column privilege description
02494 @see #getSearchStringEscape
02495 }
02496 function TZAbstractDatabaseMetadata.UncachedGetColumnPrivileges(const Catalog: string;
02497 const Schema: string; const Table: string; const ColumnNamePattern: string): IZResultSet;
02498 begin
02499 Result := ConstructVirtualResultSet(TableColPrivColumnsDynArray);
02500 end;
02501
02502 {**
02503 Gets a description of the access rights for each table available
02504 in a catalog. Note that a table privilege applies to one or
02505 more columns in the table. It would be wrong to assume that
02506 this priviledge applies to all columns (this may be true for
02507 some systems but is not true for all.)
02508
02509 <P>Only privileges matching the schema and table name
02510 criteria are returned. They are ordered by TABLE_SCHEM,
02511 TABLE_NAME, and PRIVILEGE.
02512
02513 <P>Each privilige description has the following columns:
02514 <OL>
02515 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02516 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02517 <LI><B>TABLE_NAME</B> String => table name
02518 <LI><B>GRANTOR</B> => grantor of access (may be null)
02519 <LI><B>GRANTEE</B> String => grantee of access
02520 <LI><B>PRIVILEGE</B> String => name of access (SELECT,
02521 INSERT, UPDATE, REFRENCES, ...)
02522 <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
02523 to grant to others; "NO" if not; null if unknown
02524 </OL>
02525
02526 @param catalog a catalog name; "" retrieves those without a
02527 catalog; null means drop catalog name from the selection criteria
02528 @param schemaPattern a schema name pattern; "" retrieves those
02529 without a schema
02530 @param tableNamePattern a table name pattern
02531 @return <code>ResultSet</code> - each row is a table privilege description
02532 @see #getSearchStringEscape
02533 }
02534 function TZAbstractDatabaseMetadata.GetTablePrivileges(const Catalog: string;
02535 const SchemaPattern: string; const TableNamePattern: string): IZResultSet;
02536 var
02537 Key: string;
02538 begin
02539 Key := GetTablePrivilegesCacheKey(Catalog, SchemaPattern,
02540 TableNamePattern);
02541
02542 Result := GetResultSetFromCache(Key);
02543 if Result = nil then
02544 begin
02545 Result := UncachedGetTablePrivileges(Catalog, SchemaPattern, TableNamePattern);
02546 AddResultSetToCache(Key, Result);
02547 end;
02548 end;
02549
02550 {**
02551 Gets a description of the access rights for each table available
02552 in a catalog. Note that a table privilege applies to one or
02553 more columns in the table. It would be wrong to assume that
02554 this priviledge applies to all columns (this may be true for
02555 some systems but is not true for all.)
02556
02557 <P>Only privileges matching the schema and table name
02558 criteria are returned. They are ordered by TABLE_SCHEM,
02559 TABLE_NAME, and PRIVILEGE.
02560
02561 <P>Each privilige description has the following columns:
02562 <OL>
02563 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02564 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02565 <LI><B>TABLE_NAME</B> String => table name
02566 <LI><B>GRANTOR</B> => grantor of access (may be null)
02567 <LI><B>GRANTEE</B> String => grantee of access
02568 <LI><B>PRIVILEGE</B> String => name of access (SELECT,
02569 INSERT, UPDATE, REFRENCES, ...)
02570 <LI><B>IS_GRANTABLE</B> String => "YES" if grantee is permitted
02571 to grant to others; "NO" if not; null if unknown
02572 </OL>
02573
02574 @param catalog a catalog name; "" retrieves those without a
02575 catalog; null means drop catalog name from the selection criteria
02576 @param schemaPattern a schema name pattern; "" retrieves those
02577 without a schema
02578 @param tableNamePattern a table name pattern
02579 @return <code>ResultSet</code> - each row is a table privilege description
02580 @see #getSearchStringEscape
02581 }
02582 function TZAbstractDatabaseMetadata.UncachedGetTablePrivileges(const Catalog: string;
02583 const SchemaPattern: string; const TableNamePattern: string): IZResultSet;
02584 begin
02585 Result := ConstructVirtualResultSet(TablePrivColumnsDynArray);
02586 end;
02587
02588 {**
02589 Gets a description of a table's optimal set of columns that
02590 uniquely identifies a row. They are ordered by SCOPE.
02591
02592 <P>Each column description has the following columns:
02593 <OL>
02594 <LI><B>SCOPE</B> short => actual scope of result
02595 <UL>
02596 <LI> bestRowTemporary - very temporary, while using row
02597 <LI> bestRowTransaction - valid for remainder of current transaction
02598 <LI> bestRowSession - valid for remainder of current session
02599 </UL>
02600 <LI><B>COLUMN_NAME</B> String => column name
02601 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
02602 <LI><B>TYPE_NAME</B> String => Data source dependent type name,
02603 for a UDT the type name is fully qualified
02604 <LI><B>COLUMN_SIZE</B> int => precision
02605 <LI><B>BUFFER_LENGTH</B> int => not used
02606 <LI><B>DECIMAL_DIGITS</B> short => scale
02607 <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
02608 like an Oracle ROWID
02609 <UL>
02610 <LI> bestRowUnknown - may or may not be pseudo column
02611 <LI> bestRowNotPseudo - is NOT a pseudo column
02612 <LI> bestRowPseudo - is a pseudo column
02613 </UL>
02614 </OL>
02615
02616 @param catalog a catalog name; "" retrieves those without a
02617 catalog; null means drop catalog name from the selection criteria
02618 @param schema a schema name; "" retrieves those without a schema
02619 @param table a table name
02620 @param scope the scope of interest; use same values as SCOPE
02621 @param nullable include columns that are nullable?
02622 @return <code>ResultSet</code> - each row is a column description
02623 }
02624 function TZAbstractDatabaseMetadata.GetBestRowIdentifier(const Catalog: string;
02625 const Schema: string; const Table: string; Scope: Integer; Nullable: Boolean): IZResultSet;
02626 var
02627 Key: string;
02628 begin
02629 Key := GetBestRowIdentifierCacheKey(Catalog, Schema, Table, Scope,
02630 Nullable);
02631
02632 Result := GetResultSetFromCache(Key);
02633 if Result = nil then
02634 begin
02635 Result := UncachedGetBestRowIdentifier(Catalog, Schema, Table, Scope, Nullable);
02636 AddResultSetToCache(Key, Result);
02637 end;
02638 end;
02639
02640 {**
02641 Gets a description of a table's optimal set of columns that
02642 uniquely identifies a row. They are ordered by SCOPE.
02643
02644 <P>Each column description has the following columns:
02645 <OL>
02646 <LI><B>SCOPE</B> short => actual scope of result
02647 <UL>
02648 <LI> bestRowTemporary - very temporary, while using row
02649 <LI> bestRowTransaction - valid for remainder of current transaction
02650 <LI> bestRowSession - valid for remainder of current session
02651 </UL>
02652 <LI><B>COLUMN_NAME</B> String => column name
02653 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
02654 <LI><B>TYPE_NAME</B> String => Data source dependent type name,
02655 for a UDT the type name is fully qualified
02656 <LI><B>COLUMN_SIZE</B> int => precision
02657 <LI><B>BUFFER_LENGTH</B> int => not used
02658 <LI><B>DECIMAL_DIGITS</B> short => scale
02659 <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
02660 like an Oracle ROWID
02661 <UL>
02662 <LI> bestRowUnknown - may or may not be pseudo column
02663 <LI> bestRowNotPseudo - is NOT a pseudo column
02664 <LI> bestRowPseudo - is a pseudo column
02665 </UL>
02666 </OL>
02667
02668 @param catalog a catalog name; "" retrieves those without a
02669 catalog; null means drop catalog name from the selection criteria
02670 @param schema a schema name; "" retrieves those without a schema
02671 @param table a table name
02672 @param scope the scope of interest; use same values as SCOPE
02673 @param nullable include columns that are nullable?
02674 @return <code>ResultSet</code> - each row is a column description
02675 }
02676 function TZAbstractDatabaseMetadata.UncachedGetBestRowIdentifier(const Catalog: string;
02677 const Schema: string; const Table: string; Scope: Integer; Nullable: Boolean): IZResultSet;
02678 var
02679 IndexName: string;
02680 ColumnNames: TStrings;
02681 begin
02682 Result := ConstructVirtualResultSet(BestRowIdentColumnsDynArray);
02683 ColumnNames := TStringList.Create;
02684 try
02685 { Tries primary keys. }
02686 with GetPrimaryKeys(Catalog, Schema, Table) do
02687 begin
02688 while Next do
02689 ColumnNames.Add(GetStringByName('COLUMN_NAME'));
02690 Close;
02691 end;
02692
02693 { Tries unique indices. }
02694 if ColumnNames.Count = 0 then
02695 begin
02696 with GetIndexInfo(Catalog, Schema, Table, True, False) do
02697 begin
02698 IndexName := '';
02699 while Next do
02700 begin
02701 if IndexName = '' then
02702 IndexName := GetStringByName('INDEX_NAME');
02703 if GetStringByName('INDEX_NAME') = IndexName then
02704 ColumnNames.Add(GetStringByName('COLUMN_NAME'));
02705 end;
02706 Close;
02707 end;
02708 end;
02709
02710 with GetColumns(Catalog, Schema, Table, '') do
02711 begin
02712 while Next do
02713 begin
02714 if (ColumnNames.Count <> 0) and (ColumnNames.IndexOf(
02715 GetStringByName('COLUMN_NAME')) < 0) then
02716 Continue;
02717 if (ColumnNames.Count = 0)
02718 and (TZSQLType(GetIntByName('DATA_TYPE')) in
02719 [stBytes, stBinaryStream, stAsciiStream, stUnicodeStream]) then
02720 Continue;
02721
02722 Result.MoveToInsertRow;
02723 Result.UpdateInt(1, Ord(sbrSession));
02724 Result.UpdateString(2, GetStringByName('COLUMN_NAME'));
02725 Result.UpdateInt(3, GetIntByName('DATA_TYPE'));
02726 Result.UpdateString(4, GetStringByName('TYPE_NAME'));
02727 Result.UpdateInt(5, GetIntByName('COLUMN_SIZE'));
02728 Result.UpdateInt(6, GetIntByName('BUFFER_LENGTH'));
02729 Result.UpdateInt(7, GetIntByName('DECIMAL_DIGITS'));
02730 Result.UpdateInt(8, Ord(brNotPseudo));
02731 Result.InsertRow;
02732 end;
02733 Close;
02734 end;
02735 finally
02736 ColumnNames.Free;
02737 end;
02738 end;
02739
02740 {**
02741 Gets a description of a table's columns that are automatically
02742 updated when any value in a row is updated. They are
02743 unordered.
02744
02745 <P>Each column description has the following columns:
02746 <OL>
02747 <LI><B>SCOPE</B> short => is not used
02748 <LI><B>COLUMN_NAME</B> String => column name
02749 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
02750 <LI><B>TYPE_NAME</B> String => Data source dependent type name
02751 <LI><B>COLUMN_SIZE</B> int => precision
02752 <LI><B>BUFFER_LENGTH</B> int => length of column value in bytes
02753 <LI><B>DECIMAL_DIGITS</B> short => scale
02754 <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
02755 like an Oracle ROWID
02756 <UL>
02757 <LI> versionColumnUnknown - may or may not be pseudo column
02758 <LI> versionColumnNotPseudo - is NOT a pseudo column
02759 <LI> versionColumnPseudo - is a pseudo column
02760 </UL>
02761 </OL>
02762
02763 @param catalog a catalog name; "" retrieves those without a
02764 catalog; null means drop catalog name from the selection criteria
02765 @param schema a schema name; "" retrieves those without a schema
02766 @param table a table name
02767 @return <code>ResultSet</code> - each row is a column description
02768 @exception SQLException if a database access error occurs
02769 }
02770
02771 function TZAbstractDatabaseMetadata.GetVersionColumns(const Catalog: string;
02772 const Schema: string; const Table: string): IZResultSet;
02773 var
02774 Key: string;
02775 begin
02776 Key := GetVersionColumnsCacheKey(Catalog, Schema, Table);
02777
02778 Result := GetResultSetFromCache(Key);
02779 if Result = nil then
02780 begin
02781 Result := UncachedGetVersionColumns(Catalog, Schema, Table);
02782 AddResultSetToCache(Key, Result);
02783 end;
02784 end;
02785
02786 {**
02787 Gets a description of a table's columns that are automatically
02788 updated when any value in a row is updated. They are
02789 unordered.
02790
02791 <P>Each column description has the following columns:
02792 <OL>
02793 <LI><B>SCOPE</B> short => is not used
02794 <LI><B>COLUMN_NAME</B> String => column name
02795 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
02796 <LI><B>TYPE_NAME</B> String => Data source dependent type name
02797 <LI><B>COLUMN_SIZE</B> int => precision
02798 <LI><B>BUFFER_LENGTH</B> int => length of column value in bytes
02799 <LI><B>DECIMAL_DIGITS</B> short => scale
02800 <LI><B>PSEUDO_COLUMN</B> short => is this a pseudo column
02801 like an Oracle ROWID
02802 <UL>
02803 <LI> versionColumnUnknown - may or may not be pseudo column
02804 <LI> versionColumnNotPseudo - is NOT a pseudo column
02805 <LI> versionColumnPseudo - is a pseudo column
02806 </UL>
02807 </OL>
02808
02809 @param catalog a catalog name; "" retrieves those without a
02810 catalog; null means drop catalog name from the selection criteria
02811 @param schema a schema name; "" retrieves those without a schema
02812 @param table a table name
02813 @return <code>ResultSet</code> - each row is a column description
02814 @exception SQLException if a database access error occurs
02815 }
02816 function TZAbstractDatabaseMetadata.UncachedGetVersionColumns(const Catalog: string;
02817 const Schema: string; const Table: string): IZResultSet;
02818 begin
02819 Result := ConstructVirtualResultSet(TableColVerColumnsDynArray);
02820 end;
02821
02822 {**
02823 Gets a description of a table's primary key columns. They
02824 are ordered by COLUMN_NAME.
02825
02826 <P>Each primary key column description has the following columns:
02827 <OL>
02828 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02829 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02830 <LI><B>TABLE_NAME</B> String => table name
02831 <LI><B>COLUMN_NAME</B> String => column name
02832 <LI><B>KEY_SEQ</B> short => sequence number within primary key
02833 <LI><B>PK_NAME</B> String => primary key name (may be null)
02834 </OL>
02835
02836 @param catalog a catalog name; "" retrieves those without a
02837 catalog; null means drop catalog name from the selection criteria
02838 @param schema a schema name; "" retrieves those
02839 without a schema
02840 @param table a table name
02841 @return <code>ResultSet</code> - each row is a primary key column description
02842 @exception SQLException if a database access error occurs
02843 }
02844 function TZAbstractDatabaseMetadata.GetPrimaryKeys(const Catalog: string;
02845 const Schema: string; const Table: string): IZResultSet;
02846 var
02847 Key: string;
02848 begin
02849 Key := GetPrimaryKeysCacheKey(Catalog, Schema, Table);
02850
02851 Result := GetResultSetFromCache(Key);
02852 if Result = nil then
02853 begin
02854 Result := UncachedGetPrimaryKeys(Catalog, Schema, Table);
02855 AddResultSetToCache(Key, Result);
02856 end;
02857 end;
02858
02859 {**
02860 Gets a description of a table's primary key columns. They
02861 are ordered by COLUMN_NAME.
02862
02863 <P>Each primary key column description has the following columns:
02864 <OL>
02865 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
02866 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
02867 <LI><B>TABLE_NAME</B> String => table name
02868 <LI><B>COLUMN_NAME</B> String => column name
02869 <LI><B>KEY_SEQ</B> short => sequence number within primary key
02870 <LI><B>PK_NAME</B> String => primary key name (may be null)
02871 </OL>
02872
02873 @param catalog a catalog name; "" retrieves those without a
02874 catalog; null means drop catalog name from the selection criteria
02875 @param schema a schema name; "" retrieves those
02876 without a schema
02877 @param table a table name
02878 @return <code>ResultSet</code> - each row is a primary key column description
02879 @exception SQLException if a database access error occurs
02880 }
02881 function TZAbstractDatabaseMetadata.UncachedGetPrimaryKeys(const Catalog: string;
02882 const Schema: string; const Table: string): IZResultSet;
02883 begin
02884 Result := ConstructVirtualResultSet(PrimaryKeyColumnsDynArray);
02885 end;
02886
02887 {**
02888 Gets a description of the primary key columns that are
02889 referenced by a table's foreign key columns (the primary keys
02890 imported by a table). They are ordered by PKTABLE_CAT,
02891 PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.
02892
02893 <P>Each primary key column description has the following columns:
02894 <OL>
02895 <LI><B>PKTABLE_CAT</B> String => primary key table catalog
02896 being imported (may be null)
02897 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema
02898 being imported (may be null)
02899 <LI><B>PKTABLE_NAME</B> String => primary key table name
02900 being imported
02901 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
02902 being imported
02903 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
02904 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
02905 <LI><B>FKTABLE_NAME</B> String => foreign key table name
02906 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
02907 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
02908 <LI><B>UPDATE_RULE</B> short => What happens to
02909 foreign key when primary is updated:
02910 <UL>
02911 <LI> importedNoAction - do not allow update of primary
02912 key if it has been imported
02913 <LI> importedKeyCascade - change imported key to agree
02914 with primary key update
02915 <LI> importedKeySetNull - change imported key to NULL if
02916 its primary key has been updated
02917 <LI> importedKeySetDefault - change imported key to default values
02918 if its primary key has been updated
02919 <LI> importedKeyRestrict - same as importedKeyNoAction
02920 (for ODBC 2.x compatibility)
02921 </UL>
02922 <LI><B>DELETE_RULE</B> short => What happens to
02923 the foreign key when primary is deleted.
02924 <UL>
02925 <LI> importedKeyNoAction - do not allow delete of primary
02926 key if it has been imported
02927 <LI> importedKeyCascade - delete rows that import a deleted key
02928 <LI> importedKeySetNull - change imported key to NULL if
02929 its primary key has been deleted
02930 <LI> importedKeyRestrict - same as importedKeyNoAction
02931 (for ODBC 2.x compatibility)
02932 <LI> importedKeySetDefault - change imported key to default if
02933 its primary key has been deleted
02934 </UL>
02935 <LI><B>FK_NAME</B> String => foreign key name (may be null)
02936 <LI><B>PK_NAME</B> String => primary key name (may be null)
02937 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
02938 constraints be deferred until commit
02939 <UL>
02940 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
02941 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
02942 <LI> importedKeyNotDeferrable - see SQL92 for definition
02943 </UL>
02944 </OL>
02945
02946 @param catalog a catalog name; "" retrieves those without a
02947 catalog; null means drop catalog name from the selection criteria
02948 @param schema a schema name; "" retrieves those
02949 without a schema
02950 @param table a table name
02951 @return <code>ResultSet</code> - each row is a primary key column description
02952 @see #getExportedKeys
02953 }
02954 function TZAbstractDatabaseMetadata.GetImportedKeys(const Catalog: string;
02955 const Schema: string; const Table: string): IZResultSet;
02956 var
02957 Key: string;
02958 begin
02959 Key := GetImportedKeysCacheKey(Catalog, Schema, Table);
02960
02961 Result := GetResultSetFromCache(Key);
02962 if Result = nil then
02963 begin
02964 Result := UncachedGetImportedKeys(Catalog, Schema, Table);
02965 AddResultSetToCache(Key, Result);
02966 end;
02967 end;
02968
02969 {**
02970 Gets a description of the primary key columns that are
02971 referenced by a table's foreign key columns (the primary keys
02972 imported by a table). They are ordered by PKTABLE_CAT,
02973 PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.
02974
02975 <P>Each primary key column description has the following columns:
02976 <OL>
02977 <LI><B>PKTABLE_CAT</B> String => primary key table catalog
02978 being imported (may be null)
02979 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema
02980 being imported (may be null)
02981 <LI><B>PKTABLE_NAME</B> String => primary key table name
02982 being imported
02983 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
02984 being imported
02985 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
02986 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
02987 <LI><B>FKTABLE_NAME</B> String => foreign key table name
02988 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
02989 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
02990 <LI><B>UPDATE_RULE</B> short => What happens to
02991 foreign key when primary is updated:
02992 <UL>
02993 <LI> importedNoAction - do not allow update of primary
02994 key if it has been imported
02995 <LI> importedKeyCascade - change imported key to agree
02996 with primary key update
02997 <LI> importedKeySetNull - change imported key to NULL if
02998 its primary key has been updated
02999 <LI> importedKeySetDefault - change imported key to default values
03000 if its primary key has been updated
03001 <LI> importedKeyRestrict - same as importedKeyNoAction
03002 (for ODBC 2.x compatibility)
03003 </UL>
03004 <LI><B>DELETE_RULE</B> short => What happens to
03005 the foreign key when primary is deleted.
03006 <UL>
03007 <LI> importedKeyNoAction - do not allow delete of primary
03008 key if it has been imported
03009 <LI> importedKeyCascade - delete rows that import a deleted key
03010 <LI> importedKeySetNull - change imported key to NULL if
03011 its primary key has been deleted
03012 <LI> importedKeyRestrict - same as importedKeyNoAction
03013 (for ODBC 2.x compatibility)
03014 <LI> importedKeySetDefault - change imported key to default if
03015 its primary key has been deleted
03016 </UL>
03017 <LI><B>FK_NAME</B> String => foreign key name (may be null)
03018 <LI><B>PK_NAME</B> String => primary key name (may be null)
03019 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
03020 constraints be deferred until commit
03021 <UL>
03022 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
03023 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
03024 <LI> importedKeyNotDeferrable - see SQL92 for definition
03025 </UL>
03026 </OL>
03027
03028 @param catalog a catalog name; "" retrieves those without a
03029 catalog; null means drop catalog name from the selection criteria
03030 @param schema a schema name; "" retrieves those
03031 without a schema
03032 @param table a table name
03033 @return <code>ResultSet</code> - each row is a primary key column description
03034 @see #getExportedKeys
03035 }
03036 function TZAbstractDatabaseMetadata.UncachedGetImportedKeys(const Catalog: string;
03037 const Schema: string; const Table: string): IZResultSet;
03038 begin
03039 Result := ConstructVirtualResultSet(ImportedKeyColumnsDynArray);
03040 end;
03041
03042 {**
03043 Gets a description of the foreign key columns that reference a
03044 table's primary key columns (the foreign keys exported by a
03045 table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM,
03046 FKTABLE_NAME, and KEY_SEQ.
03047
03048 <P>Each foreign key column description has the following columns:
03049 <OL>
03050 <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
03051 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
03052 <LI><B>PKTABLE_NAME</B> String => primary key table name
03053 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
03054 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
03055 being exported (may be null)
03056 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
03057 being exported (may be null)
03058 <LI><B>FKTABLE_NAME</B> String => foreign key table name
03059 being exported
03060 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
03061 being exported
03062 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
03063 <LI><B>UPDATE_RULE</B> short => What happens to
03064 foreign key when primary is updated:
03065 <UL>
03066 <LI> importedNoAction - do not allow update of primary
03067 key if it has been imported
03068 <LI> importedKeyCascade - change imported key to agree
03069 with primary key update
03070 <LI> importedKeySetNull - change imported key to NULL if
03071 its primary key has been updated
03072 <LI> importedKeySetDefault - change imported key to default values
03073 if its primary key has been updated
03074 <LI> importedKeyRestrict - same as importedKeyNoAction
03075 (for ODBC 2.x compatibility)
03076 </UL>
03077 <LI><B>DELETE_RULE</B> short => What happens to
03078 the foreign key when primary is deleted.
03079 <UL>
03080 <LI> importedKeyNoAction - do not allow delete of primary
03081 key if it has been imported
03082 <LI> importedKeyCascade - delete rows that import a deleted key
03083 <LI> importedKeySetNull - change imported key to NULL if
03084 its primary key has been deleted
03085 <LI> importedKeyRestrict - same as importedKeyNoAction
03086 (for ODBC 2.x compatibility)
03087 <LI> importedKeySetDefault - change imported key to default if
03088 its primary key has been deleted
03089 </UL>
03090 <LI><B>FK_NAME</B> String => foreign key name (may be null)
03091 <LI><B>PK_NAME</B> String => primary key name (may be null)
03092 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
03093 constraints be deferred until commit
03094 <UL>
03095 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
03096 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
03097 <LI> importedKeyNotDeferrable - see SQL92 for definition
03098 </UL>
03099 </OL>
03100
03101 @param catalog a catalog name; "" retrieves those without a
03102 catalog; null means drop catalog name from the selection criteria
03103 @param schema a schema name; "" retrieves those
03104 without a schema
03105 @param table a table name
03106 @return <code>ResultSet</code> - each row is a foreign key column description
03107 @see #getImportedKeys
03108 }
03109 function TZAbstractDatabaseMetadata.GetExportedKeys(const Catalog: string;
03110 const Schema: string; const Table: string): IZResultSet;
03111 var
03112 Key: string;
03113 begin
03114 Key := GetExportedKeysCacheKey(Catalog, Schema, Table);
03115
03116 Result := GetResultSetFromCache(Key);
03117 if Result = nil then
03118 begin
03119 Result := UncachedGetExportedKeys(Catalog, Schema, Table);
03120 AddResultSetToCache(Key, Result);
03121 end;
03122 end;
03123
03124 {**
03125 Gets a description of the foreign key columns that reference a
03126 table's primary key columns (the foreign keys exported by a
03127 table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM,
03128 FKTABLE_NAME, and KEY_SEQ.
03129
03130 <P>Each foreign key column description has the following columns:
03131 <OL>
03132 <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
03133 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
03134 <LI><B>PKTABLE_NAME</B> String => primary key table name
03135 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
03136 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
03137 being exported (may be null)
03138 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
03139 being exported (may be null)
03140 <LI><B>FKTABLE_NAME</B> String => foreign key table name
03141 being exported
03142 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
03143 being exported
03144 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
03145 <LI><B>UPDATE_RULE</B> short => What happens to
03146 foreign key when primary is updated:
03147 <UL>
03148 <LI> importedNoAction - do not allow update of primary
03149 key if it has been imported
03150 <LI> importedKeyCascade - change imported key to agree
03151 with primary key update
03152 <LI> importedKeySetNull - change imported key to NULL if
03153 its primary key has been updated
03154 <LI> importedKeySetDefault - change imported key to default values
03155 if its primary key has been updated
03156 <LI> importedKeyRestrict - same as importedKeyNoAction
03157 (for ODBC 2.x compatibility)
03158 </UL>
03159 <LI><B>DELETE_RULE</B> short => What happens to
03160 the foreign key when primary is deleted.
03161 <UL>
03162 <LI> importedKeyNoAction - do not allow delete of primary
03163 key if it has been imported
03164 <LI> importedKeyCascade - delete rows that import a deleted key
03165 <LI> importedKeySetNull - change imported key to NULL if
03166 its primary key has been deleted
03167 <LI> importedKeyRestrict - same as importedKeyNoAction
03168 (for ODBC 2.x compatibility)
03169 <LI> importedKeySetDefault - change imported key to default if
03170 its primary key has been deleted
03171 </UL>
03172 <LI><B>FK_NAME</B> String => foreign key name (may be null)
03173 <LI><B>PK_NAME</B> String => primary key name (may be null)
03174 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
03175 constraints be deferred until commit
03176 <UL>
03177 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
03178 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
03179 <LI> importedKeyNotDeferrable - see SQL92 for definition
03180 </UL>
03181 </OL>
03182
03183 @param catalog a catalog name; "" retrieves those without a
03184 catalog; null means drop catalog name from the selection criteria
03185 @param schema a schema name; "" retrieves those
03186 without a schema
03187 @param table a table name
03188 @return <code>ResultSet</code> - each row is a foreign key column description
03189 @see #getImportedKeys
03190 }
03191 function TZAbstractDatabaseMetadata.UncachedGetExportedKeys(const Catalog: string;
03192 const Schema: string; const Table: string): IZResultSet;
03193 begin
03194 Result := ConstructVirtualResultSet(ExportedKeyColumnsDynArray);
03195 end;
03196
03197 {**
03198 Gets a description of the foreign key columns in the foreign key
03199 table that reference the primary key columns of the primary key
03200 table (describe how one table imports another's key.) This
03201 should normally return a single foreign key/primary key pair
03202 (most tables only import a foreign key from a table once.) They
03203 are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
03204 KEY_SEQ.
03205
03206 <P>Each foreign key column description has the following columns:
03207 <OL>
03208 <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
03209 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
03210 <LI><B>PKTABLE_NAME</B> String => primary key table name
03211 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
03212 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
03213 being exported (may be null)
03214 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
03215 being exported (may be null)
03216 <LI><B>FKTABLE_NAME</B> String => foreign key table name
03217 being exported
03218 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
03219 being exported
03220 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
03221 <LI><B>UPDATE_RULE</B> short => What happens to
03222 foreign key when primary is updated:
03223 <UL>
03224 <LI> importedNoAction - do not allow update of primary
03225 key if it has been imported
03226 <LI> importedKeyCascade - change imported key to agree
03227 with primary key update
03228 <LI> importedKeySetNull - change imported key to NULL if
03229 its primary key has been updated
03230 <LI> importedKeySetDefault - change imported key to default values
03231 if its primary key has been updated
03232 <LI> importedKeyRestrict - same as importedKeyNoAction
03233 (for ODBC 2.x compatibility)
03234 </UL>
03235 <LI><B>DELETE_RULE</B> short => What happens to
03236 the foreign key when primary is deleted.
03237 <UL>
03238 <LI> importedKeyNoAction - do not allow delete of primary
03239 key if it has been imported
03240 <LI> importedKeyCascade - delete rows that import a deleted key
03241 <LI> importedKeySetNull - change imported key to NULL if
03242 its primary key has been deleted
03243 <LI> importedKeyRestrict - same as importedKeyNoAction
03244 (for ODBC 2.x compatibility)
03245 <LI> importedKeySetDefault - change imported key to default if
03246 its primary key has been deleted
03247 </UL>
03248 <LI><B>FK_NAME</B> String => foreign key name (may be null)
03249 <LI><B>PK_NAME</B> String => primary key name (may be null)
03250 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
03251 constraints be deferred until commit
03252 <UL>
03253 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
03254 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
03255 <LI> importedKeyNotDeferrable - see SQL92 for definition
03256 </UL>
03257 </OL>
03258
03259 @param primaryCatalog a catalog name; "" retrieves those without a
03260 catalog; null means drop catalog name from the selection criteria
03261 @param primarySchema a schema name; "" retrieves those
03262 without a schema
03263 @param primaryTable the table name that exports the key
03264 @param foreignCatalog a catalog name; "" retrieves those without a
03265 catalog; null means drop catalog name from the selection criteria
03266 @param foreignSchema a schema name; "" retrieves those
03267 without a schema
03268 @param foreignTable the table name that imports the key
03269 @return <code>ResultSet</code> - each row is a foreign key column description
03270 @see #getImportedKeys
03271 }
03272 function TZAbstractDatabaseMetadata.GetCrossReference(const PrimaryCatalog: string;
03273 const PrimarySchema: string; const PrimaryTable: string; const ForeignCatalog: string;
03274 const ForeignSchema: string; const ForeignTable: string): IZResultSet;
03275 var
03276 Key: string;
03277 begin
03278 Key := GetCrossReferenceCacheKey(PrimaryCatalog, PrimarySchema, PrimaryTable,
03279 ForeignCatalog, ForeignSchema, ForeignTable);
03280
03281 Result := GetResultSetFromCache(Key);
03282 if Result = nil then
03283 begin
03284 Result := UncachedGetCrossReference(PrimaryCatalog, PrimarySchema, PrimaryTable,
03285 ForeignCatalog, ForeignSchema, ForeignTable);
03286 AddResultSetToCache(Key, Result);
03287 end;
03288 end;
03289
03290 {**
03291 Gets a description of the foreign key columns in the foreign key
03292 table that reference the primary key columns of the primary key
03293 table (describe how one table imports another's key.) This
03294 should normally return a single foreign key/primary key pair
03295 (most tables only import a foreign key from a table once.) They
03296 are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and
03297 KEY_SEQ.
03298
03299 <P>Each foreign key column description has the following columns:
03300 <OL>
03301 <LI><B>PKTABLE_CAT</B> String => primary key table catalog (may be null)
03302 <LI><B>PKTABLE_SCHEM</B> String => primary key table schema (may be null)
03303 <LI><B>PKTABLE_NAME</B> String => primary key table name
03304 <LI><B>PKCOLUMN_NAME</B> String => primary key column name
03305 <LI><B>FKTABLE_CAT</B> String => foreign key table catalog (may be null)
03306 being exported (may be null)
03307 <LI><B>FKTABLE_SCHEM</B> String => foreign key table schema (may be null)
03308 being exported (may be null)
03309 <LI><B>FKTABLE_NAME</B> String => foreign key table name
03310 being exported
03311 <LI><B>FKCOLUMN_NAME</B> String => foreign key column name
03312 being exported
03313 <LI><B>KEY_SEQ</B> short => sequence number within foreign key
03314 <LI><B>UPDATE_RULE</B> short => What happens to
03315 foreign key when primary is updated:
03316 <UL>
03317 <LI> importedNoAction - do not allow update of primary
03318 key if it has been imported
03319 <LI> importedKeyCascade - change imported key to agree
03320 with primary key update
03321 <LI> importedKeySetNull - change imported key to NULL if
03322 its primary key has been updated
03323 <LI> importedKeySetDefault - change imported key to default values
03324 if its primary key has been updated
03325 <LI> importedKeyRestrict - same as importedKeyNoAction
03326 (for ODBC 2.x compatibility)
03327 </UL>
03328 <LI><B>DELETE_RULE</B> short => What happens to
03329 the foreign key when primary is deleted.
03330 <UL>
03331 <LI> importedKeyNoAction - do not allow delete of primary
03332 key if it has been imported
03333 <LI> importedKeyCascade - delete rows that import a deleted key
03334 <LI> importedKeySetNull - change imported key to NULL if
03335 its primary key has been deleted
03336 <LI> importedKeyRestrict - same as importedKeyNoAction
03337 (for ODBC 2.x compatibility)
03338 <LI> importedKeySetDefault - change imported key to default if
03339 its primary key has been deleted
03340 </UL>
03341 <LI><B>FK_NAME</B> String => foreign key name (may be null)
03342 <LI><B>PK_NAME</B> String => primary key name (may be null)
03343 <LI><B>DEFERRABILITY</B> short => can the evaluation of foreign key
03344 constraints be deferred until commit
03345 <UL>
03346 <LI> importedKeyInitiallyDeferred - see SQL92 for definition
03347 <LI> importedKeyInitiallyImmediate - see SQL92 for definition
03348 <LI> importedKeyNotDeferrable - see SQL92 for definition
03349 </UL>
03350 </OL>
03351
03352 @param primaryCatalog a catalog name; "" retrieves those without a
03353 catalog; null means drop catalog name from the selection criteria
03354 @param primarySchema a schema name; "" retrieves those
03355 without a schema
03356 @param primaryTable the table name that exports the key
03357 @param foreignCatalog a catalog name; "" retrieves those without a
03358 catalog; null means drop catalog name from the selection criteria
03359 @param foreignSchema a schema name; "" retrieves those
03360 without a schema
03361 @param foreignTable the table name that imports the key
03362 @return <code>ResultSet</code> - each row is a foreign key column description
03363 @see #getImportedKeys
03364 }
03365 function TZAbstractDatabaseMetadata.UncachedGetCrossReference(const PrimaryCatalog: string;
03366 const PrimarySchema: string; const PrimaryTable: string; const ForeignCatalog: string;
03367 const ForeignSchema: string; const ForeignTable: string): IZResultSet;
03368 begin
03369 Result := ConstructVirtualResultSet(CrossRefColumnsDynArray);
03370 end;
03371
03372 {**
03373 Gets a description of all the standard SQL types supported by
03374 this database. They are ordered by DATA_TYPE and then by how
03375 closely the data type maps to the corresponding JDBC SQL type.
03376
03377 <P>Each type description has the following columns:
03378 <OL>
03379 <LI><B>TYPE_NAME</B> String => Type name
03380 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
03381 <LI><B>PRECISION</B> int => maximum precision
03382 <LI><B>LITERAL_PREFIX</B> String => prefix used to quote a literal
03383 (may be null)
03384 <LI><B>LITERAL_SUFFIX</B> String => suffix used to quote a literal
03385 (may be null)
03386 <LI><B>CREATE_PARAMS</B> String => parameters used in creating
03387 the type (may be null)
03388 <LI><B>NULLABLE</B> short => can you use NULL for this type?
03389 <UL>
03390 <LI> typeNoNulls - does not allow NULL values
03391 <LI> typeNullable - allows NULL values
03392 <LI> typeNullableUnknown - nullability unknown
03393 </UL>
03394 <LI><B>CASE_SENSITIVE</B> boolean=> is it case sensitive?
03395 <LI><B>SEARCHABLE</B> short => can you use "WHERE" based on this type:
03396 <UL>
03397 <LI> typePredNone - No support
03398 <LI> typePredChar - Only supported with WHERE .. LIKE
03399 <LI> typePredBasic - Supported except for WHERE .. LIKE
03400 <LI> typeSearchable - Supported for all WHERE ..
03401 </UL>
03402 <LI><B>UNSIGNED_ATTRIBUTE</B> boolean => is it unsigned?
03403 <LI><B>FIXED_PREC_SCALE</B> boolean => can it be a money value?
03404 <LI><B>AUTO_INCREMENT</B> boolean => can it be used for an
03405 auto-increment value?
03406 <LI><B>LOCAL_TYPE_NAME</B> String => localized version of type name
03407 (may be null)
03408 <LI><B>MINIMUM_SCALE</B> short => minimum scale supported
03409 <LI><B>MAXIMUM_SCALE</B> short => maximum scale supported
03410 <LI><B>SQL_DATA_TYPE</B> int => unused
03411 <LI><B>SQL_DATETIME_SUB</B> int => unused
03412 <LI><B>NUM_PREC_RADIX</B> int => usually 2 or 10
03413 </OL>
03414
03415 @return <code>ResultSet</code> - each row is an SQL type description
03416 }
03417 function TZAbstractDatabaseMetadata.GetTypeInfo: IZResultSet;
03418 var
03419 Key: string;
03420 begin
03421 Key := GetTypeInfoCacheKey;
03422
03423 Result := GetResultSetFromCache(Key);
03424 if Result = nil then
03425 begin
03426 Result := UncachedGetTypeInfo;
03427 AddResultSetToCache(Key, Result);
03428 end;
03429 end;
03430
03431 {**
03432 Gets a description of all the standard SQL types supported by
03433 this database. They are ordered by DATA_TYPE and then by how
03434 closely the data type maps to the corresponding JDBC SQL type.
03435
03436 <P>Each type description has the following columns:
03437 <OL>
03438 <LI><B>TYPE_NAME</B> String => Type name
03439 <LI><B>DATA_TYPE</B> short => SQL data type from java.sql.Types
03440 <LI><B>PRECISION</B> int => maximum precision
03441 <LI><B>LITERAL_PREFIX</B> String => prefix used to quote a literal
03442 (may be null)
03443 <LI><B>LITERAL_SUFFIX</B> String => suffix used to quote a literal
03444 (may be null)
03445 <LI><B>CREATE_PARAMS</B> String => parameters used in creating
03446 the type (may be null)
03447 <LI><B>NULLABLE</B> short => can you use NULL for this type?
03448 <UL>
03449 <LI> typeNoNulls - does not allow NULL values
03450 <LI> typeNullable - allows NULL values
03451 <LI> typeNullableUnknown - nullability unknown
03452 </UL>
03453 <LI><B>CASE_SENSITIVE</B> boolean=> is it case sensitive?
03454 <LI><B>SEARCHABLE</B> short => can you use "WHERE" based on this type:
03455 <UL>
03456 <LI> typePredNone - No support
03457 <LI> typePredChar - Only supported with WHERE .. LIKE
03458 <LI> typePredBasic - Supported except for WHERE .. LIKE
03459 <LI> typeSearchable - Supported for all WHERE ..
03460 </UL>
03461 <LI><B>UNSIGNED_ATTRIBUTE</B> boolean => is it unsigned?
03462 <LI><B>FIXED_PREC_SCALE</B> boolean => can it be a money value?
03463 <LI><B>AUTO_INCREMENT</B> boolean => can it be used for an
03464 auto-increment value?
03465 <LI><B>LOCAL_TYPE_NAME</B> String => localized version of type name
03466 (may be null)
03467 <LI><B>MINIMUM_SCALE</B> short => minimum scale supported
03468 <LI><B>MAXIMUM_SCALE</B> short => maximum scale supported
03469 <LI><B>SQL_DATA_TYPE</B> int => unused
03470 <LI><B>SQL_DATETIME_SUB</B> int => unused
03471 <LI><B>NUM_PREC_RADIX</B> int => usually 2 or 10
03472 </OL>
03473
03474 @return <code>ResultSet</code> - each row is an SQL type description
03475 }
03476 function TZAbstractDatabaseMetadata.UncachedGetTypeInfo: IZResultSet;
03477 begin
03478 Result := ConstructVirtualResultSet(TypeInfoColumnsDynArray);
03479 end;
03480
03481 {**
03482 Gets a description of a table's indices and statistics. They are
03483 ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.
03484
03485 <P>Each index column description has the following columns:
03486 <OL>
03487 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
03488 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
03489 <LI><B>TABLE_NAME</B> String => table name
03490 <LI><B>NON_UNIQUE</B> boolean => Can index values be non-unique?
03491 false when TYPE is tableIndexStatistic
03492 <LI><B>INDEX_QUALIFIER</B> String => index catalog (may be null);
03493 null when TYPE is tableIndexStatistic
03494 <LI><B>INDEX_NAME</B> String => index name; null when TYPE is
03495 tableIndexStatistic
03496 <LI><B>TYPE</B> short => index type:
03497 <UL>
03498 <LI> tableIndexStatistic - this identifies table statistics that are
03499 returned in conjuction with a table's index descriptions
03500 <LI> tableIndexClustered - this is a clustered index
03501 <LI> tableIndexHashed - this is a hashed index
03502 <LI> tableIndexOther - this is some other style of index
03503 </UL>
03504 <LI><B>ORDINAL_POSITION</B> short => column sequence number
03505 within index; zero when TYPE is tableIndexStatistic
03506 <LI><B>COLUMN_NAME</B> String => column name; null when TYPE is
03507 tableIndexStatistic
03508 <LI><B>ASC_OR_DESC</B> String => column sort sequence, "A" => ascending,
03509 "D" => descending, may be null if sort sequence is not supported;
03510 null when TYPE is tableIndexStatistic
03511 <LI><B>CARDINALITY</B> int => When TYPE is tableIndexStatistic, then
03512 this is the number of rows in the table; otherwise, it is the
03513 number of unique values in the index.
03514 <LI><B>PAGES</B> int => When TYPE is tableIndexStatisic then
03515 this is the number of pages used for the table, otherwise it
03516 is the number of pages used for the current index.
03517 <LI><B>FILTER_CONDITION</B> String => Filter condition, if any.
03518 (may be null)
03519 </OL>
03520
03521 @param catalog a catalog name; "" retrieves those without a
03522 catalog; null means drop catalog name from the selection criteria
03523 @param schema a schema name; "" retrieves those without a schema
03524 @param table a table name
03525 @param unique when true, return only indices for unique values;
03526 when false, return indices regardless of whether unique or not
03527 @param approximate when true, result is allowed to reflect approximate
03528 or out of data values; when false, results are requested to be
03529 accurate
03530 @return <code>ResultSet</code> - each row is an index column description
03531 }
03532 function TZAbstractDatabaseMetadata.GetIndexInfo(const Catalog: string;
03533 const Schema: string; const Table: string; Unique: Boolean;
03534 Approximate: Boolean): IZResultSet;
03535 var
03536 Key: string;
03537 begin
03538 Key := GetIndexInfoCacheKey(Catalog, Schema, Table, Unique, Approximate);
03539
03540 Result := GetResultSetFromCache(Key);
03541 if Result = nil then
03542 begin
03543 Result := UncachedGetIndexInfo(Catalog, Schema, Table, Unique, Approximate);
03544 AddResultSetToCache(Key, Result);
03545 end;
03546 end;
03547
03548 {**
03549 Gets a description of a table's indices and statistics. They are
03550 ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.
03551
03552 <P>Each index column description has the following columns:
03553 <OL>
03554 <LI><B>TABLE_CAT</B> String => table catalog (may be null)
03555 <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
03556 <LI><B>TABLE_NAME</B> String => table name
03557 <LI><B>NON_UNIQUE</B> boolean => Can index values be non-unique?
03558 false when TYPE is tableIndexStatistic
03559 <LI><B>INDEX_QUALIFIER</B> String => index catalog (may be null);
03560 null when TYPE is tableIndexStatistic
03561 <LI><B>INDEX_NAME</B> String => index name; null when TYPE is
03562 tableIndexStatistic
03563 <LI><B>TYPE</B> short => index type:
03564 <UL>
03565 <LI> tableIndexStatistic - this identifies table statistics that are
03566 returned in conjuction with a table's index descriptions
03567 <LI> tableIndexClustered - this is a clustered index
03568 <LI> tableIndexHashed - this is a hashed index
03569 <LI> tableIndexOther - this is some other style of index
03570 </UL>
03571 <LI><B>ORDINAL_POSITION</B> short => column sequence number
03572 within index; zero when TYPE is tableIndexStatistic
03573 <LI><B>COLUMN_NAME</B> String => column name; null when TYPE is
03574 tableIndexStatistic
03575 <LI><B>ASC_OR_DESC</B> String => column sort sequence, "A" => ascending,
03576 "D" => descending, may be null if sort sequence is not supported;
03577 null when TYPE is tableIndexStatistic
03578 <LI><B>CARDINALITY</B> int => When TYPE is tableIndexStatistic, then
03579 this is the number of rows in the table; otherwise, it is the
03580 number of unique values in the index.
03581 <LI><B>PAGES</B> int => When TYPE is tableIndexStatisic then
03582 this is the number of pages used for the table, otherwise it
03583 is the number of pages used for the current index.
03584 <LI><B>FILTER_CONDITION</B> String => Filter condition, if any.
03585 (may be null)
03586 </OL>
03587
03588 @param catalog a catalog name; "" retrieves those without a
03589 catalog; null means drop catalog name from the selection criteria
03590 @param schema a schema name; "" retrieves those without a schema
03591 @param table a table name
03592 @param unique when true, return only indices for unique values;
03593 when false, return indices regardless of whether unique or not
03594 @param approximate when true, result is allowed to reflect approximate
03595 or out of data values; when false, results are requested to be
03596 accurate
03597 @return <code>ResultSet</code> - each row is an index column description
03598 }
03599 function TZAbstractDatabaseMetadata.UncachedGetIndexInfo(const Catalog: string;
03600 const Schema: string; const Table: string; Unique: Boolean;
03601 Approximate: Boolean): IZResultSet;
03602 begin
03603 Result := ConstructVirtualResultSet(IndexInfoColumnsDynArray);
03604 end;
03605
03606 function TZAbstractDatabaseMetadata.GetSequences(const Catalog, SchemaPattern,
03607 SequenceNamePattern: string): IZResultSet;
03608 var
03609 Key: string;
03610 begin
03611 Key := GetSequencesCacheKey(Catalog, SchemaPattern, SequenceNamePattern);
03612
03613 Result := GetResultSetFromCache(Key);
03614 if Result = nil then
03615 begin
03616 Result := UncachedGetSequences(Catalog, SchemaPattern, SequenceNamePattern);
03617 AddResultSetToCache(Key, Result);
03618 end;
03619 end;
03620
03621 function TZAbstractDatabaseMetadata.UncachedGetSequences(const Catalog, SchemaPattern,
03622 SequenceNamePattern: string): IZResultSet;
03623 begin
03624 Result := ConstructVirtualResultSet(SequenceColumnsDynArray);
03625 end;
03626
03627 {**
03628 Does the database support the given result set type?
03629 @param type defined in <code>java.sql.ResultSet</code>
03630 @return <code>true</code> if so; <code>false</code> otherwise
03631 }
03632 function TZAbstractDatabaseMetadata.SupportsResultSetType(
03633 _Type: TZResultSetType): Boolean;
03634 begin
03635 Result := True;
03636 end;
03637
03638 {**
03639 Does the database support the concurrency type in combination
03640 with the given result set type?
03641
03642 @param type defined in <code>java.sql.ResultSet</code>
03643 @param concurrency type defined in <code>java.sql.ResultSet</code>
03644 @return <code>true</code> if so; <code>false</code> otherwise
03645 }
03646 function TZAbstractDatabaseMetadata.SupportsResultSetConcurrency(
03647 _Type: TZResultSetType; Concurrency: TZResultSetConcurrency): Boolean;
03648 begin
03649 Result := True;
03650 end;
03651
03652 {**
03653 Indicates whether the driver supports batch updates.
03654 @return true if the driver supports batch updates; false otherwise
03655 }
03656 function TZAbstractDatabaseMetadata.SupportsBatchUpdates: Boolean;
03657 begin
03658 Result := True;
03659 end;
03660
03661 {**
03662
03663 Gets a description of the user-defined types defined in a particular
03664 schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT,
03665 or DISTINCT.
03666
03667 <P>Only types matching the catalog, schema, type name and type
03668 criteria are returned. They are ordered by DATA_TYPE, TYPE_SCHEM
03669 and TYPE_NAME. The type name parameter may be a fully-qualified
03670 name. In this case, the catalog and schemaPattern parameters are
03671 ignored.
03672
03673 <P>Each type description has the following columns:
03674 <OL>
03675 <LI><B>TYPE_CAT</B> String => the type's catalog (may be null)
03676 <LI><B>TYPE_SCHEM</B> String => type's schema (may be null)
03677 <LI><B>TYPE_NAME</B> String => type name
03678 <LI><B>CLASS_NAME</B> String => Java class name
03679 <LI><B>DATA_TYPE</B> String => type value defined in java.sql.Types.
03680 One of JAVA_OBJECT, STRUCT, or DISTINCT
03681 <LI><B>REMARKS</B> String => explanatory comment on the type
03682 </OL>
03683
03684 <P><B>Note:</B> If the driver does not support UDTs, an empty
03685 result set is returned.
03686
03687 @param catalog a catalog name; "" retrieves those without a
03688 catalog; null means drop catalog name from the selection criteria
03689 @param schemaPattern a schema name pattern; "" retrieves those
03690 without a schema
03691 @param typeNamePattern a type name pattern; may be a fully-qualified name
03692 @param types a list of user-named types to include (JAVA_OBJECT,
03693 STRUCT, or DISTINCT); null returns all types
03694 @return <code>ResultSet</code> - each row is a type description
03695 }
03696 function TZAbstractDatabaseMetadata.GetUDTs(const Catalog: string;
03697 const SchemaPattern: string; const TypeNamePattern: string;
03698 const Types: TIntegerDynArray): IZResultSet;
03699 var
03700 Key: string;
03701 begin
03702 Key := GetUDTsCacheKey(Catalog, SchemaPattern, TypeNamePattern,
03703 Types);
03704
03705 Result := GetResultSetFromCache(Key);
03706 if Result = nil then
03707 begin
03708 Result := UncachedGetUDTs(Catalog, SchemaPattern, TypeNamePattern, Types);
03709 AddResultSetToCache(Key, Result);
03710 end;
03711 end;
03712
03713 {**
03714
03715 Gets a description of the user-defined types defined in a particular
03716 schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT,
03717 or DISTINCT.
03718
03719 <P>Only types matching the catalog, schema, type name and type
03720 criteria are returned. They are ordered by DATA_TYPE, TYPE_SCHEM
03721 and TYPE_NAME. The type name parameter may be a fully-qualified
03722 name. In this case, the catalog and schemaPattern parameters are
03723 ignored.
03724
03725 <P>Each type description has the following columns:
03726 <OL>
03727 <LI><B>TYPE_CAT</B> String => the type's catalog (may be null)
03728 <LI><B>TYPE_SCHEM</B> String => type's schema (may be null)
03729 <LI><B>TYPE_NAME</B> String => type name
03730 <LI><B>CLASS_NAME</B> String => Java class name
03731 <LI><B>DATA_TYPE</B> String => type value defined in java.sql.Types.
03732 One of JAVA_OBJECT, STRUCT, or DISTINCT
03733 <LI><B>REMARKS</B> String => explanatory comment on the type
03734 </OL>
03735
03736 <P><B>Note:</B> If the driver does not support UDTs, an empty
03737 result set is returned.
03738
03739 @param catalog a catalog name; "" retrieves those without a
03740 catalog; null means drop catalog name from the selection criteria
03741 @param schemaPattern a schema name pattern; "" retrieves those
03742 without a schema
03743 @param typeNamePattern a type name pattern; may be a fully-qualified name
03744 @param types a list of user-named types to include (JAVA_OBJECT,
03745 STRUCT, or DISTINCT); null returns all types
03746 @return <code>ResultSet</code> - each row is a type description
03747 }
03748 function TZAbstractDatabaseMetadata.UncachedGetUDTs(const Catalog: string;
03749 const SchemaPattern: string; const TypeNamePattern: string;
03750 const Types: TIntegerDynArray): IZResultSet;
03751 begin
03752 Result := ConstructVirtualResultSet(UDTColumnsDynArray);
03753 end;
03754
03755 {**
03756 Creates ab identifier convertor object.
03757 @returns an identifier convertor object.
03758 }
03759 function TZAbstractDatabaseMetadata.GetIdentifierConvertor:
03760 IZIdentifierConvertor;
03761 begin
03762 Result := TZDefaultIdentifierConvertor.Create(Self);
03763 end;
03764
03765 {**
03766 Add escape character in the pattern that has wildcards character
03767 @param Pattern The pattern that would be escaped
03768 @return Escaped Pattern
03769 }
03770 function TZAbstractDatabaseMetadata.AddEscapeCharToWildcards(
03771 const Pattern: string): string;
03772 var i:Integer;
03773 EscapeChar : string;
03774 begin
03775 EscapeChar:=GetSearchStringEscape;
03776 if WildcardsArray<>nil then
03777 begin
03778 Result:=StringReplace(Pattern,EscapeChar,EscapeChar+EscapeChar,[rfReplaceAll]);
03779 for i:=0 to High(WildcardsArray) do
03780 Result:=StringReplace(Result,WildcardsArray[i],EscapeChar+WildcardsArray[i],[rfReplaceAll]);
03781 end;
03782 end;
03783
03784 {**
03785 Set the Wildcards character for WildcardsArray variable.
03786 Overrride this method if the wildcards character is different in other database
03787 }
03788 procedure TZAbstractDatabaseMetadata.FillWildcards;
03789 begin
03790 try
03791 SetLength(WildcardsArray,2);
03792 WildcardsArray[0]:='_';
03793 WildcardsArray[1]:='%';
03794 except
03795 WildcardsArray:=nil;
03796 end;
03797 end;
03798
03799 {**
03800 Get the Wildscards in set of char type
03801 @return TZWildcardsSet type
03802 }
03803 function TZAbstractDatabaseMetadata.GetWildcardsSet:TZWildcardsSet;
03804 var i:Integer;
03805 begin
03806 Result:=[];
03807 for i:=0 to High(WildcardsArray) do
03808 Result:=Result+[WildcardsArray[i]];
03809 end;
03810
03811
03812
03813
03814 {**
03815 returns cache key for GetProcedures metadata entry
03816 @param Catalog a catalog name
03817 @param SchemaPattern a schema name pattern
03818 @param ProcedureNamePattern a procedure name pattern
03819 @return the cache key string
03820 }
03821 function TZAbstractDatabaseMetadata.GetProceduresCacheKey(const Catalog: string;
03822 const SchemaPattern: string; const ProcedureNamePattern: string): string;
03823 begin
03824 Result := Format('get-procedures:%s:%s:%s',
03825 [Catalog, SchemaPattern, ProcedureNamePattern]);
03826 end;
03827
03828 {**
03829 returns cache key for GetProcedureColumns metadata entry
03830 @param Catalog a catalog name
03831 @param SchemaPattern a schema name pattern
03832 @param ProcedureNamePattern a procedure name pattern
03833 @param ColumnNamePattern a column name pattern
03834 @return the cache key string
03835 }
03836 function TZAbstractDatabaseMetadata.GetProcedureColumnsCacheKey(const Catalog: string;
03837 const SchemaPattern: string; const ProcedureNamePattern: string;
03838 const ColumnNamePattern: string): string;
03839 begin
03840 Result := Format('get-procedure-columns:%s:%s:%s:%s',
03841 [Catalog, SchemaPattern, ProcedureNamePattern, ColumnNamePattern]);
03842 end;
03843
03844 {**
03845 returns cache key for GetTables metadata entry
03846 @param Catalog a catalog name
03847 @param SchemaPattern a schema name pattern
03848 @param TableNamePattern a table name pattern
03849 @param Types table types list
03850 @return the cache key string
03851 }
03852 function TZAbstractDatabaseMetadata.GetTablesCacheKey(const Catalog: string;
03853 const SchemaPattern: string; const TableNamePattern: string;
03854 const Types: TStringDynArray): string;
03855 var
03856 I: Integer;
03857 Key: string;
03858 begin
03859 Key := '';
03860 for I := Low(Types) to High(Types) do
03861 Key := Key + ':' + Types[I];
03862
03863 Result := Format('get-tables:%s:%s:%s:%s',
03864 [Catalog, SchemaPattern, TableNamePattern, Key]);
03865 end;
03866
03867 {**
03868 returns cache key for GetSchemas metadata entry
03869 @return the cache key string
03870 }
03871 function TZAbstractDatabaseMetadata.GetSchemasCacheKey: string;
03872 begin
03873 Result := 'get-schemas';
03874 end;
03875
03876 {**
03877 returns cache key for GetCatalogs metadata entry
03878 @return the cache key string
03879 }
03880 function TZAbstractDatabaseMetadata.GetCatalogsCacheKey: string;
03881 begin
03882 Result := 'get-catalogs';
03883 end;
03884
03885 {**
03886 returns cache key for GetTableTypes metadata entry
03887 @return the cache key string
03888 }
03889 function TZAbstractDatabaseMetadata.GetTableTypesCacheKey: string;
03890 begin
03891 Result := 'get-table-types';
03892 end;
03893
03894 {**
03895 returns cache key for GetColumns metadata entry
03896 @param Catalog a catalog name
03897 @param SchemaPattern a schema name pattern
03898 @param TableNamePattern a table name pattern
03899 @param ColumnNamePattern a column name pattern
03900 @return the cache key string
03901 }
03902 function TZAbstractDatabaseMetadata.GetColumnsCacheKey(const Catalog: string;
03903 const SchemaPattern: string; const TableNamePattern: string;
03904 const ColumnNamePattern: string): string;
03905 begin
03906 Result := Format('get-columns:%s:%s:%s:%s',
03907 [Catalog, SchemaPattern, TableNamePattern, ColumnNamePattern]);
03908 end;
03909
03910 {**
03911 returns cache key for GetColumnPrivileges metadata entry
03912 @param Catalog a catalog name
03913 @param Schema a schema name
03914 @param Table a table name
03915 @param ColumnNamePattern a column name pattern
03916 @return the cache key string
03917 }
03918 function TZAbstractDatabaseMetadata.GetColumnPrivilegesCacheKey(
03919 const Catalog: string; const Schema: string; const Table: string;
03920 const ColumnNamePattern: string): string;
03921 begin
03922 Result := Format('get-column-privileges:%s:%s:%s:%s',
03923 [Catalog, Schema, Table, ColumnNamePattern]);
03924 end;
03925
03926 {**
03927 returns cache key for GetTablePrivileges metadata entry
03928 @param Catalog a catalog name
03929 @param SchemaPattern a schema name pattern
03930 @param TableNamePattern a table name pattern
03931 @return the cache key string
03932 }
03933 function TZAbstractDatabaseMetadata.GetTablePrivilegesCacheKey(
03934 const Catalog: string; const SchemaPattern: string;
03935 const TableNamePattern: string): string;
03936 begin
03937 Result := Format('get-table-privileges:%s:%s:%s',
03938 [Catalog, SchemaPattern, TableNamePattern]);
03939 end;
03940
03941 {**
03942 returns cache key for GetBestRowIdentifier metadata entry
03943 @param Catalog a catalog name
03944 @param Schema a schema name
03945 @param Table a table name
03946 @param Scope the scope of interest
03947 @param Nullable include columns that are nullable?
03948 @return the cache key string
03949 }
03950 function TZAbstractDatabaseMetadata.GetBestRowIdentifierCacheKey(
03951 const Catalog: string; const Schema: string; const Table: string;
03952 const Scope: Integer; const Nullable: Boolean): string;
03953 begin
03954 Result := Format('get-best-row-identifier:%s:%s:%s:%d:%s',
03955 [Catalog, Schema, Table, Scope, BoolToStr(Nullable)]);
03956 end;
03957
03958 {**
03959 returns cache key for GetVersionColumns metadata entry
03960 @param Catalog a catalog name
03961 @param Schema a schema name
03962 @param Table a table name
03963 @return the cache key string
03964 }
03965 function TZAbstractDatabaseMetadata.GetVersionColumnsCacheKey(
03966 const Catalog: string; const Schema: string; const Table: string): string;
03967 begin
03968 Result := Format('get-version-columns:%s:%s:%s', [Catalog, Schema, Table]);
03969 end;
03970
03971 {**
03972 returns cache key for GetPrimaryKeys metadata entry
03973 @param Catalog a catalog name
03974 @param Schema a schema name
03975 @param Table a table name
03976 @return the cache key string
03977 }
03978 function TZAbstractDatabaseMetadata.GetPrimaryKeysCacheKey(const Catalog: string;
03979 const Schema: string; const Table: string): string;
03980 begin
03981 Result := Format('get-primary-keys:%s:%s:%s', [Catalog, Schema, Table]);
03982 end;
03983
03984 {**
03985 returns cache key for GetImportedKeys metadata entry
03986 @param Catalog a catalog name
03987 @param Schema a schema name
03988 @param Table a table name
03989 @return the cache key string
03990 }
03991 function TZAbstractDatabaseMetadata.GetImportedKeysCacheKey(const Catalog: string;
03992 const Schema: string; const Table: string): string;
03993 begin
03994 Result := Format('get-imported-keys:%s:%s:%s', [Catalog, Schema, Table]);
03995 end;
03996
03997 {**
03998 returns cache key for GetExportedKeys metadata entry
03999 @param Catalog a catalog name
04000 @param Schema a schema name
04001 @param Table a table name
04002 @return the cache key string
04003 }
04004 function TZAbstractDatabaseMetadata.GetExportedKeysCacheKey(const Catalog: string;
04005 const Schema: string; const Table: string): string;
04006 begin
04007 Result := Format('get-exported-keys:%s:%s:%s', [Catalog, Schema, Table]);
04008 end;
04009
04010 {**
04011 returns cache key for GetCrossReference metadata entry
04012 @param PrimaryCatalog a catalog name for the primary table
04013 @param PrimarySchema a schema name for the primary table
04014 @param PrimaryTable the table name that exports the key
04015 @param ForeignCatalog a catalog name for the foreign table
04016 @param ForeignSchema a schema name for the foreign table
04017 @param ForeignTable the table name that imports the key
04018 @return the cache key string
04019 }
04020 function TZAbstractDatabaseMetadata.GetCrossReferenceCacheKey(
04021 const PrimaryCatalog: string; const PrimarySchema: string;
04022 const PrimaryTable: string; const ForeignCatalog: string;
04023 const ForeignSchema: string; const ForeignTable: string): string;
04024 begin
04025 Result := Format('get-cross-reference:%s:%s:%s:%s:%s:%s',
04026 [PrimaryCatalog, PrimarySchema, PrimaryTable, ForeignCatalog,
04027 ForeignSchema, ForeignTable]);
04028 end;
04029
04030 {**
04031 returns cache key for GetTypeInfo metadata entry
04032 @return the cache key string
04033 }
04034 function TZAbstractDatabaseMetadata.GetTypeInfoCacheKey: string;
04035 begin
04036 Result := 'get-type-info';
04037 end;
04038
04039 {**
04040 returns cache key for GetIndexInfo metadata entry
04041 @param Catalog a catalog name
04042 @param Schema a schema name
04043 @param Table a table name
04044 @param Unique when true, return key for a metadata entry that should contain
04045 only indices for unique values; when false, return key for a metadata
04046 entry that may contain indices to non-unique values
04047 @param Approximate when true, return key for a metadata entry that may include
04048 approximate or out of data values; when false, return key for a metadata
04049 entry that should contain only accurate results
04050 @return the cache key string
04051 }
04052 function TZAbstractDatabaseMetadata.GetIndexInfoCacheKey(const Catalog: string;
04053 const Schema: string; const Table: string; const Unique: Boolean;
04054 const Approximate: Boolean): string;
04055 begin
04056 Result := Format('get-index-info:%s:%s:%s:%s:%s',
04057 [Catalog, Schema, Table, BoolToStr(Unique), BoolToStr(Approximate)]);
04058 end;
04059
04060 {**
04061 returns cache key for GetSequences metadata entry
04062 @param Catalog a catalog name
04063 @param SchemaPattern a schema name pattern
04064 @param SequenceNamePattern a sequence name pattern
04065 @return the cache key string
04066 }
04067 function TZAbstractDatabaseMetadata.GetSequencesCacheKey(const Catalog: string;
04068 const SchemaPattern: string; const SequenceNamePattern: string): string;
04069 begin
04070 Result := Format('get-sequences:%s:%s:%s',
04071 [Catalog, SchemaPattern, SequenceNamePattern]);
04072 end;
04073
04074 {**
04075 returns cache key for GetUDTs metadata entry
04076 @param Catalog a catalog name
04077 @param SchemaPattern a schema name pattern
04078 @param TypeNamePattern a type name pattern
04079 @param Types a list of user-named types to include
04080 @return the cache key string
04081 }
04082 function TZAbstractDatabaseMetadata.GetUDTsCacheKey(const Catalog: string;
04083 const SchemaPattern: string; const TypeNamePattern: string;
04084 const Types: TIntegerDynArray): string;
04085 var
04086 I: Integer;
04087 begin
04088 Result := '';
04089 for I := Low(Types) to High(Types) do
04090 Result := Result + ':' + IntToStr(Types[I]);
04091 Result := Format('get-udts:%s:%s:%s%s',
04092 [Catalog, SchemaPattern, TypeNamePattern, Result]);
04093 end;
04094
04095 {**
04096 fills string list with the keys for the currently cached metadata entries
04097 @param List a string list to fill out
04098 }
04099 procedure TZAbstractDatabaseMetadata.GetCacheKeys(List: TStrings);
04100 var
04101 I: Integer;
04102 begin
04103 List.Clear;
04104 with CachedResultSets.Keys do
04105 for I := 0 to Count-1 do
04106 List.Add((Items[I] as IZAnyValue).GetString);
04107 end;
04108
04109
04110
04111
04112
04113 { TZVirtualResultSet }
04114
04115 {**
04116 Creates this object and assignes the main properties.
04117 @param Statement an SQL statement object.
04118 @param SQL an SQL query string.
04119 }
04120 constructor TZVirtualResultSet.CreateWithStatement(const SQL: string;
04121 Statement: IZStatement);
04122 begin
04123 inherited CreateWithStatement(SQL, Statement);
04124 end;
04125
04126 {**
04127 Creates this object and assignes the main properties.
04128 @param ColumnsInfo a columns info for cached rows.
04129 @param SQL an SQL query string.
04130 }
04131 constructor TZVirtualResultSet.CreateWithColumns(ColumnsInfo: TObjectList;
04132 const SQL: string);
04133 begin
04134 inherited CreateWithColumns(ColumnsInfo, SQL);
04135 end;
04136
04137 {**
04138 Destroys this object and cleanups the memory.
04139 }
04140 destructor TZVirtualResultSet.Destroy;
04141 begin
04142 inherited Destroy;
04143 end;
04144
04145 {**
04146 Calculates column default values..
04147 @param RowAccessor a row accessor which contains new column values.
04148 }
04149 procedure TZVirtualResultSet.CalculateRowDefaults(RowAccessor: TZRowAccessor);
04150 begin
04151 end;
04152
04153 {**
04154 Post changes to database server.
04155 @param OldRowAccessor a row accessor which contains old column values.
04156 @param NewRowAccessor a row accessor which contains new or updated
04157 column values.
04158 }
04159 procedure TZVirtualResultSet.PostRowUpdates(OldRowAccessor,
04160 NewRowAccessor: TZRowAccessor);
04161 begin
04162 end;
04163
04164 { TZDefaultIdentifierConvertor }
04165
04166 {**
04167 Constructs this default identifier convertor object.
04168 @param Metadata a database metadata interface.
04169 }
04170 constructor TZDefaultIdentifierConvertor.Create(
04171 Metadata: IZDatabaseMetadata);
04172 begin
04173 inherited Create;
04174 FMetadata := Metadata;
04175 end;
04176
04177 {**
04178 Checks is the specified string in lower case.
04179 @param an identifier string.
04180 @return <code>True</code> is the identifier string in lower case.
04181 }
04182 function TZDefaultIdentifierConvertor.IsLowerCase(const Value: string): Boolean;
04183 var
04184 I: Integer;
04185 begin
04186 Result := True;
04187 for I := 1 to Length(Value) do
04188 begin
04189 if not (Value[I] in ['a'..'z','0'..'9','_']) then
04190 begin
04191 Result := False;
04192 Break;
04193 end;
04194 end;
04195 end;
04196
04197 {**
04198 Checks is the specified string in upper case.
04199 @param an identifier string.
04200 @return <code>True</code> is the identifier string in upper case.
04201 }
04202 function TZDefaultIdentifierConvertor.IsUpperCase(const Value: string): Boolean;
04203 var
04204 I: Integer;
04205 begin
04206 Result := True;
04207 for I := 1 to Length(Value) do
04208 begin
04209 if not (Value[I] in ['A'..'Z','0'..'9','_']) then
04210 begin
04211 Result := False;
04212 Break;
04213 end;
04214 end;
04215 end;
04216
04217 {**
04218 Checks is the specified string in special case.
04219 @param an identifier string.
04220 @return <code>True</code> is the identifier string in mixed case.
04221 }
04222 function TZDefaultIdentifierConvertor.IsSpecialCase(const Value: string): Boolean;
04223 var
04224 I: Integer;
04225 begin
04226 Result := False;
04227 if (Value[1] in ['0'..'9']) then
04228 begin
04229 Result := True;
04230 exit;
04231 end;
04232 for I := 1 to Length(Value) do
04233 begin
04234 if not (Value[I] in ['A'..'Z','a'..'z','0'..'9','_']) then
04235 begin
04236 Result := True;
04237 Break;
04238 end;
04239 end;
04240 end;
04241
04242 {**
04243 Checks is the string case sensitive.
04244 @return <code>True</code> if the string case sensitive.
04245 }
04246 function TZDefaultIdentifierConvertor.IsCaseSensitive(const Value: string): Boolean;
04247 const
04248 AnsiSQLKeywords = 'insert,update,delete,select,drop,create,from,set,values,'
04249 + 'where,order,group,by,having,into,as,table,index,primary,key,on,is,null,'
04250 + 'char,varchar,integer,number';
04251 var
04252 Keywords: string;
04253 begin
04254 if Value = '' then
04255 Result := False
04256 else if IsSpecialCase(Value) then
04257 Result := True
04258 else if IsLowerCase(Value) then
04259 Result := Metadata.StoresUpperCaseIdentifiers
04260 else if IsUpperCase(Value) then
04261 Result := Metadata.StoresLowerCaseIdentifiers
04262 else
04263 Result := not Metadata.StoresMixedCaseIdentifiers;
04264
04265 { Checks for reserved keywords. }
04266 if not Result then
04267 begin
04268 Keywords := ',' + AnsiSQLKeywords + ','
04269 + LowerCase(Metadata.GetSQLKeywords) + ',';
04270 Result := Pos(',' + LowerCase(Value) + ',', Keywords) > 0;
04271 end;
04272 end;
04273
04274 {**
04275 Checks is the string quoted.
04276 @return <code>True</code> is the string quoted.
04277 }
04278 function TZDefaultIdentifierConvertor.IsQuoted(const Value: string): Boolean;
04279 var
04280 QuoteDelim: string;
04281 begin
04282 QuoteDelim := Metadata.GetIdentifierQuoteString;
04283 Result := (QuoteDelim <> '') and (Value <> '') and (QuoteDelim[1] = Value[1]);
04284 end;
04285
04286 {**
04287 Extracts the quote from the idenfitier string.
04288 @param an identifier string.
04289 @return a extracted and processed string.
04290 }
04291 function TZDefaultIdentifierConvertor.ExtractQuote(const Value: string): string;
04292 begin
04293 if IsQuoted(Value) then
04294 begin
04295 Result := Copy(Value, 2, Length(Value) - 2);
04296 if not Metadata.StoresMixedCaseQuotedIdentifiers then
04297 begin
04298 if Metadata.StoresLowerCaseQuotedIdentifiers then
04299 Result := LowerCase(Result)
04300 else if Metadata.StoresUpperCaseQuotedIdentifiers then
04301 Result := UpperCase(Result);
04302 end;
04303 end
04304 else
04305 begin
04306 Result := Value;
04307 if not Metadata.StoresMixedCaseIdentifiers then
04308 begin
04309 if Metadata.StoresLowerCaseIdentifiers then
04310 Result := LowerCase(Result)
04311 else if Metadata.StoresUpperCaseIdentifiers then
04312 Result := UpperCase(Result);
04313 end;
04314 end;
04315 end;
04316
04317 {**
04318 Quotes the identifier string.
04319 @param an identifier string.
04320 @return a quoted string.
04321 }
04322 function TZDefaultIdentifierConvertor.Quote(const Value: string): string;
04323 var
04324 QuoteDelim: string;
04325 begin
04326 Result := Value;
04327 if IsCaseSensitive(Value) then
04328 begin
04329 QuoteDelim := Metadata.GetIdentifierQuoteString;
04330 if Length(QuoteDelim) > 1 then
04331 Result := QuoteDelim[1] + Result + QuoteDelim[2]
04332 else if Length(QuoteDelim) = 1 then
04333 Result := QuoteDelim[1] + Result + QuoteDelim[1];
04334 end;
04335 end;
04336
04337 {**
04338 rerurns cache key for get tables metadata entry
04339 @param Catalog catalog name
04340 @param SchemaPattern schema pattern
04341 @param TableNamePattern table name pattern
04342 @param Types table types
04343 @return the cache key string
04344 @deprecated use TZAbstractDatabaseMetadata.GetTablesCacheKey instead
04345 }
04346 function GetTablesMetaDataCacheKey(Const Catalog:String;
04347 Const SchemaPattern:String; Const TableNamePattern:String;const Types: TStringDynArray):String;
04348 Var I : Integer;
04349 Key : String;
04350 begin
04351 Key := '';
04352 for I := Low(Types) to High(Types) do
04353 Key := Key + ':' + Types[I];
04354
04355 Result:= Format('get-tables:%s:%s:%s:%s',
04356 [Catalog, SchemaPattern, TableNamePattern, Key]);
04357 end;
04358
04359
04360 const
04361 ProceduresColumnCount = 8;
04362 ProceduresColumns: array[1..ProceduresColumnCount]
04363 of TZMetadataColumnDef =(
04364 (Name: 'PROCEDURE_CAT'; SQLType: stString; Length: 255),
04365 (Name: 'PROCEDURE_SCHEM'; SQLType: stString; Length: 255),
04366 (Name: 'PROCEDURE_NAME'; SQLType: stString; Length: 255),
04367 (Name: 'RESERVED1'; SQLType: stString; Length: 255),
04368 (Name: 'RESERVED2'; SQLType: stString; Length: 255),
04369 (Name: 'RESERVED3'; SQLType: stString; Length: 255),
04370 (Name: 'REMARKS'; SQLType: stString; Length: 255),
04371 (Name: 'PROCEDURE_TYPE'; SQLType: stShort; Length: 0)
04372 );
04373
04374 ProceduresColColumnCount = 13;
04375 ProceduresColColumns: array[1..ProceduresColColumnCount]
04376 of TZMetadataColumnDef =(
04377 (Name: 'PROCEDURE_CAT'; SQLType: stString; Length: 255),
04378 (Name: 'PROCEDURE_SCHEM'; SQLType: stString; Length: 255),
04379 (Name: 'PROCEDURE_NAME'; SQLType: stString; Length: 255),
04380 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04381 (Name: 'COLUMN_TYPE'; SQLType: stShort; Length: 0),
04382 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04383 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04384 (Name: 'PRECISION'; SQLType: stInteger; Length: 0),
04385 (Name: 'LENGTH'; SQLType: stInteger; Length: 0),
04386 (Name: 'SCALE'; SQLType: stShort; Length: 0),
04387 (Name: 'RADIX'; SQLType: stShort; Length: 0),
04388 (Name: 'NULLABLE'; SQLType: stShort; Length: 0),
04389 (Name: 'REMARKS'; SQLType: stString; Length: 255)
04390 );
04391
04392 TableColumnCount = 5;
04393 TableColumns: array[1..TableColumnCount]
04394 of TZMetadataColumnDef =(
04395 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04396 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04397 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04398 (Name: 'TABLE_TYPE'; SQLType: stString; Length: 255),
04399 (Name: 'REMARKS'; SQLType: stString; Length: 255)
04400 );
04401
04402 SchemaColumnCount = 1;
04403 SchemaColumns: array[1..SchemaColumnCount]
04404 of TZMetadataColumnDef =(
04405 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255)
04406 );
04407
04408 CatalogColumnCount = 1;
04409 CatalogColumns: array[1..CatalogColumnCount]
04410 of TZMetadataColumnDef =(
04411 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255)
04412 );
04413
04414 TableTypeColumnCount = 1;
04415 TableTypeColumns: array[1..TableTypeColumnCount]
04416 of TZMetadataColumnDef =(
04417 (Name: 'TABLE_TYPE'; SQLType: stString; Length: 255)
04418 );
04419
04420 TableColColumnCount = 24;
04421 TableColColumns: array[1..TableColColumnCount]
04422 of TZMetadataColumnDef =(
04423 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04424 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04425 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04426 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04427 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04428 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04429 (Name: 'COLUMN_SIZE'; SQLType: stInteger; Length: 0),
04430 (Name: 'BUFFER_LENGTH'; SQLType: stInteger; Length: 0),
04431 (Name: 'DECIMAL_DIGITS'; SQLType: stInteger; Length: 0),
04432 (Name: 'NUM_PREC_RADIX'; SQLType: stInteger; Length: 0),
04433 (Name: 'NULLABLE'; SQLType: stInteger; Length: 0),
04434 (Name: 'REMARKS'; SQLType: stString; Length: 255),
04435 (Name: 'COLUMN_DEF'; SQLType: stString; Length: 255),
04436 (Name: 'SQL_DATA_TYPE'; SQLType: stInteger; Length: 0),
04437 (Name: 'SQL_DATETIME_SUB'; SQLType: stInteger; Length: 0),
04438 (Name: 'CHAR_OCTET_LENGTH'; SQLType: stInteger; Length: 0),
04439 (Name: 'ORDINAL_POSITION'; SQLType: stInteger; Length: 0),
04440 (Name: 'IS_NULLABLE'; SQLType: stString; Length: 255),
04441 (Name: 'AUTO_INCREMENT'; SQLType: stBoolean; Length: 0),
04442 (Name: 'CASE_SENSITIVE'; SQLType: stBoolean; Length: 0),
04443 (Name: 'SEARCHABLE'; SQLType: stBoolean; Length: 0),
04444 (Name: 'WRITABLE'; SQLType: stBoolean; Length: 0),
04445 (Name: 'DEFINITELYWRITABLE'; SQLType: stBoolean; Length: 0),
04446 (Name: 'READONLY'; SQLType: stBoolean; Length: 0)
04447 );
04448
04449 TableColPrivColumnCount = 8;
04450 TableColPrivColumns: array[1..TableColPrivColumnCount]
04451 of TZMetadataColumnDef =(
04452 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04453 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04454 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04455 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04456 (Name: 'GRANTOR'; SQLType: stString; Length: 255),
04457 (Name: 'GRANTEE'; SQLType: stString; Length: 255),
04458 (Name: 'PRIVILEGE'; SQLType: stString; Length: 255),
04459 (Name: 'IS_GRANTABLE'; SQLType: stString; Length: 255)
04460 );
04461
04462 TablePrivColumnCount = 7;
04463 TablePrivColumns: array[1..TablePrivColumnCount]
04464 of TZMetadataColumnDef =(
04465 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04466 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04467 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04468 (Name: 'GRANTOR'; SQLType: stString; Length: 255),
04469 (Name: 'GRANTEE'; SQLType: stString; Length: 255),
04470 (Name: 'PRIVILEGE'; SQLType: stString; Length: 255),
04471 (Name: 'IS_GRANTABLE'; SQLType: stString; Length: 255)
04472 );
04473
04474 BestRowIdentColumnCount = 8;
04475 BestRowIdentColumns: array[1..BestRowIdentColumnCount]
04476 of TZMetadataColumnDef =(
04477 (Name: 'SCOPE'; SQLType: stShort; Length: 0),
04478 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04479 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04480 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04481 (Name: 'COLUMN_SIZE'; SQLType: stInteger; Length: 0),
04482 (Name: 'BUFFER_LENGTH'; SQLType: stInteger; Length: 0),
04483 (Name: 'DECIMAL_DIGITS'; SQLType: stShort; Length: 0),
04484 (Name: 'PSEUDO_COLUMN'; SQLType: stShort; Length: 0)
04485 );
04486
04487 TableColVerColumnCount = 8;
04488 TableColVerColumns: array[1..TableColVerColumnCount]
04489 of TZMetadataColumnDef =(
04490 (Name: 'SCOPE'; SQLType: stShort; Length: 0),
04491 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04492 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04493 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04494 (Name: 'COLUMN_SIZE'; SQLType: stInteger; Length: 0),
04495 (Name: 'BUFFER_LENGTH'; SQLType: stInteger; Length: 0),
04496 (Name: 'DECIMAL_DIGITS'; SQLType: stShort; Length: 0),
04497 (Name: 'PSEUDO_COLUMN'; SQLType: stShort; Length: 0)
04498 );
04499
04500 PrimaryKeyColumnCount = 6;
04501 PrimaryKeyColumns: array[1..PrimaryKeyColumnCount]
04502 of TZMetadataColumnDef =(
04503 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04504 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04505 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04506 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04507 (Name: 'KEY_SEQ'; SQLType: stShort; Length: 0),
04508 (Name: 'PK_NAME'; SQLType: stString; Length: 255)
04509 );
04510
04511 ImportedKeyColumnCount = 14;
04512 ImportedKeyColumns: array[1..ImportedKeyColumnCount]
04513 of TZMetadataColumnDef =(
04514 (Name: 'PKTABLE_CAT'; SQLType: stString; Length: 255),
04515 (Name: 'PKTABLE_SCHEM'; SQLType: stString; Length: 255),
04516 (Name: 'PKTABLE_NAME'; SQLType: stString; Length: 255),
04517 (Name: 'PKCOLUMN_NAME'; SQLType: stString; Length: 255),
04518 (Name: 'FKTABLE_CAT'; SQLType: stString; Length: 255),
04519 (Name: 'FKTABLE_SCHEM'; SQLType: stString; Length: 255),
04520 (Name: 'FKTABLE_NAME'; SQLType: stString; Length: 255),
04521 (Name: 'FKCOLUMN_NAME'; SQLType: stString; Length: 255),
04522 (Name: 'KEY_SEQ'; SQLType: stShort; Length: 0),
04523 (Name: 'UPDATE_RULE'; SQLType: stShort; Length: 0),
04524 (Name: 'DELETE_RULE'; SQLType: stShort; Length: 0),
04525 (Name: 'FK_NAME'; SQLType: stString; Length: 255),
04526 (Name: 'PK_NAME'; SQLType: stString; Length: 255),
04527 (Name: 'DEFERRABILITY'; SQLType: stShort; Length: 0)
04528 );
04529
04530 ExportedKeyColumnCount = 14;
04531 ExportedKeyColumns: array[1..ExportedKeyColumnCount]
04532 of TZMetadataColumnDef =(
04533 (Name: 'PKTABLE_CAT'; SQLType: stString; Length: 255),
04534 (Name: 'PKTABLE_SCHEM'; SQLType: stString; Length: 255),
04535 (Name: 'PKTABLE_NAME'; SQLType: stString; Length: 255),
04536 (Name: 'PKCOLUMN_NAME'; SQLType: stString; Length: 255),
04537 (Name: 'FKTABLE_CAT'; SQLType: stString; Length: 255),
04538 (Name: 'FKTABLE_SCHEM'; SQLType: stString; Length: 255),
04539 (Name: 'FKTABLE_NAME'; SQLType: stString; Length: 255),
04540 (Name: 'FKCOLUMN_NAME'; SQLType: stString; Length: 255),
04541 (Name: 'KEY_SEQ'; SQLType: stShort; Length: 0),
04542 (Name: 'UPDATE_RULE'; SQLType: stShort; Length: 0),
04543 (Name: 'DELETE_RULE'; SQLType: stShort; Length: 0),
04544 (Name: 'FK_NAME'; SQLType: stString; Length: 255),
04545 (Name: 'PK_NAME'; SQLType: stString; Length: 255),
04546 (Name: 'DEFERRABILITY'; SQLType: stShort; Length: 0)
04547 );
04548
04549 CrossRefColumnCount = 14;
04550 CrossRefColumns: array[1..CrossRefColumnCount]
04551 of TZMetadataColumnDef =(
04552 (Name: 'PKTABLE_CAT'; SQLType: stString; Length: 255),
04553 (Name: 'PKTABLE_SCHEM'; SQLType: stString; Length: 255),
04554 (Name: 'PKTABLE_NAME'; SQLType: stString; Length: 255),
04555 (Name: 'PKCOLUMN_NAME'; SQLType: stString; Length: 255),
04556 (Name: 'FKTABLE_CAT'; SQLType: stString; Length: 255),
04557 (Name: 'FKTABLE_SCHEM'; SQLType: stString; Length: 255),
04558 (Name: 'FKTABLE_NAME'; SQLType: stString; Length: 255),
04559 (Name: 'FKCOLUMN_NAME'; SQLType: stString; Length: 255),
04560 (Name: 'KEY_SEQ'; SQLType: stShort; Length: 0),
04561 (Name: 'UPDATE_RULE'; SQLType: stShort; Length: 0),
04562 (Name: 'DELETE_RULE'; SQLType: stShort; Length: 0),
04563 (Name: 'FK_NAME'; SQLType: stString; Length: 255),
04564 (Name: 'PK_NAME'; SQLType: stString; Length: 255),
04565 (Name: 'DEFERRABILITY'; SQLType: stShort; Length: 0)
04566 );
04567
04568 TypeInfoColumnCount = 18;
04569 TypeInfoColumns: array[1..TypeInfoColumnCount]
04570 of TZMetadataColumnDef =(
04571 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04572 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04573 (Name: 'PRECISION'; SQLType: stInteger; Length: 0),
04574 (Name: 'LITERAL_PREFIX'; SQLType: stString; Length: 255),
04575 (Name: 'LITERAL_SUFFIX'; SQLType: stString; Length: 255),
04576 (Name: 'CREATE_PARAMS'; SQLType: stString; Length: 255),
04577 (Name: 'NULLABLE'; SQLType: stShort; Length: 0),
04578 (Name: 'CASE_SENSITIVE'; SQLType: stBoolean; Length: 0),
04579 (Name: 'SEARCHABLE'; SQLType: stShort; Length: 0),
04580 (Name: 'UNSIGNED_ATTRIBUTE'; SQLType: stBoolean; Length: 0),
04581 (Name: 'FIXED_PREC_SCALE'; SQLType: stBoolean; Length: 0),
04582 (Name: 'AUTO_INCREMENT'; SQLType: stBoolean; Length: 0),
04583 (Name: 'LOCAL_TYPE_NAME'; SQLType: stString; Length: 255),
04584 (Name: 'MINIMUM_SCALE'; SQLType: stShort; Length: 0),
04585 (Name: 'MAXIMUM_SCALE'; SQLType: stShort; Length: 0),
04586 (Name: 'SQL_DATA_TYPE'; SQLType: stInteger; Length: 0),
04587 (Name: 'SQL_DATETIME_SUB'; SQLType: stInteger; Length: 0),
04588 (Name: 'NUM_PREC_RADIX'; SQLType: stInteger; Length: 0)
04589 );
04590
04591 IndexInfoColumnCount = 13;
04592 IndexInfoColumns: array[1..IndexInfoColumnCount]
04593 of TZMetadataColumnDef =(
04594 (Name: 'TABLE_CAT'; SQLType: stString; Length: 255),
04595 (Name: 'TABLE_SCHEM'; SQLType: stString; Length: 255),
04596 (Name: 'TABLE_NAME'; SQLType: stString; Length: 255),
04597 (Name: 'NON_UNIQUE'; SQLType: stBoolean; Length: 0),
04598 (Name: 'INDEX_QUALIFIER'; SQLType: stString; Length: 255),
04599 (Name: 'INDEX_NAME'; SQLType: stString; Length: 255),
04600 (Name: 'TYPE'; SQLType: stShort; Length: 0),
04601 (Name: 'ORDINAL_POSITION'; SQLType: stShort; Length: 0),
04602 (Name: 'COLUMN_NAME'; SQLType: stString; Length: 255),
04603 (Name: 'ASC_OR_DESC'; SQLType: stString; Length: 255),
04604 (Name: 'CARDINALITY'; SQLType: stInteger; Length: 0),
04605 (Name: 'PAGES'; SQLType: stInteger; Length: 0),
04606 (Name: 'FILTER_CONDITION'; SQLType: stString; Length: 255)
04607 );
04608
04609 SequenceColumnCount = 3;
04610 SequenceColumns: array[1..SequenceColumnCount]
04611 of TZMetadataColumnDef = (
04612 (Name: 'SEQUENCE_CAT'; SQLType: stString; Length: 255),
04613 (Name: 'SEQUENCE_SCHEM'; SQLType: stString; Length: 255),
04614 (Name: 'SEQUENCE_NAME'; SQLType: stString; Length: 255)
04615 );
04616
04617 UDTColumnCount = 6;
04618 UDTColumns: array[1..UDTColumnCount]
04619 of TZMetadataColumnDef =(
04620 (Name: 'TYPE_CAT'; SQLType: stString; Length: 255),
04621 (Name: 'TYPE_SCHEM'; SQLType: stString; Length: 255),
04622 (Name: 'TYPE_NAME'; SQLType: stString; Length: 255),
04623 (Name: 'CLASS_NAME'; SQLType: stString; Length: 255),
04624 (Name: 'DATA_TYPE'; SQLType: stShort; Length: 0),
04625 (Name: 'REMARKS'; SQLType: stString; Length: 255)
04626 );
04627
04628 var
04629 I: Integer;
04630
04631 initialization
04632 SetLength(ProceduresColumnsDynArray, ProceduresColumnCount);
04633 for I := 1 to ProceduresColumnCount do
04634 ProceduresColumnsDynArray[I - 1] := ProceduresColumns[I];
04635
04636 SetLength(ProceduresColColumnsDynArray, ProceduresColColumnCount);
04637 for I := 1 to ProceduresColColumnCount do
04638 ProceduresColColumnsDynArray[I - 1] := ProceduresColColumns[I];
04639
04640 SetLength(TableColumnsDynArray, TableColumnCount);
04641 for I := 1 to TableColumnCount do
04642 TableColumnsDynArray[I - 1] := TableColumns[I];
04643
04644 SetLength(SchemaColumnsDynArray, SchemaColumnCount);
04645 for I := 1 to SchemaColumnCount do
04646 SchemaColumnsDynArray[I - 1] := SchemaColumns[I];
04647
04648 SetLength(CatalogColumnsDynArray, CatalogColumnCount);
04649 for I := 1 to CatalogColumnCount do
04650 CatalogColumnsDynArray[I - 1] := CatalogColumns[I];
04651
04652 SetLength(TableTypeColumnsDynArray, TableTypeColumnCount);
04653 for I := 1 to TableTypeColumnCount do
04654 TableTypeColumnsDynArray[I - 1] := TableTypeColumns[I];
04655
04656 SetLength(TableColColumnsDynArray, TableColColumnCount);
04657 for I := 1 to TableColColumnCount do
04658 TableColColumnsDynArray[I - 1] := TableColColumns[I];
04659
04660 SetLength(TableColPrivColumnsDynArray, TableColPrivColumnCount);
04661 for I := 1 to TableColPrivColumnCount do
04662 TableColPrivColumnsDynArray[I - 1] := TableColPrivColumns[I];
04663
04664 SetLength(TablePrivColumnsDynArray, TablePrivColumnCount);
04665 for I := 1 to TablePrivColumnCount do
04666 TablePrivColumnsDynArray[I - 1] := TablePrivColumns[I];
04667
04668 SetLength(BestRowIdentColumnsDynArray, BestRowIdentColumnCount);
04669 for I := 1 to BestRowIdentColumnCount do
04670 BestRowIdentColumnsDynArray[I - 1] := BestRowIdentColumns[I];
04671
04672 SetLength(TableColVerColumnsDynArray, TableColVerColumnCount);
04673 for I := 1 to TableColVerColumnCount do
04674 TableColVerColumnsDynArray[I - 1] := TableColVerColumns[I];
04675
04676 SetLength(PrimaryKeyColumnsDynArray, PrimaryKeyColumnCount);
04677 for I := 1 to PrimaryKeyColumnCount do
04678 PrimaryKeyColumnsDynArray[I - 1] := PrimaryKeyColumns[I];
04679
04680 SetLength(ImportedKeyColumnsDynArray, ImportedKeyColumnCount);
04681 for I := 1 to ImportedKeyColumnCount do
04682 ImportedKeyColumnsDynArray[I - 1] := ImportedKeyColumns[I];
04683
04684 SetLength(ExportedKeyColumnsDynArray, ExportedKeyColumnCount);
04685 for I := 1 to ExportedKeyColumnCount do
04686 ExportedKeyColumnsDynArray[I - 1] := ExportedKeyColumns[I];
04687
04688 SetLength(CrossRefColumnsDynArray, CrossRefColumnCount);
04689 for I := 1 to CrossRefColumnCount do
04690 CrossRefColumnsDynArray[I - 1] := CrossRefColumns[I];
04691
04692 SetLength(TypeInfoColumnsDynArray, TypeInfoColumnCount);
04693 for I := 1 to TypeInfoColumnCount do
04694 TypeInfoColumnsDynArray[I - 1] := TypeInfoColumns[I];
04695
04696 SetLength(IndexInfoColumnsDynArray, IndexInfoColumnCount);
04697 for I := 1 to IndexInfoColumnCount do
04698 IndexInfoColumnsDynArray[I - 1] := IndexInfoColumns[I];
04699
04700 SetLength(SequenceColumnsDynArray, SequenceColumnCount);
04701 for I := 1 to SequenceColumnCount do
04702 SequenceColumnsDynArray[I - 1] := SequenceColumns[I];
04703
04704 SetLength(UDTColumnsDynArray, UDTColumnCount);
04705 for I := 1 to UDTColumnCount do
04706 UDTColumnsDynArray[I - 1] := UDTColumns[I];
04707 end.