LibreOffice Module connectivity (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
connectivity::OSQLParseNode Class Reference

#include <sqlnode.hxx>

Inheritance diagram for connectivity::OSQLParseNode:
[legend]
Collaboration diagram for connectivity::OSQLParseNode:
[legend]

Public Types

enum  Rule {
  UNKNOWN_RULE = 0 ,
  select_statement ,
  table_exp ,
  table_ref_commalist ,
  table_ref ,
  catalog_name ,
  schema_name ,
  table_name ,
  opt_column_commalist ,
  column_commalist ,
  column_ref_commalist ,
  column_ref ,
  opt_order_by_clause ,
  ordering_spec_commalist ,
  ordering_spec ,
  opt_asc_desc ,
  where_clause ,
  opt_where_clause ,
  search_condition ,
  comparison ,
  comparison_predicate ,
  between_predicate ,
  like_predicate ,
  opt_escape ,
  test_for_null ,
  scalar_exp_commalist ,
  scalar_exp ,
  parameter_ref ,
  parameter ,
  general_set_fct ,
  range_variable ,
  column ,
  delete_statement_positioned ,
  delete_statement_searched ,
  update_statement_positioned ,
  update_statement_searched ,
  assignment_commalist ,
  assignment ,
  values_or_query_spec ,
  insert_statement ,
  insert_atom_commalist ,
  insert_atom ,
  from_clause ,
  qualified_join ,
  cross_union ,
  select_sublist ,
  derived_column ,
  column_val ,
  set_fct_spec ,
  boolean_term ,
  boolean_primary ,
  num_value_exp ,
  join_type ,
  position_exp ,
  extract_exp ,
  length_exp ,
  char_value_fct ,
  odbc_call_spec ,
  in_predicate ,
  existence_test ,
  unique_test ,
  all_or_any_predicate ,
  named_columns_join ,
  join_condition ,
  joined_table ,
  boolean_factor ,
  sql_not ,
  manipulative_statement ,
  subquery ,
  value_exp_commalist ,
  odbc_fct_spec ,
  union_statement ,
  outer_join_type ,
  char_value_exp ,
  term ,
  value_exp_primary ,
  value_exp ,
  selection ,
  fold ,
  char_substring_fct ,
  factor ,
  base_table_def ,
  base_table_element_commalist ,
  data_type ,
  column_def ,
  table_node ,
  as_clause ,
  opt_as ,
  op_column_commalist ,
  table_primary_as_range_column ,
  datetime_primary ,
  concatenation ,
  char_factor ,
  bit_value_fct ,
  comparison_predicate_part_2 ,
  parenthesized_boolean_value_expression ,
  character_string_type ,
  other_like_predicate_part_2 ,
  between_predicate_part_2 ,
  null_predicate_part_2 ,
  cast_spec ,
  window_function ,
  rule_count
}
 

Public Member Functions

 OSQLParseNode (const char *_pValueStr, SQLNodeType _eNodeType, sal_uInt32 _nNodeID=0)
 
 OSQLParseNode (std::string_view _rValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID=0)
 
 OSQLParseNode (OUString _sValue, SQLNodeType _eNodeType, sal_uInt32 _nNodeID=0)
 
 OSQLParseNode (const OSQLParseNode &rParseNode)
 
OSQLParseNodeoperator= (const OSQLParseNode &rParseNode)
 
bool operator== (OSQLParseNode const &rParseNode) const
 
virtual ~OSQLParseNode ()
 
OSQLParseNodegetParent () const
 
void setParent (OSQLParseNode *pParseNode)
 
size_t count () const
 
OSQLParseNodegetChild (sal_uInt32 nPos) const
 
void append (OSQLParseNode *pNewSubTree)
 
void insert (sal_uInt32 nPos, OSQLParseNode *pNewSubTree)
 
void replaceAndDelete (OSQLParseNode *pOldSubTree, OSQLParseNode *pNewSubTree)
 
OSQLParseNoderemoveAt (sal_uInt32 nPos)
 
void replaceNodeValue (const OUString &rTableAlias, const OUString &rColumnName)
 
bool parseNodeToExecutableStatement (OUString &_out_rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, OSQLParser &_rParser, css::sdbc::SQLException *_pErrorHolder) const
 parses the node to a string which can be passed to a driver's connection for execution More...
 
void parseNodeToStr (OUString &rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const IParseContext *pContext=nullptr, bool _bIntl=false, bool _bQuote=true) const
 
void parseNodeToPredicateStr (OUString &rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::util::XNumberFormatter > &xFormatter, const css::lang::Locale &rIntl, OUString _sDec, const IParseContext *pContext=nullptr) const
 
void parseNodeToPredicateStr (OUString &rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::util::XNumberFormatter > &xFormatter, const css::uno::Reference< css::beans::XPropertySet > &_xField, const OUString &_sTableAlias, const css::lang::Locale &rIntl, OUString strDec, const IParseContext *pContext=nullptr) const
 
OSQLParseNodegetByRule (OSQLParseNode::Rule eRule) const
 
void showParseTree (OUString &rString) const
 
void showParseTree (OUStringBuffer &_inout_rBuf, sal_uInt32 nLevel) const
 
SQLNodeType getNodeType () const
 
sal_uInt32 getRuleID () const
 
Rule getKnownRuleID () const
 returns the ID of the rule represented by the node If the node does not represent a rule, UNKNOWN_RULE is returned More...
 
sal_uInt32 getTokenID () const
 
bool isRule () const
 
bool isToken () const
 
const OUString & getTokenValue () const
 
bool isLeaf () const
 

Static Public Member Functions

static void negateSearchCondition (OSQLParseNode *&pSearchCondition, bool bNegate=false)
 
static void disjunctiveNormalForm (OSQLParseNode *&pSearchCondition)
 
static void absorptions (OSQLParseNode *&pSearchCondition)
 
static void eraseBraces (OSQLParseNode *&pSearchCondition)
 
static void compress (OSQLParseNode *&pSearchCondition)
 
static bool getTableComponents (const OSQLParseNode *_pTableNode, css::uno::Any &_rCatalog, OUString &_rSchema, OUString &_rTable, const css::uno::Reference< css::sdbc::XDatabaseMetaData > &_xMetaData)
 
static void substituteParameterNames (OSQLParseNode const *_pNode)
 
static OUString getTableRange (const OSQLParseNode *_pTableRef)
 return a table range when it exists. More...
 

Protected Member Functions

void parseNodeToStr (OUString &rString, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::util::XNumberFormatter > &xFormatter, const css::uno::Reference< css::beans::XPropertySet > &_xField, const OUString &_sPredicateTableAlias, const css::lang::Locale &rIntl, const IParseContext *pContext, bool _bIntl, bool _bQuote, OUString _sDecSep, bool _bPredicate) const
 

Private Member Functions

void impl_parseNodeToString_throw (OUStringBuffer &rString, const SQLParseNodeParameter &rParam, bool bSimple=true) const
 
void impl_parseLikeNodeToString_throw (OUStringBuffer &rString, const SQLParseNodeParameter &rParam, bool bSimple=true) const
 
void impl_parseTableRangeNodeToString_throw (OUStringBuffer &rString, const SQLParseNodeParameter &rParam) const
 
bool impl_parseTableNameNodeToString_throw (OUStringBuffer &rString, const SQLParseNodeParameter &rParam) const
 parses a table_name node into a SQL statement particle. More...
 
bool addDateValue (OUStringBuffer &rString, const SQLParseNodeParameter &rParam) const
 
void parseLeaf (OUStringBuffer &rString, const SQLParseNodeParameter &rParam) const
 

Static Private Member Functions

static OUString convertDateTimeString (const SQLParseNodeParameter &rParam, const OUString &rString)
 
static OUString convertDateString (const SQLParseNodeParameter &rParam, std::u16string_view rString)
 
static OUString convertTimeString (const SQLParseNodeParameter &rParam, std::u16string_view rString)
 

Private Attributes

std::vector< std::unique_ptr< OSQLParseNode > > m_aChildren
 
OSQLParseNodem_pParent
 
OUString m_aNodeValue
 
SQLNodeType m_eNodeType
 
sal_uInt32 m_nNodeID
 

Friends

class OSQLParser
 

Detailed Description

Definition at line 103 of file sqlnode.hxx.

Member Enumeration Documentation

◆ Rule

Enumerator
UNKNOWN_RULE 
select_statement 
table_exp 
table_ref_commalist 
table_ref 
catalog_name 
schema_name 
table_name 
opt_column_commalist 
column_commalist 
column_ref_commalist 
column_ref 
opt_order_by_clause 
ordering_spec_commalist 
ordering_spec 
opt_asc_desc 
where_clause 
opt_where_clause 
search_condition 
comparison 
comparison_predicate 
between_predicate 
like_predicate 
opt_escape 
test_for_null 
scalar_exp_commalist 
scalar_exp 
parameter_ref 
parameter 
general_set_fct 
range_variable 
column 
delete_statement_positioned 
delete_statement_searched 
update_statement_positioned 
update_statement_searched 
assignment_commalist 
assignment 
values_or_query_spec 
insert_statement 
insert_atom_commalist 
insert_atom 
from_clause 
qualified_join 
cross_union 
select_sublist 
derived_column 
column_val 
set_fct_spec 
boolean_term 
boolean_primary 
num_value_exp 
join_type 
position_exp 
extract_exp 
length_exp 
char_value_fct 
odbc_call_spec 
in_predicate 
existence_test 
unique_test 
all_or_any_predicate 
named_columns_join 
join_condition 
joined_table 
boolean_factor 
sql_not 
manipulative_statement 
subquery 
value_exp_commalist 
odbc_fct_spec 
union_statement 
outer_join_type 
char_value_exp 
term 
value_exp_primary 
value_exp 
selection 
fold 
char_substring_fct 
factor 
base_table_def 
base_table_element_commalist 
data_type 
column_def 
table_node 
as_clause 
opt_as 
op_column_commalist 
table_primary_as_range_column 
datetime_primary 
concatenation 
char_factor 
bit_value_fct 
comparison_predicate_part_2 
parenthesized_boolean_value_expression 
character_string_type 
other_like_predicate_part_2 
between_predicate_part_2 
null_predicate_part_2 
cast_spec 
window_function 
rule_count 

Definition at line 120 of file sqlnode.hxx.

Constructor & Destructor Documentation

◆ OSQLParseNode() [1/4]

connectivity::OSQLParseNode::OSQLParseNode ( const char *  _pValueStr,
SQLNodeType  _eNodeType,
sal_uInt32  _nNodeID = 0 
)

◆ OSQLParseNode() [2/4]

connectivity::OSQLParseNode::OSQLParseNode ( std::string_view  _rValue,
SQLNodeType  eNewNodeType,
sal_uInt32  nNewNodeID = 0 
)

Definition at line 1591 of file sqlnode.cxx.

References connectivity::Concat, m_eNodeType, and connectivity::Rule.

◆ OSQLParseNode() [3/4]

connectivity::OSQLParseNode::OSQLParseNode ( OUString  _sValue,
SQLNodeType  _eNodeType,
sal_uInt32  _nNodeID = 0 
)

Definition at line 1602 of file sqlnode.cxx.

References connectivity::Concat, m_eNodeType, and connectivity::Rule.

◆ OSQLParseNode() [4/4]

connectivity::OSQLParseNode::OSQLParseNode ( const OSQLParseNode rParseNode)

Definition at line 1613 of file sqlnode.cxx.

References append(), m_aChildren, m_aNodeValue, m_eNodeType, m_nNodeID, m_pParent, and OSQLParseNode().

◆ ~OSQLParseNode()

connectivity::OSQLParseNode::~OSQLParseNode ( )
virtual

Definition at line 1672 of file sqlnode.cxx.

Member Function Documentation

◆ absorptions()

void connectivity::OSQLParseNode::absorptions ( OSQLParseNode *&  pSearchCondition)
static

◆ addDateValue()

bool connectivity::OSQLParseNode::addDateValue ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam 
) const
private

◆ append()

void connectivity::OSQLParseNode::append ( OSQLParseNode pNewSubTree)

◆ compress()

void connectivity::OSQLParseNode::compress ( OSQLParseNode *&  pSearchCondition)
static

◆ convertDateString()

OUString connectivity::OSQLParseNode::convertDateString ( const SQLParseNodeParameter rParam,
std::u16string_view  rString 
)
staticprivate

◆ convertDateTimeString()

OUString connectivity::OSQLParseNode::convertDateTimeString ( const SQLParseNodeParameter rParam,
const OUString &  rString 
)
staticprivate

◆ convertTimeString()

OUString connectivity::OSQLParseNode::convertTimeString ( const SQLParseNodeParameter rParam,
std::u16string_view  rString 
)
staticprivate

◆ count()

size_t connectivity::OSQLParseNode::count ( ) const
inline

Definition at line 255 of file sqlnode.hxx.

Referenced by connectivity::file::OPreparedStatement::AddParameter(), connectivity::macab::MacabCommonStatement::analyseOrderByClause(), connectivity::macab::MacabCommonStatement::analyseWhereClause(), connectivity::file::OStatement_Base::analyzeSQL(), compress(), disjunctiveNormalForm(), eraseBraces(), connectivity::file::OPredicateCompiler::execute(), connectivity::file::OPredicateCompiler::execute_BETWEEN(), connectivity::file::OPredicateCompiler::execute_COMPARE(), connectivity::file::OPredicateCompiler::execute_Fold(), connectivity::file::OPredicateCompiler::execute_ISNULL(), connectivity::file::OPredicateCompiler::execute_LIKE(), connectivity::file::OPredicateCompiler::execute_Operand(), connectivity::file::OPredicateCompiler::executeFunction(), connectivity::file::OStatement_Base::GetAssignValues(), connectivity::OSQLParseTreeIterator::getColumnAlias(), connectivity::OSQLParseTreeIterator::getGroupByTree(), connectivity::OSQLParseTreeIterator::getHavingTree(), connectivity::OSQLParseTreeIterator::getOrderTree(), connectivity::OSQLParseTreeIterator::getQualified_join(), connectivity::OSQLParseTreeIterator::getSelect_statement(), connectivity::OSQLParseTreeIterator::getTableNode(), getTableRange(), connectivity::OSQLParseTreeIterator::getWhereTree(), connectivity::OSQLParseTreeIterator::impl_fillJoinConditions(), connectivity::evoab::OCommonStatement::impl_getColumnRefColumnName_throw(), impl_parseLikeNodeToString_throw(), impl_parseNodeToString_throw(), impl_parseTableRangeNodeToString_throw(), negateSearchCondition(), operator==(), connectivity::evoab::OCommonStatement::orderByAnalysis(), connectivity::file::OResultSet::OResultSet(), parseNodeToExecutableStatement(), replaceNodeValue(), connectivity::ado::OPreparedStatement::replaceParameterNodeName(), connectivity::file::OPreparedStatement::scanParameter(), connectivity::file::OStatement_Base::setOrderbyColumn(), connectivity::OSQLParseTreeIterator::setParseTree(), connectivity::file::OPredicateCompiler::start(), connectivity::file::OSQLAnalyzer::start(), substituteParameterNames(), connectivity::OSQLParseTreeIterator::traverseByColumnNames(), connectivity::OSQLParseTreeIterator::traverseCreateColumns(), connectivity::OSQLParseTreeIterator::traverseParameter(), connectivity::OSQLParseTreeIterator::traverseParameters(), connectivity::OSQLParseTreeIterator::traverseSearchCondition(), connectivity::OSQLParseTreeIterator::traverseSelectColumnNames(), connectivity::OSQLParseTreeIterator::traverseSelectionCriteria(), and connectivity::evoab::OCommonStatement::whereAnalysis().

◆ disjunctiveNormalForm()

void connectivity::OSQLParseNode::disjunctiveNormalForm ( OSQLParseNode *&  pSearchCondition)
static

◆ eraseBraces()

void connectivity::OSQLParseNode::eraseBraces ( OSQLParseNode *&  pSearchCondition)
static

◆ getByRule()

OSQLParseNode * connectivity::OSQLParseNode::getByRule ( OSQLParseNode::Rule  eRule) const

◆ getChild()

OSQLParseNode * connectivity::OSQLParseNode::getChild ( sal_uInt32  nPos) const
inline

Definition at line 433 of file sqlnode.hxx.

References m_aChildren, and nPos.

Referenced by absorptions(), connectivity::macab::MacabCommonStatement::analyseOrderByClause(), connectivity::macab::MacabCommonStatement::analyseWhereClause(), connectivity::file::OStatement_Base::analyzeSQL(), compress(), disjunctiveNormalForm(), eraseBraces(), connectivity::file::OPredicateCompiler::execute(), connectivity::file::OPredicateCompiler::execute_BETWEEN(), connectivity::file::OPredicateCompiler::execute_COMPARE(), connectivity::file::OPredicateCompiler::execute_Fold(), connectivity::file::OPredicateCompiler::execute_ISNULL(), connectivity::file::OPredicateCompiler::execute_LIKE(), connectivity::file::OPredicateCompiler::execute_Operand(), connectivity::file::OPredicateCompiler::executeFunction(), connectivity::file::OStatement_Base::GetAssignValues(), connectivity::OSQLParseTreeIterator::getColumnAlias(), connectivity::OSQLParseTreeIterator::getFunctionReturnType(), connectivity::OSQLParseTreeIterator::getGroupByTree(), connectivity::OSQLParseTreeIterator::getHavingTree(), connectivity::OSQLParseTreeIterator::getOrderTree(), connectivity::OSQLParseTreeIterator::getQualified_join(), connectivity::OSQLParseTreeIterator::getSelect_statement(), connectivity::OSQLParseTreeIterator::getSimpleGroupByTree(), connectivity::OSQLParseTreeIterator::getSimpleHavingTree(), connectivity::OSQLParseTreeIterator::getSimpleOrderTree(), connectivity::OSQLParseTreeIterator::getSimpleWhereTree(), getTableComponents(), connectivity::evoab::OCommonStatement::getTableName(), connectivity::OSQLParseTreeIterator::getTableNode(), getTableRange(), connectivity::OSQLParseTreeIterator::getWhereTree(), connectivity::OSQLParseTreeIterator::impl_fillJoinConditions(), connectivity::evoab::OCommonStatement::impl_getColumnRefColumnName_throw(), impl_parseLikeNodeToString_throw(), impl_parseTableNameNodeToString_throw(), connectivity::OSQLParseTreeIterator::impl_traverse(), dbtools::OPredicateInputController::implParseNode(), negateSearchCondition(), connectivity::file::OResultSet::OpenImpl(), operator==(), connectivity::evoab::OCommonStatement::orderByAnalysis(), connectivity::file::OResultSet::OResultSet(), parseNodeToExecutableStatement(), connectivity::evoab::OCommonStatement::parseSql(), replaceNodeValue(), connectivity::ado::OPreparedStatement::replaceParameterNodeName(), connectivity::file::OPreparedStatement::scanParameter(), connectivity::macab::MacabCommonStatement::selectRecords(), connectivity::file::OStatement_Base::setOrderbyColumn(), connectivity::OSQLParseTreeIterator::setParseTree(), connectivity::macab::MacabCommonStatement::sortRecords(), connectivity::file::OPredicateCompiler::start(), connectivity::file::OSQLAnalyzer::start(), substituteParameterNames(), connectivity::OSQLParseTreeIterator::traverseByColumnNames(), connectivity::OSQLParseTreeIterator::traverseCreateColumns(), connectivity::OSQLParseTreeIterator::traverseParameter(), connectivity::OSQLParseTreeIterator::traverseParameters(), connectivity::OSQLParseTreeIterator::traverseSearchCondition(), connectivity::OSQLParseTreeIterator::traverseSelectColumnNames(), connectivity::OSQLParseTreeIterator::traverseSelectionCriteria(), connectivity::OSQLParseTreeIterator::traverseTableNames(), and connectivity::evoab::OCommonStatement::whereAnalysis().

◆ getKnownRuleID()

OSQLParseNode::Rule connectivity::OSQLParseNode::getKnownRuleID ( ) const

returns the ID of the rule represented by the node If the node does not represent a rule, UNKNOWN_RULE is returned

Definition at line 2698 of file sqlnode.cxx.

References getRuleID(), isRule(), connectivity::OSQLParser::RuleIDToRule(), and UNKNOWN_RULE.

Referenced by getTableRange(), impl_parseNodeToString_throw(), impl_parseTableNameNodeToString_throw(), and connectivity::OSQLParseTreeIterator::traverseSelectColumnNames().

◆ getNodeType()

SQLNodeType connectivity::OSQLParseNode::getNodeType ( ) const
inline

◆ getParent()

OSQLParseNode * connectivity::OSQLParseNode::getParent ( ) const
inline

◆ getRuleID()

sal_uInt32 connectivity::OSQLParseNode::getRuleID ( ) const
inline

Definition at line 342 of file sqlnode.hxx.

Referenced by getByRule(), getKnownRuleID(), and showParseTree().

◆ getTableComponents()

bool connectivity::OSQLParseNode::getTableComponents ( const OSQLParseNode _pTableNode,
css::uno::Any &  _rCatalog,
OUString &  _rSchema,
OUString &  _rTable,
const css::uno::Reference< css::sdbc::XDatabaseMetaData > &  _xMetaData 
)
static

◆ getTableRange()

OUString connectivity::OSQLParseNode::getTableRange ( const OSQLParseNode _pTableRef)
static

◆ getTokenID()

sal_uInt32 connectivity::OSQLParseNode::getTokenID ( ) const
inline

◆ getTokenValue()

const OUString & connectivity::OSQLParseNode::getTokenValue ( ) const
inline

◆ impl_parseLikeNodeToString_throw()

void connectivity::OSQLParseNode::impl_parseLikeNodeToString_throw ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam,
bool  bSimple = true 
) const
private

◆ impl_parseNodeToString_throw()

void connectivity::OSQLParseNode::impl_parseNodeToString_throw ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam,
bool  bSimple = true 
) const
private

◆ impl_parseTableNameNodeToString_throw()

bool connectivity::OSQLParseNode::impl_parseTableNameNodeToString_throw ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam 
) const
private

◆ impl_parseTableRangeNodeToString_throw()

void connectivity::OSQLParseNode::impl_parseTableRangeNodeToString_throw ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam 
) const
private

Definition at line 714 of file sqlnode.cxx.

References count(), and m_aChildren.

Referenced by impl_parseNodeToString_throw().

◆ insert()

void connectivity::OSQLParseNode::insert ( sal_uInt32  nPos,
OSQLParseNode pNewSubTree 
)

Definition at line 2350 of file sqlnode.cxx.

References getParent(), m_aChildren, nPos, and setParent().

◆ isLeaf()

bool connectivity::OSQLParseNode::isLeaf ( ) const
inline

◆ isRule()

bool connectivity::OSQLParseNode::isRule ( ) const
inline

◆ isToken()

bool connectivity::OSQLParseNode::isToken ( ) const
inline

◆ negateSearchCondition()

void connectivity::OSQLParseNode::negateSearchCondition ( OSQLParseNode *&  pSearchCondition,
bool  bNegate = false 
)
static

◆ operator=()

OSQLParseNode & connectivity::OSQLParseNode::operator= ( const OSQLParseNode rParseNode)

Definition at line 1635 of file sqlnode.cxx.

References append(), m_aChildren, m_aNodeValue, m_eNodeType, m_nNodeID, and OSQLParseNode().

◆ operator==()

bool connectivity::OSQLParseNode::operator== ( OSQLParseNode const &  rParseNode) const

Definition at line 1653 of file sqlnode.cxx.

References count(), getChild(), i, m_aNodeValue, m_eNodeType, m_nNodeID, parameter, and SQL_ISRULE.

◆ parseLeaf()

void connectivity::OSQLParseNode::parseLeaf ( OUStringBuffer &  rString,
const SQLParseNodeParameter rParam 
) const
private

◆ parseNodeToExecutableStatement()

bool connectivity::OSQLParseNode::parseNodeToExecutableStatement ( OUString &  _out_rString,
const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection,
OSQLParser _rParser,
css::sdbc::SQLException *  _pErrorHolder 
) const

parses the node to a string which can be passed to a driver's connection for execution

Any particles of the parse tree which represent application-level features - such as queries appearing in the FROM part - are substituted, so that the resulting statement can be executed at an SDBC-level connection.

Parameters
_out_rStringis an output parameter taking the resulting SQL statement
_rxConnectionthe connection relative to which to parse. This must be an SDB-level connection (e.g. support the XQueriesSupplier interface) for the method to be able to do all necessary substitutions.
_rParserthe SQLParser used to create the node. This is needed in case we need to parse sub queries which are present in the SQL statement - those sub queries need to be parsed, too, to check whether they contain nested sub queries.
_pErrorHoldertakes the error which occurred while generating the statement, if any. Might be <NULL>, in this case the error is not reported back, and can only be recognized by examining the return value.
Returns
<TRUE> if and only if the parsing was successful.

Currently, there's only one condition how this method can fail: If it contains a nested query which causes a cycle. E.g., consider a statement SELECT * from "foo", where foo is a query defined as SELECT * FROM "bar", where bar is defined as SELECT * FROM "foo". This statement obviously cannot be parsed to an executable statement.

If this method returns <FALSE>, you're encouraged to check and handle the error in <arg>_pErrorHolder</arg>.

Definition at line 318 of file sqlnode.cxx.

References connectivity::SQLParseNodeParameter::aMetaData, count(), getChild(), connectivity::OParseContext::getDefaultLocale(), getTokenValue(), impl_parseNodeToString_throw(), connectivity::SQLParseNodeParameter::pParser, removeAt(), dbtools::DatabaseMetaData::supportsSubqueriesInFrom(), and connectivity::SQLParseNodeParameter::xQueries.

◆ parseNodeToPredicateStr() [1/2]

void connectivity::OSQLParseNode::parseNodeToPredicateStr ( OUString &  rString,
const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection,
const css::uno::Reference< css::util::XNumberFormatter > &  xFormatter,
const css::lang::Locale &  rIntl,
OUString  _sDec,
const IParseContext pContext = nullptr 
) const

◆ parseNodeToPredicateStr() [2/2]

void connectivity::OSQLParseNode::parseNodeToPredicateStr ( OUString &  rString,
const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection,
const css::uno::Reference< css::util::XNumberFormatter > &  xFormatter,
const css::uno::Reference< css::beans::XPropertySet > &  _xField,
const OUString &  _sTableAlias,
const css::lang::Locale &  rIntl,
OUString  strDec,
const IParseContext pContext = nullptr 
) const

◆ parseNodeToStr() [1/2]

void connectivity::OSQLParseNode::parseNodeToStr ( OUString &  rString,
const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection,
const css::uno::Reference< css::util::XNumberFormatter > &  xFormatter,
const css::uno::Reference< css::beans::XPropertySet > &  _xField,
const OUString &  _sPredicateTableAlias,
const css::lang::Locale &  rIntl,
const IParseContext pContext,
bool  _bIntl,
bool  _bQuote,
OUString  _sDecSep,
bool  _bPredicate 
) const
protected

◆ parseNodeToStr() [2/2]

void connectivity::OSQLParseNode::parseNodeToStr ( OUString &  rString,
const css::uno::Reference< css::sdbc::XConnection > &  _rxConnection,
const IParseContext pContext = nullptr,
bool  _bIntl = false,
bool  _bQuote = true 
) const

◆ removeAt()

OSQLParseNode * connectivity::OSQLParseNode::removeAt ( sal_uInt32  nPos)

◆ replaceAndDelete()

void connectivity::OSQLParseNode::replaceAndDelete ( OSQLParseNode pOldSubTree,
OSQLParseNode pNewSubTree 
)

◆ replaceNodeValue()

void connectivity::OSQLParseNode::replaceNodeValue ( const OUString &  rTableAlias,
const OUString &  rColumnName 
)

◆ setParent()

void connectivity::OSQLParseNode::setParent ( OSQLParseNode pParseNode)
inline

Definition at line 253 of file sqlnode.hxx.

Referenced by append(), insert(), and replaceAndDelete().

◆ showParseTree() [1/2]

void connectivity::OSQLParseNode::showParseTree ( OUString &  rString) const

Definition at line 2246 of file sqlnode.cxx.

References aBuf, and showParseTree().

Referenced by connectivity::evoab::OCommonStatement::parseSql(), and showParseTree().

◆ showParseTree() [2/2]

void connectivity::OSQLParseNode::showParseTree ( OUStringBuffer &  _inout_rBuf,
sal_uInt32  nLevel 
) const

◆ substituteParameterNames()

void connectivity::OSQLParseNode::substituteParameterNames ( OSQLParseNode const *  _pNode)
static

Friends And Related Function Documentation

◆ OSQLParser

friend class OSQLParser
friend

Definition at line 105 of file sqlnode.hxx.

Member Data Documentation

◆ m_aChildren

std::vector< std::unique_ptr<OSQLParseNode> > connectivity::OSQLParseNode::m_aChildren
private

◆ m_aNodeValue

OUString connectivity::OSQLParseNode::m_aNodeValue
private

◆ m_eNodeType

SQLNodeType connectivity::OSQLParseNode::m_eNodeType
private

◆ m_nNodeID

sal_uInt32 connectivity::OSQLParseNode::m_nNodeID
private

Definition at line 114 of file sqlnode.hxx.

Referenced by operator=(), operator==(), OSQLParseNode(), and parseLeaf().

◆ m_pParent

OSQLParseNode* connectivity::OSQLParseNode::m_pParent
private

Definition at line 109 of file sqlnode.hxx.

Referenced by OSQLParseNode().


The documentation for this class was generated from the following files: