Object Names (FireDAC)

From RAD Studio
Jump to: navigation, search

Go Up to Working with Metadata (FireDAC)


General

The following properties specify the database object names:

A name can be specified:

  • Without quotes, FireDAC normalizes the name;
  • Enclosed into quotes and FireDAC will use it as is.

For example on Firebird with SQL dialect 3:

DDL Will Work Will Fail
CREATE PROCEDURE Test FDStoredProc1.StoredProcName := 'test';

FDStoredProc1.StoredProcName := 'TeSt';

FDStoredProc1.StoredProcName := '"TEST"';

FDStoredProc1.StoredProcName := '"test"';
CREATE PROCEDURE "Test" FDStoredProc1.StoredProcName := '"Test"'; FDStoredProc1.StoredProcName := 'test';

FDStoredProc1.StoredProcName := 'TeSt';

FDStoredProc1.StoredProcName := 'Test';

FDStoredProc1.StoredProcName := '"TEST"';

CREATE PROCEDURE "Main Proc" FDStoredProc1.StoredProcName := '"Main Proc"'; FDStoredProc1.StoredProcName := 'main proc';

FDStoredProc1.StoredProcName := 'Main Proc';

Quoted object names

FireDAC fully supports quoted object names, including different DBMS quoted characters. To write a quoted name in a SQL in a DBMS independent fashion use the {id <name>} syntax. For example:

 SELECT * FROM {id Order Details}

To force TFDTable to quote field names set FormatOptions.QuoteIdentifiers to True.

Full object names

FireDAC supports full object names, which include the catalog and/or schema names.

When you use the design-time editors, like a TFDStoredProc.StoredProcName combo box, Query Builder, etc., they will return the full object name. To avoid catalog and/or schema names in the full object name, use the MetaDefCatalog and MetaDefSchema connection definition parameters. For example:

 [MSSQL_Demo]
 DriverID=MSSQL
 ...
 MetaDefCatalog=Northwind
 MetaDefSchema=dbo

When a short object name is specified to StoredProcName, TableName, etc, they will be expanded into the full object names, using the current catalog and/or schema names. To override or avoid usage of the current catalog and/or schema names, use the MetaCurCatalog and MetaCurSchema connection definition parameters. For example:

 [MSSQL_Demo]
 DriverID=MSSQL  
 ...
 MetaCurCatalog=*
 MetaCurSchema=*

See Also