19#ifndef INCLUDED_CONNECTIVITY_SQLITERATOR_HXX
20#define INCLUDED_CONNECTIVITY_SQLITERATOR_HXX
24#include <com/sun/star/sdbc/DataType.hpp>
25#include <com/sun/star/sdbc/SQLException.hpp>
65 typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* >
TNodePair;
77 struct OSQLParseTreeIteratorImpl;
92 ::std::unique_ptr< OSQLParseTreeIteratorImpl >
m_pImpl;
94 void traverseParameter(
const OSQLParseNode* _pParseNode,
const OSQLParseNode* _pColumnRef,
const OUString& _aColumnName, OUString& _aTableRange,
const OUString& _rColumnAlias);
96 void traverseOneTableName(
OSQLTables& _rTables,
const OSQLParseNode * pTableName,
const OUString & rTableRange );
97 void traverseSearchCondition(
OSQLParseNode const * pSearchCondition);
98 void traverseOnePredicate(
102 void traverseByColumnNames(
const OSQLParseNode* pSelectNode,
bool _bOrder);
110 std::vector<OUString> getSelectColumnNames()
const;
112 OUString getUniqueColumnName(
const std::vector<OUString>& rColumnNames,
const OUString & rColumnName)
const;
124 static css::uno::Reference< css::beans::XPropertySet > findColumn(
125 const OSQLTables& _rTables,
const OUString & rColumnName, OUString & rTableRange );
137 css::uno::Reference< css::beans::XPropertySet > findColumn(
138 const OUString & rColumnName, OUString & rTableRange,
bool _bLookInSubTables );
145 css::uno::Reference< css::beans::XPropertySet > findSelectColumn(
146 std::u16string_view rColumnName );
148 void setSelectColumnName(
const OUString& rColumnName,
const OUString& rColumnAlias,
const OUString& rTableRange,
bool bFkt =
false, sal_Int32 _nType = css::sdbc::DataType::VARCHAR,
bool bAggFkt =
false);
149 void appendColumns(
const OUString& _rTableAlias,
const OSQLTable& _rTable);
159 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
160 const css::uno::Reference< css::container::XNameAccess >& _rxTables,
165 bool isCaseSensitive()
const;
186 const css::sdbc::SQLException&
getErrors()
const {
return *m_xErrors; }
204 const ::rtl::Reference<OSQLColumns>&
getGroupColumns()
const {
return m_aGroupColumns;}
205 const ::rtl::Reference<OSQLColumns>&
getOrderColumns()
const {
return m_aOrderColumns;}
206 const ::rtl::Reference<OSQLColumns>&
getParameters()
const {
return m_aParameters; }
217 OUString &_rColumnName,
218 OUString& _rTableRange)
const;
233 OUString& _out_rColumnName,
234 OUString& _out_rTableRange,
235 OUString& _out_rColumnAliasIfPresent
244 static OUString getColumnAlias(
const OSQLParseNode* _pDerivedColumn);
257 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
258 OUString &_rColumnName,
259 OUString& _rTableRange);
265 sal_Int32 getFunctionReturnType(
const OSQLParseNode* _pNode );
268 ::std::vector< TNodePair >& getJoinConditions()
const;
274 bool traverseTableNames(
OSQLTables& _rTables );
277 bool traverseSelectColumnNames(
const OSQLParseNode* pSelectNode);
279 void traverseCreateColumns(
const OSQLParseNode* pSelectNode);
281 bool traverseOrderByColumnNames(
const OSQLParseNode* pSelectNode);
282 bool traverseGroupByColumnNames(
const OSQLParseNode* pSelectNode);
284 bool traverseSelectionCriteria(
const OSQLParseNode* pSelectNode);
298 const OUString& rTableName,
const OUString& rCatalogName,
const OUString& rSchemaName );
303 const OUString& _rComposedName
312 void impl_getQueryParameterColumns(
const OSQLTable& _rQuery );
314 void setOrderByColumnName(
const OUString & rColumnName, OUString & rTableRange,
bool bAscending);
315 void setGroupByColumnName(
const OUString & rColumnName, OUString & rTableRange);
329 const OUString* _pReplaceToken1 =
nullptr,
const OUString* _pReplaceToken2 =
nullptr );
335 void impl_fillJoinConditions(
const OSQLParseNode* i_pJoinCondition);
OSQLStatementType m_eStatementType
::std::unique_ptr< OSQLParseTreeIteratorImpl > m_pImpl
void impl_appendError(IParseContext::ErrorCode _eError, const OUString *_pReplaceToken1=nullptr, const OUString *_pReplaceToken2=nullptr)
appends an SQLException corresponding to the given error code to our error collection
const ::rtl::Reference< OSQLColumns > & getParameters() const
OSQLParseTreeIterator(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::container::XNameAccess > &_rxTables, const OSQLParser &_rParser)
::rtl::Reference< OSQLColumns > m_aSelectColumns
::rtl::Reference< OSQLColumns > m_aCreateColumns
static void getColumnRange(const OSQLParseNode *_pColumnRef, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, OUString &_rColumnName, OUString &_rTableRange)
return the columname and the table range
::rtl::Reference< OSQLColumns > m_aParameters
const css::sdbc::SQLException & getErrors() const
returns the errors which occurred during parsing.
OSQLParseTreeIterator(const OSQLParseTreeIterator &rIter)=delete
void impl_appendError(const css::sdbc::SQLException &_rError)
appends an SQLException corresponding to the given error code to our error collection
const ::rtl::Reference< OSQLColumns > & getSelectColumns() const
const ::rtl::Reference< OSQLColumns > & getGroupColumns() const
void getColumnRange(const OSQLParseNode *_pColumnRef, OUString &_out_rColumnName, OUString &_out_rTableRange, OUString &_out_rColumnAliasIfPresent) const
retrieves a column's name, table range, and alias
const OSQLParser & m_rParser
const OSQLParseNode * getParseTree() const
const ::rtl::Reference< OSQLColumns > & getOrderColumns() const
std::optional< css::sdbc::SQLException > m_xErrors
OSQLStatementType getStatementType() const
::rtl::Reference< OSQLColumns > m_aGroupColumns
const OSQLParseNode * m_pParseTree
::rtl::Reference< OSQLColumns > m_aOrderColumns
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
class SAL_NO_VTABLE XPropertySet
std::map< OUString, OSQLTable, comphelper::UStringMixLess > OSQLTables
css::uno::Reference< css::sdbcx::XColumnsSupplier > OSQLTable
::std::pair< const OSQLParseNode *, const OSQLParseNode * > TNodePair