diff options
Diffstat (limited to 'dbaccess/source/ui/querydesign/QueryDesignView.cxx')
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index ce6c45673688..7de007624f3d 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -23,8 +23,9 @@ #include <querycontroller.hxx> #include <sqlbison.hxx> #include <vcl/split.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -52,12 +53,10 @@ #include <string_view> using namespace ::dbaui; -using namespace ::utl; using namespace ::connectivity; using namespace ::dbtools; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; @@ -96,7 +95,7 @@ namespace bool bHaving, bool _bAddOrOnOneLine); - OUString quoteTableAlias(bool _bQuote, const OUString& _sAliasName, const OUString& _sQuote) + OUString quoteTableAlias(bool _bQuote, const OUString& _sAliasName, std::u16string_view _sQuote) { OUString sRet; if ( _bQuote && !_sAliasName.isEmpty() ) @@ -160,12 +159,8 @@ namespace OUString aSourceFieldName(_aDragLeft->GetField()); OUString aDestFieldName(_aDragRight->GetField()); // the connection could point on the other side - if(pConn->GetSourceWin() == _aDragRight->GetTabWindow()) - { - OUString aTmp(aSourceFieldName); - aSourceFieldName = aDestFieldName; - aDestFieldName = aTmp; - } + if (pConn->GetSourceWin() == _aDragRight->GetTabWindow()) + std::swap(aSourceFieldName, aDestFieldName); pConn->GetData()->AppendConnLine( aSourceFieldName,aDestFieldName); pConn->UpdateLineList(); // Modified-Flag @@ -290,11 +285,12 @@ namespace { if(!aCondition.isEmpty()) aCondition.append(C_AND); - aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote)); - aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) )); - aCondition.append(" = "); - aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote)); - aCondition.append(::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) )); + aCondition.append( + quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote) + + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_FROM) ) + + " = " + + quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote) + + ::dbtools::quoteName(aQuote, lineData->GetFieldName(JTCS_TO) )); } } catch(SQLException&) @@ -658,8 +654,7 @@ namespace if ( field->isAggregateFunction() ) { OSL_ENSURE(!field->GetFunction().isEmpty(),"Function name must not be empty! ;-("); - OUStringBuffer aTmpStr2( field->GetFunction() + "(" + aTmpStr.makeStringAndClear() + ")"); - aTmpStr = aTmpStr2; + aTmpStr = field->GetFunction() + "(" + aTmpStr + ")"; } if (!rFieldAlias.isEmpty() && @@ -667,10 +662,10 @@ namespace field->isNumericOrAggregateFunction() || field->isOtherFunction())) { - aTmpStr.append(" AS "); - aTmpStr.append(::dbtools::quoteName(aQuote, rFieldAlias)); + aTmpStr.append(" AS " + ::dbtools::quoteName(aQuote, rFieldAlias)); } - aFieldListStr.append(aTmpStr.makeStringAndClear()); + aFieldListStr.append(aTmpStr); + aTmpStr.setLength(0); aFieldListStr.append(", "); } } @@ -919,14 +914,11 @@ namespace { aWorkStr += quoteTableAlias(bMulti,field->GetAlias(),aQuote) + ::dbtools::quoteName(aQuote, aColumnName); } - aWorkStr += " " + OUString( ";ASC;DESC" ).getToken( static_cast<sal_uInt16>(eOrder), ';' ) + ","; + aWorkStr += OUString::Concat(" ") + o3tl::getToken( u";ASC;DESC", static_cast<sal_uInt16>(eOrder), ';' ) + ","; } } - { - OUString sTemp(comphelper::string::stripEnd(aWorkStr, ',')); - aWorkStr = sTemp; - } + aWorkStr = comphelper::string::stripEnd(aWorkStr, ','); if ( !aWorkStr.isEmpty() ) { @@ -1141,8 +1133,7 @@ namespace if ( !aGroupByStr.isEmpty() ) { aGroupByStr = aGroupByStr.replaceAt(aGroupByStr.getLength()-1,1, u" " ); - OUString aGroupByStr2 = " GROUP BY " + aGroupByStr; - aGroupByStr = aGroupByStr2; + aGroupByStr = " GROUP BY " + aGroupByStr; } } catch(SQLException&) @@ -2171,7 +2162,7 @@ namespace if ( SQL_ISRULE(pColumnRef,general_set_fct) ) { aInfo->SetFunctionType(nFunctionType|FKT_AGGREGATE); - aInfo->SetFunction(comphelper::string::stripEnd(aColumns.getToken(0,'('), ' ')); + aInfo->SetFunction(OUString(comphelper::string::stripEnd(o3tl::getToken(aColumns,0,'('), ' '))); } else aInfo->SetFunctionType(nFunctionType|FKT_OTHER); @@ -2679,7 +2670,7 @@ void OQueryDesignView::fillValidFields(std::u16string_view sAliasName, weld::Com bool OQueryDesignView::PreNotify(NotifyEvent& rNEvt) { - if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) + if (rNEvt.GetType() == NotifyEventType::GETFOCUS) { if ( m_pSelectionBox && m_pSelectionBox->HasChildPathFocus() ) m_eChildFocus = SELECTION; @@ -2769,14 +2760,11 @@ OUString OQueryDesignView::getStatement() OUStringBuffer aSqlCmd("SELECT "); if(rController.isDistinct()) aSqlCmd.append(" DISTINCT "); - aSqlCmd.append(aFieldListStr); - aSqlCmd.append(" FROM "); - aSqlCmd.append(aTableListStr); + aSqlCmd.append(aFieldListStr + " FROM " + aTableListStr); if (!aCriteriaListStr.isEmpty()) { - aSqlCmd.append(" WHERE "); - aSqlCmd.append(aCriteriaListStr.makeStringAndClear()); + aSqlCmd.append(" WHERE " + aCriteriaListStr); } Reference<XDatabaseMetaData> xMeta; if ( xConnection.is() ) @@ -2789,8 +2777,7 @@ OUString OQueryDesignView::getStatement() // ----------------- construct GroupBy and attach ------------ if(!aHavingStr.isEmpty()) { - aSqlCmd.append(" HAVING "); - aSqlCmd.append(aHavingStr.makeStringAndClear()); + aSqlCmd.append(" HAVING " + aHavingStr); } // ----------------- construct sorting and attach ------------ OUString sOrder; |