[This is preliminary documentation and subject to change.]
Echoes the current command as a tree, including all post-processing operations added.
HRESULT GetCommandTree(
DBCOMMANDTREE ** ppRoot
);
The returned tree reflects exactly the command set by the last invocation of ICommandTree::SetCommandTree or ICommandText::SetCommandText, as modified by subsequent calls to IQuery::AddPostProcessing. If the command is stored as a tree, the returned tree is a copy of the one stored in the command object. If a tree node was passed in with text, it is also echoed as text. If the command is stored as text, the provider should return a "navigable" command tree representation of the text, which is not necessarily in optimized form. If the provider cannot create a fuller representation, the command tree can consist of a single text node. For example, if the tree can be represented as a DBOP_SQL_select node, and the provider supports that node, it must be returned in that format. However, if the tree cannot be represented as a DBOP_SQL_select node, but can be represented in a non-trivial command tree (that is, other than the DBOP_text_command), the provider must return it as that non-trivial tree; the provider may only return the tree as the trivial DBOP_text_command node if that is the only command node it supports; otherwise, it must return a valid, non-trivial navigable tree or return DB_E_CANTTRANSLATE if the text cannot be represented in such a tree. The provider should not do any unnecessary validation, such as binding, at this time, but if in the course of parsing it discovers non-fatal errors in building the tree it should put the error information in the tree and return DB_S_ERRORSINTREE.
This method does not reveal a provider's internal, optimized translation (which may be different from a DBCOMMANDTREE structure) of text to (non-text) tree operations.
The returned tree includes the markings set by the validation methods invoked so far (ICommandValidate::ValidateSyntax and ICommandValidate::ValidateCompletely).