AnyDAC
ContentsIndexHome
PreviousUpNext
Object Names

AnyDAC supports quoted object names and full object names. The chapter describes how to work with object names.

Group
Links
General

The following properties specify the database object names:

A name may be specified:

  • without quotes and AnyDAC will normalize name;
  • enclosed into quotes and AnyDAC will use it as is.

For example on Firebird with SQL dialect 3:

DDL 
Will work 
Will fail 
CREATE PROCEDURE Test 
ADStoredProc1.StoredProcName := 'test';
ADStoredProc1.StoredProcName := 'TeSt';
ADStoredProc1.StoredProcName := '"TEST"'; 
ADStoredProc1.StoredProcName := '"test"'; 
CREATE PROCEDURE "Test" 
ADStoredProc1.StoredProcName := '"Test"'; 
ADStoredProc1.StoredProcName := 'test';
ADStoredProc1.StoredProcName := 'TeSt';
ADStoredProc1.StoredProcName := 'Test';
ADStoredProc1.StoredProcName := '"TEST"'; 
CREATE PROCEDURE "Main Proc" 
ADStoredProc1.StoredProcName := '"Main Proc"'; 
ADStoredProc1.StoredProcName := 'main proc';
ADStoredProc1.StoredProcName := 'Main Proc'; 

 

Quoted object names

AnyDAC 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 TADTable to quote field names set FormatOptions.QuoteIdentifiers to True. 

 

Full object names

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

When you are using the design-time editors, like a TADStoredProc.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 current catalog and / or schema names, use the MetaCurCatalog and MetaCurSchema connection definition parameters. For example: 

 

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

 

Additionally, at design-time you may force AnyDAC to return object names without catalog and/or schema. For that in IDE menu item AnyDAC -> Preferences ... unmark "Use full object names".

What do you think about this topic? Send feedback!