3.2. What are the Syntax and Metadata providers for?
The QueryBuilder component has SyntaxProvider and MetadataProvider properties. They must be set to the instances of appropriate objects in order to work properly. This article describes the purpose of these objects.
Syntax Providers define the rules of SQL query parsing and generation for a specific database server. It also determines the queries to retrieve metadata from a specific database server using system tables. The component cannot work without a syntax provider. There are few generic syntax providers for different ANSI SQL standards that do not relate to any specific database server, thus they might be used with any database server that's compatible with the appropriate standard.
The AutoSyntaxProvider may be used if you don't know which database server the user will be connected to. This syntax provider will send a series of server specific queries to detect the underlying database server. After successful detection it will act as appropriate database server syntax provider; otherwise it will act as Universal syntax provider.
The UniversalSyntaxProvider is recommended to work with those database servers only for which Active Query Builder does not provide a special syntax provider. The Universal syntax provider supports only ANSI SQL/92 syntax and additionaly implements the way to retrieve metadata from all the supported database servers. It was originally made for the Free Edition of Active Query Builder which lacks support of specifiс database server SQL syntax extensions.
Metadata Providers are intended to link Active Query Builder to specific data access components. Their main task is to execute the metadata retrieval queries sent by the component. The Metadata provider does not create necessary database connectivity objects, but an instance of appropriate database connection object should be assigned to the Connection property of the a metadata provider.
The OLE DB, ODBC and some other metadata providers also can retrieve metadata information using the GetSchema or other methods of appropriate data access components. If Active Query Builder fails to load metadata using the server-specific queries, it tries to load this information by means of metadata provider.
The component can work without a metadata provider. In this case it will not be able to execute the metadata retrieval queries, thus this information must be loaded in some other ways and the QueryBuilder.OfflineMode property should be set to True to avoid run-time exceptions.