LibreOffice Module connectivity (master) 1
|
Parser for SQL92. More...
#include <sqlparse.hxx>
Public Member Functions | |
OSQLParser (css::uno::Reference< css::uno::XComponentContext > xContext, const IParseContext *_pContext=nullptr) | |
~OSQLParser () | |
std::unique_ptr< OSQLParseNode > | parseTree (OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false) |
std::unique_ptr< OSQLParseNode > | predicateTree (OUString &rErrorMessage, const OUString &rStatement, const css::uno::Reference< css::util::XNumberFormatter > &xFormatter, const css::uno::Reference< css::beans::XPropertySet > &xField, bool bUseRealName=true) |
const IParseContext & | getContext () const |
const SQLError & | getErrorHelper () const |
access to the SQLError instance owned by this parser More... | |
void | error (const char *fmt) |
Static Public Member Functions | |
static OString | TokenIDToStr (sal_uInt32 nTokenID, const IParseContext *pContext=nullptr) |
static OUString | RuleIDToStr (sal_uInt32 nRuleID) |
static sal_uInt32 | StrToRuleID (const OString &rValue) |
static OSQLParseNode::Rule | RuleIDToRule (sal_uInt32 _nRule) |
static sal_uInt32 | RuleID (OSQLParseNode::Rule eRule) |
static sal_Int32 | getFunctionReturnType (std::u16string_view _sFunctionName, const IParseContext *pContext) |
static sal_Int32 | getFunctionParameterType (sal_uInt32 _nTokenId, sal_uInt32 _nPos) |
static int | SQLlex () |
Private Types | |
typedef ::std::map< sal_uInt32, OSQLParseNode::Rule > | RuleIDMap |
Private Member Functions | |
OUString | stringToDouble (const OUString &_rValue, sal_Int16 _nScale) |
OSQLParseNode * | buildDate (sal_Int32 _nType, OSQLParseNode *&pLiteral) |
bool | extractDate (OSQLParseNode const *pLiteral, double &_rfValue) |
void | killThousandSeparator (OSQLParseNode *pLiteral) |
OSQLParseNode * | convertNode (sal_Int32 nType, OSQLParseNode *pLiteral) |
OSQLParseNode * | buildNode_STR_NUM (OSQLParseNode *&pLiteral) |
OSQLParseNode * | buildNode_Date (const double &fValue, sal_Int32 nType) |
Static Private Member Functions | |
static std::mutex & | getMutex () |
Private Attributes | |
const IParseContext * | m_pContext |
std::unique_ptr< OSQLParseNode > | m_pParseTree |
::std::unique_ptr< OSQLParser_Data > | m_pData |
OUString | m_sFieldName |
OUString | m_sErrorMessage |
css::uno::Reference< css::beans::XPropertySet > | m_xField |
css::uno::Reference< css::util::XNumberFormatter > | m_xFormatter |
sal_Int32 | m_nFormatKey |
sal_Int32 | m_nDateFormatKey |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
css::uno::Reference< css::i18n::XCharacterClassification > | m_xCharClass |
Static Private Attributes | |
static sal_uInt32 | s_nRuleIDs [OSQLParseNode::rule_count+1] |
static RuleIDMap | s_aReverseRuleIDLookup |
static OParseContext | s_aDefaultContext |
static OSQLScanner * | s_pScanner |
static OSQLParseNodesGarbageCollector * | s_pGarbageCollector |
static sal_Int32 | s_nRefCount |
static vcl::DeleteOnDeinit< css::uno::Reference< css::i18n::XLocaleData4 > > | s_xLocaleData |
Friends | |
class | OSQLParseNode |
class | OSQLInternalNode |
struct | SQLParseNodeParameter |
Parser for SQL92.
Definition at line 109 of file sqlparse.hxx.
|
private |
Definition at line 116 of file sqlparse.hxx.
connectivity::OSQLParser::OSQLParser | ( | css::uno::Reference< css::uno::XComponentContext > | xContext, |
const IParseContext * | _pContext = nullptr |
||
) |
Definition at line 1309 of file sqlnode.cxx.
References connectivity::OSQLParseNode::all_or_any_predicate, connectivity::OSQLParseNode::as_clause, connectivity::OSQLParseNode::assignment, connectivity::OSQLParseNode::assignment_commalist, connectivity::OSQLParseNode::base_table_def, connectivity::OSQLParseNode::base_table_element_commalist, connectivity::OSQLParseNode::between_predicate, connectivity::OSQLParseNode::between_predicate_part_2, connectivity::OSQLParseNode::bit_value_fct, connectivity::OSQLParseNode::boolean_factor, connectivity::OSQLParseNode::boolean_primary, connectivity::OSQLParseNode::boolean_term, connectivity::OSQLParseNode::cast_spec, connectivity::OSQLParseNode::catalog_name, connectivity::OSQLParseNode::char_factor, connectivity::OSQLParseNode::char_substring_fct, connectivity::OSQLParseNode::char_value_exp, connectivity::OSQLParseNode::char_value_fct, connectivity::OSQLParseNode::character_string_type, connectivity::OSQLParseNode::column, connectivity::OSQLParseNode::column_commalist, connectivity::OSQLParseNode::column_def, connectivity::OSQLParseNode::column_ref, connectivity::OSQLParseNode::column_ref_commalist, connectivity::OSQLParseNode::column_val, connectivity::OSQLParseNode::comparison, connectivity::OSQLParseNode::comparison_predicate, connectivity::OSQLParseNode::comparison_predicate_part_2, connectivity::OSQLParseNode::concatenation, connectivity::OSQLParseNode::cross_union, connectivity::OSQLParseNode::data_type, connectivity::OSQLParseNode::datetime_primary, connectivity::OSQLParseNode::delete_statement_positioned, connectivity::OSQLParseNode::delete_statement_searched, connectivity::OSQLParseNode::derived_column, connectivity::OSQLParseNode::existence_test, connectivity::OSQLParseNode::extract_exp, connectivity::OSQLParseNode::factor, connectivity::OSQLParseNode::fold, connectivity::OSQLParseNode::from_clause, connectivity::OSQLParseNode::general_set_fct, vcl::DeleteOnDeinit< typename T >::get(), getMutex(), connectivity::IParseContext::getPreferredLocale(), connectivity::OSQLParseNode::in_predicate, connectivity::OSQLParseNode::insert_atom, connectivity::OSQLParseNode::insert_atom_commalist, connectivity::OSQLParseNode::insert_statement, connectivity::OSQLParseNode::join_condition, connectivity::OSQLParseNode::join_type, connectivity::OSQLParseNode::joined_table, connectivity::OSQLParseNode::length_exp, connectivity::OSQLParseNode::like_predicate, m_pContext, m_pData, m_pData, m_xContext, m_xContext, connectivity::OSQLParseNode::manipulative_statement, connectivity::OSQLParseNode::named_columns_join, connectivity::OSQLParseNode::null_predicate_part_2, connectivity::OSQLParseNode::num_value_exp, connectivity::OSQLParseNode::odbc_call_spec, connectivity::OSQLParseNode::odbc_fct_spec, connectivity::OSQLParseNode::op_column_commalist, connectivity::OSQLParseNode::opt_as, connectivity::OSQLParseNode::opt_asc_desc, connectivity::OSQLParseNode::opt_column_commalist, connectivity::OSQLParseNode::opt_escape, connectivity::OSQLParseNode::opt_order_by_clause, connectivity::OSQLParseNode::opt_where_clause, connectivity::OSQLParseNode::ordering_spec, connectivity::OSQLParseNode::ordering_spec_commalist, connectivity::OSQLParseNode::other_like_predicate_part_2, connectivity::OSQLParseNode::outer_join_type, connectivity::OSQLParseNode::parameter, connectivity::OSQLParseNode::parameter_ref, connectivity::OSQLParseNode::parenthesized_boolean_value_expression, connectivity::OSQLParseNode::position_exp, connectivity::OSQLParseNode::qualified_join, connectivity::OSQLParseNode::range_variable, connectivity::OSQLParseNode::rule_count, s_aDefaultContext, s_aReverseRuleIDLookup, s_nRefCount, s_nRuleIDs, s_pGarbageCollector, s_pScanner, s_xLocaleData, connectivity::OSQLParseNode::scalar_exp, connectivity::OSQLParseNode::scalar_exp_commalist, connectivity::OSQLParseNode::schema_name, connectivity::OSQLParseNode::search_condition, connectivity::OSQLParseNode::select_statement, connectivity::OSQLParseNode::select_sublist, connectivity::OSQLParseNode::selection, vcl::DeleteOnDeinit< typename T >::set(), connectivity::OSQLParseNode::set_fct_spec, setParser(), connectivity::OSQLScanner::setScanner(), connectivity::OSQLParseNode::sql_not, StrToRuleID(), connectivity::OSQLParseNode::subquery, connectivity::OSQLParseNode::table_exp, connectivity::OSQLParseNode::table_name, connectivity::OSQLParseNode::table_node, connectivity::OSQLParseNode::table_primary_as_range_column, connectivity::OSQLParseNode::table_ref, connectivity::OSQLParseNode::table_ref_commalist, connectivity::OSQLParseNode::term, connectivity::OSQLParseNode::test_for_null, connectivity::OSQLParseNode::union_statement, connectivity::OSQLParseNode::unique_test, connectivity::OSQLParseNode::UNKNOWN_RULE, connectivity::OSQLParseNode::update_statement_positioned, connectivity::OSQLParseNode::update_statement_searched, connectivity::OSQLParseNode::value_exp, connectivity::OSQLParseNode::value_exp_commalist, connectivity::OSQLParseNode::value_exp_primary, connectivity::OSQLParseNode::values_or_query_spec, connectivity::OSQLParseNode::where_clause, and connectivity::OSQLParseNode::window_function.
connectivity::OSQLParser::~OSQLParser | ( | ) |
Definition at line 1474 of file sqlnode.cxx.
References getMutex(), m_pParseTree, s_aReverseRuleIDLookup, s_nRefCount, s_pGarbageCollector, s_pScanner, and connectivity::OSQLScanner::setScanner().
|
private |
Definition at line 1561 of file sqlnode.cxx.
References buildNode_Date(), extractDate(), connectivity::IParseContext::getErrorMessage(), connectivity::IParseContext::InvalidDateCompare, m_pContext, and m_sErrorMessage.
Referenced by convertNode().
|
private |
Definition at line 1040 of file sqlnode.cxx.
References connectivity::OSQLParseNode::append(), dbtools::DBTypeConversion::getNULLDate(), connectivity::Keyword, m_xFormatter, nType, connectivity::OSQLParseNode::odbc_fct_spec, OSQLInternalNode, connectivity::Punctuation, connectivity::Rule, RuleID(), connectivity::OSQLParseNode::set_fct_spec, connectivity::String, dbtools::DBTypeConversion::toDate(), dbtools::DBTypeConversion::toDateString(), dbtools::DBTypeConversion::toDateTime(), dbtools::DBTypeConversion::toDateTimeString(), dbtools::DBTypeConversion::toTime(), and dbtools::DBTypeConversion::toTimeString().
Referenced by buildDate().
|
private |
Definition at line 1088 of file sqlnode.cxx.
References Any, Exception, getNumberFormatProperty(), connectivity::OSQLParseNode::getTokenValue(), m_nFormatKey, m_xFormatter, OSQLInternalNode, connectivity::String, and stringToDouble().
Referenced by convertNode().
|
private |
Definition at line 817 of file sqlnode.cxx.
References connectivity::AccessDate, connectivity::ApproxNum, buildDate(), buildNode_STR_NUM(), FALSE, connectivity::IParseContext::getErrorMessage(), connectivity::OSQLParseNode::getNodeType(), connectivity::IntNum, connectivity::IParseContext::InvalidCompare, connectivity::IParseContext::InvalidDateCompare, connectivity::IParseContext::InvalidIntCompare, connectivity::IParseContext::InvalidRealCompare, connectivity::OSQLParseNode::isRule(), killThousandSeparator(), m_pContext, m_sErrorMessage, m_xFormatter, nType, SQL_ISRULE, SQL_ISTOKEN, connectivity::String, and TRUE.
void connectivity::OSQLParser::error | ( | const char * | fmt | ) |
|
private |
Definition at line 1512 of file sqlnode.cxx.
References Exception, dbtools::getDefaultNumberFormat(), connectivity::OSQLParseNode::getTokenValue(), m_nDateFormatKey, m_nFormatKey, m_pData, m_xField, and m_xFormatter.
Referenced by buildDate().
|
inline |
Definition at line 176 of file sqlparse.hxx.
Referenced by connectivity::OSQLParseTreeIterator::getFunctionReturnType(), dbtools::OPredicateInputController::getPredicateValueStr(), dbtools::OPredicateInputController::implParseNode(), dbtools::OPredicateInputController::implPredicateTree(), and dbtools::OPredicateInputController::normalizePredicateString().
const SQLError & connectivity::OSQLParser::getErrorHelper | ( | ) | const |
access to the SQLError instance owned by this parser
Definition at line 2692 of file sqlnode.cxx.
References m_pData.
Referenced by connectivity::OSQLParseTreeIterator::impl_locateRecordSource(), and connectivity::OSQLParseNode::impl_parseTableNameNodeToString_throw().
|
static |
Definition at line 2584 of file sqlnode.cxx.
Referenced by connectivity::OSQLParseTreeIterator::traverseParameter().
|
static |
Definition at line 2494 of file sqlnode.cxx.
References nType, pq_sdbc_driver::OUStringToOString(), and TokenIDToStr().
Referenced by connectivity::OSQLParseTreeIterator::getFunctionReturnType(), and dbtools::OPredicateInputController::getPredicateValueStr().
|
staticprivate |
Definition at line 1145 of file sqlnode.cxx.
References aMutex.
Referenced by OSQLParser(), predicateTree(), and ~OSQLParser().
|
private |
Definition at line 802 of file sqlnode.cxx.
References vcl::DeleteOnDeinit< typename T >::get(), connectivity::OSQLParseNode::m_aNodeValue, m_pData, and s_xLocaleData.
Referenced by convertNode().
std::unique_ptr< OSQLParseNode > connectivity::OSQLParser::parseTree | ( | OUString & | rErrorMessage, |
const OUString & | rStatement, | ||
bool | bInternational = false |
||
) |
Referenced by connectivity::file::OStatement_Base::construct(), connectivity::macab::MacabCommonStatement::executeQuery(), connectivity::OSQLParseNode::impl_parseTableNameNodeToString_throw(), connectivity::ado::OPreparedStatement::OPreparedStatement(), connectivity::evoab::OCommonStatement::parseSql(), and connectivity::ParameterSubstitution::substituteVariables().
std::unique_ptr< OSQLParseNode > connectivity::OSQLParser::predicateTree | ( | OUString & | rErrorMessage, |
const OUString & | rStatement, | ||
const css::uno::Reference< css::util::XNumberFormatter > & | xFormatter, | ||
const css::uno::Reference< css::beans::XPropertySet > & | xField, | ||
bool | bUseRealName = true |
||
) |
Definition at line 1152 of file sqlnode.cxx.
References Any, Exception, connectivity::IParseContext::General, vcl::DeleteOnDeinit< typename T >::get(), connectivity::OSQLScanner::GetDATERule(), connectivity::OSQLScanner::GetENGRule(), connectivity::OSQLScanner::getErrorMessage(), connectivity::IParseContext::getErrorMessage(), connectivity::OSQLScanner::GetGERRule(), getMutex(), dbtools::OPropertyMap::getNameByIndex(), getNumberFormatProperty(), connectivity::IParseContext::getPreferredLocale(), connectivity::OMetaConnection::getPropMap(), connectivity::OSQLScanner::GetSQLRule(), connectivity::OSQLScanner::GetSTRINGRule(), m_nDateFormatKey, m_nFormatKey, m_pContext, m_pData, m_pParseTree, m_sErrorMessage, m_sFieldName, m_xField, m_xFormatter, nType, connectivity::OSQLScanner::prepareScan(), PROPERTY_ID_FORMATKEY, PROPERTY_ID_LOCALE, PROPERTY_ID_NAME, PROPERTY_ID_REALNAME, PROPERTY_ID_TYPE, s_pScanner, s_xLocaleData, SAL_WARN, setParser(), connectivity::OSQLScanner::SetRule(), and SQLyyparse().
|
static |
|
static |
Referenced by connectivity::OSQLParseNode::getKnownRuleID().
|
static |
Referenced by connectivity::OSQLParseNode::showParseTree().
|
static |
|
private |
Definition at line 1116 of file sqlnode.cxx.
References Exception, vcl::DeleteOnDeinit< typename T >::get(), m_pData, m_xCharClass, m_xContext, nPos, s_xLocaleData, and u.
Referenced by buildNode_STR_NUM().
|
static |
Referenced by OSQLParser().
|
static |
|
friend |
Definition at line 112 of file sqlparse.hxx.
Referenced by buildNode_Date(), and buildNode_STR_NUM().
|
friend |
Definition at line 111 of file sqlparse.hxx.
|
friend |
Definition at line 113 of file sqlparse.hxx.
|
private |
Definition at line 139 of file sqlparse.hxx.
Referenced by extractDate(), and predicateTree().
|
private |
Definition at line 138 of file sqlparse.hxx.
Referenced by buildNode_STR_NUM(), extractDate(), and predicateTree().
|
private |
Definition at line 127 of file sqlparse.hxx.
Referenced by buildDate(), convertNode(), OSQLParser(), and predicateTree().
|
private |
Definition at line 130 of file sqlparse.hxx.
Referenced by extractDate(), getErrorHelper(), killThousandSeparator(), OSQLParser(), predicateTree(), and stringToDouble().
|
private |
Definition at line 128 of file sqlparse.hxx.
Referenced by predicateTree(), and ~OSQLParser().
|
private |
Definition at line 132 of file sqlparse.hxx.
Referenced by buildDate(), convertNode(), and predicateTree().
|
private |
Definition at line 131 of file sqlparse.hxx.
Referenced by predicateTree().
|
private |
Definition at line 141 of file sqlparse.hxx.
Referenced by stringToDouble().
|
private |
Definition at line 140 of file sqlparse.hxx.
Referenced by OSQLParser(), and stringToDouble().
|
private |
Definition at line 135 of file sqlparse.hxx.
Referenced by extractDate(), and predicateTree().
|
private |
Definition at line 137 of file sqlparse.hxx.
Referenced by buildNode_Date(), buildNode_STR_NUM(), convertNode(), extractDate(), and predicateTree().
|
staticprivate |
Definition at line 120 of file sqlparse.hxx.
Referenced by OSQLParser().
|
staticprivate |
Definition at line 119 of file sqlparse.hxx.
Referenced by OSQLParser(), and ~OSQLParser().
|
staticprivate |
Definition at line 124 of file sqlparse.hxx.
Referenced by OSQLParser(), and ~OSQLParser().
|
staticprivate |
Definition at line 118 of file sqlparse.hxx.
Referenced by OSQLParser().
|
staticprivate |
Definition at line 123 of file sqlparse.hxx.
Referenced by connectivity::OSQLInternalNode::OSQLInternalNode(), OSQLParser(), connectivity::OSQLInternalNode::~OSQLInternalNode(), and ~OSQLParser().
|
staticprivate |
Definition at line 122 of file sqlparse.hxx.
Referenced by OSQLParser(), predicateTree(), and ~OSQLParser().
|
staticprivate |
Definition at line 142 of file sqlparse.hxx.
Referenced by killThousandSeparator(), OSQLParser(), predicateTree(), and stringToDouble().