diff options
Diffstat (limited to 'connectivity/source/drivers/evoab2/NStatement.cxx')
-rw-r--r-- | connectivity/source/drivers/evoab2/NStatement.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 542ee1de8d45..91ebdda56c70 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -38,7 +38,7 @@ #include <sqlbison.hxx> #include <strings.hrc> #include <connectivity/dbexception.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace connectivity::evoab { @@ -49,7 +49,6 @@ using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; -using namespace com::sun::star::io; using namespace com::sun::star::util; namespace { @@ -268,8 +267,11 @@ void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, So ENSURE_OR_THROW( ( pColumnRef != nullptr ) && ( pAscDesc != nullptr ) - && SQL_ISRULE( pAscDesc, opt_asc_desc ) - && ( pAscDesc->count() < 2 ), + && ( pAscDesc->isLeaf() ) + && ( SQL_ISRULE( pAscDesc, opt_asc_desc ) + || SQL_ISTOKEN(pAscDesc, ASC) + || SQL_ISTOKEN(pAscDesc, DESC) + ), "ordering_spec structure error" ); // column name -> column field @@ -278,11 +280,7 @@ void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, So const OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) ); guint nField = evoab::findEvoabField( sColumnName ); // ascending/descending? - bool bAscending = true; - if ( ( pAscDesc->count() == 1 ) - && SQL_ISTOKEN( pAscDesc->getChild( 0 ), DESC ) - ) - bAscending = false; + bool bAscending = !SQL_ISTOKEN(pAscDesc, DESC); _out_rSort.push_back( FieldSort( nField, bAscending ) ); } @@ -506,6 +504,7 @@ void OCommonStatement::parseSql( const OUString& sql, QueryData& _out_rQueryData pOrderByClause->showParseTree( sTreeDebug ); SAL_INFO( "connectivity.evoab2", "found order-by tree:\n" << sTreeDebug ); #endif + orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder ); } @@ -549,7 +548,7 @@ Any SAL_CALL OCommonStatement::getWarnings( ) checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed); - return makeAny(SQLWarning()); + return Any(SQLWarning()); } @@ -614,7 +613,7 @@ Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryDa pResult->construct( _rQueryData ); // done - m_xResultSet = pResult; + m_xResultSet = Reference<XWeak>(pResult); return pResult; } |