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

Parser for SQL92. More...

#include <sqlparse.hxx>

Collaboration diagram for connectivity::OSQLParser:
[legend]

Public Member Functions

 OSQLParser (css::uno::Reference< css::uno::XComponentContext > xContext, const IParseContext *_pContext=nullptr)
 
 ~OSQLParser ()
 
std::unique_ptr< OSQLParseNodeparseTree (OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false)
 
std::unique_ptr< OSQLParseNodepredicateTree (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 IParseContextgetContext () const
 
const SQLErrorgetErrorHelper () 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::RuleRuleIDMap
 

Private Member Functions

OUString stringToDouble (const OUString &_rValue, sal_Int16 _nScale)
 
OSQLParseNodebuildDate (sal_Int32 _nType, OSQLParseNode *&pLiteral)
 
bool extractDate (OSQLParseNode const *pLiteral, double &_rfValue)
 
void killThousandSeparator (OSQLParseNode *pLiteral)
 
OSQLParseNodeconvertNode (sal_Int32 nType, OSQLParseNode *pLiteral)
 
OSQLParseNodebuildNode_STR_NUM (OSQLParseNode *&pLiteral)
 
OSQLParseNodebuildNode_Date (const double &fValue, sal_Int32 nType)
 

Static Private Member Functions

static std::mutexgetMutex ()
 

Private Attributes

const IParseContextm_pContext
 
std::unique_ptr< OSQLParseNodem_pParseTree
 
::std::unique_ptr< OSQLParser_Datam_pData
 
OUString m_sFieldName
 
OUString m_sErrorMessage
 
css::uno::Reference< css::beans::XPropertySetm_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 OSQLScanners_pScanner
 
static OSQLParseNodesGarbageCollectors_pGarbageCollector
 
static sal_Int32 s_nRefCount
 
static vcl::DeleteOnDeinit< css::uno::Reference< css::i18n::XLocaleData4 > > s_xLocaleData
 

Friends

class OSQLParseNode
 
class OSQLInternalNode
 
struct SQLParseNodeParameter
 

Detailed Description

Parser for SQL92.

Definition at line 109 of file sqlparse.hxx.

Member Typedef Documentation

◆ RuleIDMap

Definition at line 116 of file sqlparse.hxx.

Constructor & Destructor Documentation

◆ OSQLParser()

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.

◆ ~OSQLParser()

connectivity::OSQLParser::~OSQLParser ( )

Member Function Documentation

◆ buildDate()

OSQLParseNode * connectivity::OSQLParser::buildDate ( sal_Int32  _nType,
OSQLParseNode *&  pLiteral 
)
private

◆ buildNode_Date()

OSQLParseNode * connectivity::OSQLParser::buildNode_Date ( const double &  fValue,
sal_Int32  nType 
)
private

◆ buildNode_STR_NUM()

OSQLParseNode * connectivity::OSQLParser::buildNode_STR_NUM ( OSQLParseNode *&  pLiteral)
private

◆ convertNode()

OSQLParseNode * connectivity::OSQLParser::convertNode ( sal_Int32  nType,
OSQLParseNode pLiteral 
)
private

◆ error()

void connectivity::OSQLParser::error ( const char *  fmt)

◆ extractDate()

bool connectivity::OSQLParser::extractDate ( OSQLParseNode const *  pLiteral,
double &  _rfValue 
)
private

◆ getContext()

const IParseContext & connectivity::OSQLParser::getContext ( ) const
inline

◆ getErrorHelper()

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().

◆ getFunctionParameterType()

sal_Int32 connectivity::OSQLParser::getFunctionParameterType ( sal_uInt32  _nTokenId,
sal_uInt32  _nPos 
)
static

Definition at line 2584 of file sqlnode.cxx.

References _nPos, and nType.

Referenced by connectivity::OSQLParseTreeIterator::traverseParameter().

◆ getFunctionReturnType()

sal_Int32 connectivity::OSQLParser::getFunctionReturnType ( std::u16string_view  _sFunctionName,
const IParseContext pContext 
)
static

◆ getMutex()

std::mutex & connectivity::OSQLParser::getMutex ( )
staticprivate

Definition at line 1145 of file sqlnode.cxx.

References aMutex.

Referenced by OSQLParser(), predicateTree(), and ~OSQLParser().

◆ killThousandSeparator()

void connectivity::OSQLParser::killThousandSeparator ( OSQLParseNode pLiteral)
private

◆ parseTree()

std::unique_ptr< OSQLParseNode > connectivity::OSQLParser::parseTree ( OUString &  rErrorMessage,
const OUString &  rStatement,
bool  bInternational = false 
)

◆ predicateTree()

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 
)

◆ RuleID()

static sal_uInt32 connectivity::OSQLParser::RuleID ( OSQLParseNode::Rule  eRule)
static

◆ RuleIDToRule()

static OSQLParseNode::Rule connectivity::OSQLParser::RuleIDToRule ( sal_uInt32  _nRule)
static

◆ RuleIDToStr()

static OUString connectivity::OSQLParser::RuleIDToStr ( sal_uInt32  nRuleID)
static

◆ SQLlex()

static int connectivity::OSQLParser::SQLlex ( )
static

◆ stringToDouble()

OUString connectivity::OSQLParser::stringToDouble ( const OUString &  _rValue,
sal_Int16  _nScale 
)
private

◆ StrToRuleID()

static sal_uInt32 connectivity::OSQLParser::StrToRuleID ( const OString &  rValue)
static

Referenced by OSQLParser().

◆ TokenIDToStr()

static OString connectivity::OSQLParser::TokenIDToStr ( sal_uInt32  nTokenID,
const IParseContext pContext = nullptr 
)
static

Friends And Related Function Documentation

◆ OSQLInternalNode

friend class OSQLInternalNode
friend

Definition at line 112 of file sqlparse.hxx.

Referenced by buildNode_Date(), and buildNode_STR_NUM().

◆ OSQLParseNode

friend class OSQLParseNode
friend

Definition at line 111 of file sqlparse.hxx.

◆ SQLParseNodeParameter

friend struct SQLParseNodeParameter
friend

Definition at line 113 of file sqlparse.hxx.

Member Data Documentation

◆ m_nDateFormatKey

sal_Int32 connectivity::OSQLParser::m_nDateFormatKey
private

Definition at line 139 of file sqlparse.hxx.

Referenced by extractDate(), and predicateTree().

◆ m_nFormatKey

sal_Int32 connectivity::OSQLParser::m_nFormatKey
private

Definition at line 138 of file sqlparse.hxx.

Referenced by buildNode_STR_NUM(), extractDate(), and predicateTree().

◆ m_pContext

const IParseContext* connectivity::OSQLParser::m_pContext
private

Definition at line 127 of file sqlparse.hxx.

Referenced by buildDate(), convertNode(), OSQLParser(), and predicateTree().

◆ m_pData

::std::unique_ptr< OSQLParser_Data > connectivity::OSQLParser::m_pData
private

◆ m_pParseTree

std::unique_ptr<OSQLParseNode> connectivity::OSQLParser::m_pParseTree
private

Definition at line 128 of file sqlparse.hxx.

Referenced by predicateTree(), and ~OSQLParser().

◆ m_sErrorMessage

OUString connectivity::OSQLParser::m_sErrorMessage
private

Definition at line 132 of file sqlparse.hxx.

Referenced by buildDate(), convertNode(), and predicateTree().

◆ m_sFieldName

OUString connectivity::OSQLParser::m_sFieldName
private

Definition at line 131 of file sqlparse.hxx.

Referenced by predicateTree().

◆ m_xCharClass

css::uno::Reference< css::i18n::XCharacterClassification> connectivity::OSQLParser::m_xCharClass
private

Definition at line 141 of file sqlparse.hxx.

Referenced by stringToDouble().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > connectivity::OSQLParser::m_xContext
private

Definition at line 140 of file sqlparse.hxx.

Referenced by OSQLParser(), and stringToDouble().

◆ m_xField

css::uno::Reference< css::beans::XPropertySet > connectivity::OSQLParser::m_xField
private

Definition at line 135 of file sqlparse.hxx.

Referenced by extractDate(), and predicateTree().

◆ m_xFormatter

css::uno::Reference< css::util::XNumberFormatter > connectivity::OSQLParser::m_xFormatter
private

◆ s_aDefaultContext

OParseContext connectivity::OSQLParser::s_aDefaultContext
staticprivate

Definition at line 120 of file sqlparse.hxx.

Referenced by OSQLParser().

◆ s_aReverseRuleIDLookup

RuleIDMap connectivity::OSQLParser::s_aReverseRuleIDLookup
staticprivate

Definition at line 119 of file sqlparse.hxx.

Referenced by OSQLParser(), and ~OSQLParser().

◆ s_nRefCount

sal_Int32 connectivity::OSQLParser::s_nRefCount
staticprivate

Definition at line 124 of file sqlparse.hxx.

Referenced by OSQLParser(), and ~OSQLParser().

◆ s_nRuleIDs

sal_uInt32 connectivity::OSQLParser::s_nRuleIDs[OSQLParseNode::rule_count+1]
staticprivate

Definition at line 118 of file sqlparse.hxx.

Referenced by OSQLParser().

◆ s_pGarbageCollector

OSQLParseNodesGarbageCollector* connectivity::OSQLParser::s_pGarbageCollector
staticprivate

◆ s_pScanner

OSQLScanner* connectivity::OSQLParser::s_pScanner
staticprivate

Definition at line 122 of file sqlparse.hxx.

Referenced by OSQLParser(), predicateTree(), and ~OSQLParser().

◆ s_xLocaleData

vcl::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4> > connectivity::OSQLParser::s_xLocaleData
staticprivate

Definition at line 142 of file sqlparse.hxx.

Referenced by killThousandSeparator(), OSQLParser(), predicateTree(), and stringToDouble().


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