loplugin:reducevarscope in dbaccess
Change-Id: I22163b3303ae0c2326d079a18fa8906f38aa1d4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103810 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -55,7 +55,6 @@ void DialogSaveTest::test()
|
||||
// be locked anyway:
|
||||
SolarMutexReleaser rel;
|
||||
|
||||
const OUString sStandard("Standard");
|
||||
const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testDialogSave.odb"));
|
||||
{
|
||||
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
|
||||
@@ -68,6 +67,7 @@ void DialogSaveTest::test()
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
|
||||
CPPUNIT_ASSERT(xStorDlgLib.is());
|
||||
uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
|
||||
const OUString sStandard("Standard");
|
||||
xBasLib->loadLibrary(sStandard);
|
||||
CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
|
||||
// the whole point of this test is to test the "save" operation
|
||||
|
||||
@@ -53,7 +53,6 @@ void DialogSaveTest::test()
|
||||
// be locked anyway:
|
||||
SolarMutexReleaser rel;
|
||||
|
||||
const OUString sStandard("Standard");
|
||||
const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testEmptyStdlibSave.odb"));
|
||||
{
|
||||
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
|
||||
@@ -66,6 +65,7 @@ void DialogSaveTest::test()
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
|
||||
CPPUNIT_ASSERT(xStorDlgLib.is());
|
||||
uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
|
||||
const OUString sStandard("Standard");
|
||||
xBasLib->loadLibrary(sStandard);
|
||||
xDlgLib->loadLibrary(sStandard);
|
||||
CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
|
||||
|
||||
@@ -53,7 +53,6 @@ void DialogSaveTest::test()
|
||||
// be locked anyway:
|
||||
SolarMutexReleaser rel;
|
||||
|
||||
const OUString sStandard("Standard");
|
||||
const OUString aFileName(m_directories.getURLFromWorkdir("CppunitTest/testNolibSave.odb"));
|
||||
{
|
||||
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
|
||||
@@ -66,6 +65,7 @@ void DialogSaveTest::test()
|
||||
uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries());
|
||||
CPPUNIT_ASSERT(xStorDlgLib.is());
|
||||
uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW);
|
||||
const OUString sStandard("Standard");
|
||||
xBasLib->loadLibrary(sStandard);
|
||||
xDlgLib->loadLibrary(sStandard);
|
||||
CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard));
|
||||
|
||||
@@ -1314,7 +1314,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
|
||||
OUString sReturn;
|
||||
if(m_pTables && m_pTables->getCount() > 1)
|
||||
{
|
||||
OUString aCatalog,aSchema,aTable,aComposedName,aColumnName;
|
||||
OUString aCatalog,aSchema,aTable,aColumnName;
|
||||
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_CATALOGNAME))
|
||||
column->getPropertyValue(PROPERTY_CATALOGNAME) >>= aCatalog;
|
||||
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_SCHEMANAME))
|
||||
@@ -1343,7 +1343,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
|
||||
}
|
||||
else
|
||||
{
|
||||
aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
|
||||
OUString aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
|
||||
|
||||
// Is this the right case for the table name?
|
||||
// Else, look for it with different case, if applicable.
|
||||
|
||||
@@ -335,12 +335,13 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
|
||||
xDrop->dropByName(_sElementName);
|
||||
else
|
||||
{
|
||||
OUString sCatalog,sSchema,sTable,sComposedName;
|
||||
OUString sComposedName;
|
||||
|
||||
bool bIsView = false;
|
||||
Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
|
||||
if ( xTable.is() && m_xMetaData.is() )
|
||||
{
|
||||
OUString sSchema,sCatalog,sTable;
|
||||
if (m_xMetaData->supportsCatalogsInTableDefinitions())
|
||||
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
|
||||
if (m_xMetaData->supportsSchemasInTableDefinitions())
|
||||
|
||||
@@ -154,11 +154,12 @@ void OViewContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
|
||||
xDrop->dropByName(_sElementName);
|
||||
else
|
||||
{
|
||||
OUString sCatalog,sSchema,sTable,sComposedName;
|
||||
OUString sComposedName;
|
||||
|
||||
Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
|
||||
if ( xTable.is() )
|
||||
{
|
||||
OUString sCatalog,sSchema,sTable;
|
||||
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
|
||||
xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
|
||||
xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
|
||||
|
||||
@@ -2338,10 +2338,9 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const
|
||||
if ( nAction != DND_ACTION_NONE )
|
||||
{
|
||||
auto xHitEntry = pView->getEntry(_rEvt.maPosPixel);
|
||||
OUString sName;
|
||||
if (xHitEntry)
|
||||
{
|
||||
sName = pView->getQualifiedName(xHitEntry.get());
|
||||
OUString sName = pView->getQualifiedName(xHitEntry.get());
|
||||
if ( !sName.isEmpty() )
|
||||
{
|
||||
Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
|
||||
|
||||
@@ -1126,9 +1126,9 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos)
|
||||
// the old implementation copied a SBA_FIELDDATAEXCHANGE_FORMAT, too, (which was rather expensive to obtain),
|
||||
// but we have no client for this DnD format anymore (the mail part of SO 5.2 was the only client)
|
||||
|
||||
OUString sCellText;
|
||||
try
|
||||
{
|
||||
OUString sCellText;
|
||||
Reference< XGridFieldDataSupplier > xFieldData(static_cast< XGridPeer* >(GetPeer()), UNO_QUERY);
|
||||
Sequence<sal_Bool> aSupportingText = xFieldData->queryFieldDataType(cppu::UnoType<decltype(sCellText)>::get());
|
||||
if (aSupportingText.getConstArray()[nColumnPos])
|
||||
|
||||
@@ -1278,11 +1278,10 @@ OUString OFieldDescControl::getControlDefault( const OFieldDescription* _pFieldD
|
||||
bool bCheck = !_bCheck || _pFieldDescr->GetControlDefault().hasValue();
|
||||
if ( bCheck )
|
||||
{
|
||||
sal_uInt32 nFormatKey;
|
||||
|
||||
try
|
||||
{
|
||||
double nValue = 0.0;
|
||||
sal_uInt32 nFormatKey;
|
||||
bool bTextFormat = isTextFormat(_pFieldDescr,nFormatKey);
|
||||
if ( _pFieldDescr->GetControlDefault() >>= sDefault )
|
||||
{
|
||||
|
||||
@@ -220,10 +220,10 @@ IMPL_LINK(OUserAdmin, UserHdl, weld::Button&, rButton, void)
|
||||
m_xUsers->getByName(sName) >>= xUser;
|
||||
if(xUser.is())
|
||||
{
|
||||
OUString sNewPassword,sOldPassword;
|
||||
OPasswordDialog aDlg(GetFrameWeld(), sName);
|
||||
if (aDlg.run() == RET_OK)
|
||||
{
|
||||
OUString sNewPassword,sOldPassword;
|
||||
sNewPassword = aDlg.GetNewPassword();
|
||||
sOldPassword = aDlg.GetOldPassword();
|
||||
|
||||
|
||||
@@ -282,12 +282,12 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo
|
||||
bool bHaving = false;
|
||||
try
|
||||
{
|
||||
OUString sTableName;
|
||||
_rFilter.Name = _rField.get_active_text();
|
||||
Reference< XPropertySet > xColumn = getQueryColumn(_rFilter.Name);
|
||||
if ( xColumn.is() )
|
||||
{
|
||||
bool bFunction = false;
|
||||
OUString sTableName;
|
||||
Reference< XPropertySetInfo > xInfo = xColumn->getPropertySetInfo();
|
||||
if ( xInfo->hasPropertyByName(PROPERTY_REALNAME) )
|
||||
{
|
||||
|
||||
@@ -1285,9 +1285,9 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
|
||||
|
||||
if ( !_bMove || sNewName.isEmpty() )
|
||||
{
|
||||
OUString sTargetName,sLabel;
|
||||
if ( sNewName.isEmpty() || xNameAccess->hasByName(sNewName) )
|
||||
{
|
||||
OUString sLabel, sTargetName;
|
||||
if ( !sNewName.isEmpty() )
|
||||
sTargetName = sNewName;
|
||||
else
|
||||
|
||||
@@ -238,7 +238,6 @@ namespace
|
||||
bool bErg = false;
|
||||
|
||||
OUString aTableRange,aColumnName;
|
||||
sal_uInt16 nCntAccount;
|
||||
::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController&>(_pView->getController()).getParseIterator();
|
||||
rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange );
|
||||
|
||||
@@ -249,6 +248,7 @@ namespace
|
||||
}
|
||||
if ( !bErg )
|
||||
{
|
||||
sal_uInt16 nCntAccount;
|
||||
bErg = static_cast<OQueryTableView*>(_pView->getTableView())->FindTableFromField(aColumnName, _rDragInfo, nCntAccount);
|
||||
if ( !bErg )
|
||||
bErg = _pView->HasFieldByAliasName(aColumnName, _rDragInfo);
|
||||
|
||||
@@ -463,7 +463,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
|
||||
SQLExceptionInfo aError;
|
||||
try
|
||||
{
|
||||
OUString aErrorMsg;
|
||||
setStatement_fireEvent( getContainer()->getStatement() );
|
||||
if(m_sStatement.isEmpty() && m_pSqlIterator)
|
||||
{
|
||||
@@ -475,6 +474,7 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString aErrorMsg;
|
||||
std::unique_ptr<::connectivity::OSQLParseNode> pNode = m_aSqlParser.parseTree(aErrorMsg,m_sStatement,m_bGraphicalDesign);
|
||||
if ( pNode )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user