dbaccess/qa/extras/hsql_schema_import.cxx | 66 +++++----------- dbaccess/qa/extras/macros-test.cxx | 3 dbaccess/qa/unit/hsql_binary_import.cxx | 6 - dbaccess/qa/unit/tdf119625.cxx | 7 - dbaccess/qa/unit/tdf126268.cxx | 4 dbaccess/source/ui/app/AppController.cxx | 5 - dbaccess/source/ui/dlg/ConnectionHelper.cxx | 12 -- dbaccess/source/ui/misc/WCopyTable.cxx | 3 dbaccess/source/ui/misc/WTypeSelect.cxx | 3 dbaccess/source/ui/querydesign/querycontainerwindow.cxx | 3 dbaccess/source/ui/tabledesign/TableController.cxx | 3 dbaccess/source/ui/uno/ColumnPeer.cxx | 3 12 files changed, 43 insertions(+), 75 deletions(-)
New commits: commit 868b0763ac47f765cb48c277897274a595b831d0 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Jun 3 09:20:59 2020 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Jun 3 11:40:43 2020 +0200 Upcoming loplugin:elidestringvar: dbaccess Change-Id: I5dc074a250ee169812f3ffd0cc4e598972ab87dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95396 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/dbaccess/qa/extras/hsql_schema_import.cxx b/dbaccess/qa/extras/hsql_schema_import.cxx index 89ee74ce03aa..6d714ae9a8ae 100644 --- a/dbaccess/qa/extras/hsql_schema_import.cxx +++ b/dbaccess/qa/extras/hsql_schema_import.cxx @@ -61,10 +61,8 @@ public: void HsqlSchemaImportTest::testIntegerPrimaryKeyNotNull() { - const OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY)" }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse("CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY)"); CPPUNIT_ASSERT_EQUAL(OUString{ "\"myTable\"" }, aCreateParser.getTableName()); const auto& columns = aCreateParser.getColumnDef(); @@ -79,13 +77,10 @@ void HsqlSchemaImportTest::testIntegerPrimaryKeyNotNull() void HsqlSchemaImportTest::testVarcharWithParam() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " - "VARCHAR(50))" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " + "VARCHAR(50))"); const auto& columns = aCreateParser.getColumnDef(); CPPUNIT_ASSERT_EQUAL(2_z, columns.size()); @@ -104,13 +99,10 @@ void HsqlSchemaImportTest::testVarcharWithParam() **/ void HsqlSchemaImportTest::testVarcharWithoutParam() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " - "VARCHAR)" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " + "VARCHAR)"); const auto& columns = aCreateParser.getColumnDef(); CPPUNIT_ASSERT_EQUAL(2_z, columns.size()); @@ -122,13 +114,10 @@ void HsqlSchemaImportTest::testVarcharWithoutParam() void HsqlSchemaImportTest::testNumericWithTwoParam() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"Betrag\" " - "NUMERIC(8,2))" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"Betrag\" " + "NUMERIC(8,2))"); const auto& columns = aCreateParser.getColumnDef(); CPPUNIT_ASSERT_EQUAL(2_z, columns.size()); @@ -146,13 +135,10 @@ void HsqlSchemaImportTest::testNumericWithTwoParam() void HsqlSchemaImportTest::testIntegerAutoincremental() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY GENERATED " - "BY DEFAULT AS IDENTITY(START WITH 0), \"myText\" VARCHAR(50))" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY GENERATED " + "BY DEFAULT AS IDENTITY(START WITH 0), \"myText\" VARCHAR(50))"); const auto& columns = aCreateParser.getColumnDef(); const auto column = columns.at(0); @@ -169,13 +155,10 @@ void HsqlSchemaImportTest::testIntegerAutoincremental() */ void HsqlSchemaImportTest::testTimestampWithParam() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " - "TIMESTAMP(0))" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myText\" " + "TIMESTAMP(0))"); const auto& columns = aCreateParser.getColumnDef(); const ColumnDefinition* colTimeStamp = lcl_findByType(columns, css::sdbc::DataType::TIMESTAMP); @@ -194,13 +177,10 @@ void HsqlSchemaImportTest::testTimestampWithParam() */ void HsqlSchemaImportTest::testDefaultValueNow() { - const OUString sql{ - "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myDate\" " - "TIMESTAMP DEFAULT NOW)" - }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse( + "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, \"myDate\" " + "TIMESTAMP DEFAULT NOW)"); const auto& columns = aCreateParser.getColumnDef(); const ColumnDefinition* colTimeStamp = lcl_findByType(columns, css::sdbc::DataType::TIMESTAMP); @@ -213,12 +193,10 @@ void HsqlSchemaImportTest::testDefaultValueNow() void HsqlSchemaImportTest::testEvilNullColumnName() { - const OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, " - "\"myEvilNOT NULLName\" " - "VARCHAR(20))" }; - FbCreateStmtParser aCreateParser; - aCreateParser.parse(sql); + aCreateParser.parse("CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, " + "\"myEvilNOT NULLName\" " + "VARCHAR(20))"); const auto& columns = aCreateParser.getColumnDef(); CPPUNIT_ASSERT_EQUAL(2_z, columns.size()); diff --git a/dbaccess/qa/extras/macros-test.cxx b/dbaccess/qa/extras/macros-test.cxx index d5b7538f9fc5..dbc6488db051 100644 --- a/dbaccess/qa/extras/macros-test.cxx +++ b/dbaccess/qa/extras/macros-test.cxx @@ -36,9 +36,8 @@ DBAccessTest::DBAccessTest() void DBAccessTest::test() { - const OUString aFileNameBase("testdb.odb"); OUString aFileName; - createFileURL(aFileNameBase, aFileName); + createFileURL("testdb.odb", aFileName); uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName); CPPUNIT_ASSERT(xComponent.is()); xComponent->dispose(); diff --git a/dbaccess/qa/unit/hsql_binary_import.cxx b/dbaccess/qa/unit/hsql_binary_import.cxx index fbf12f929019..1f5ecb310efc 100644 --- a/dbaccess/qa/unit/hsql_binary_import.cxx +++ b/dbaccess/qa/unit/hsql_binary_import.cxx @@ -49,10 +49,10 @@ void HsqlBinaryImportTest::testBinaryImport() // at this point migration is already done uno::Reference<XStatement> statement = xConnection->createStatement(); - OUString sql{ "SELECT \"ID\", \"Power_value\", \"Power_name\", \"Retired\", " - "\"Birth_date\" FROM \"TestTable\" ORDER BY \"ID\"" }; - uno::Reference<XResultSet> xRes = statement->executeQuery(sql); + uno::Reference<XResultSet> xRes + = statement->executeQuery("SELECT \"ID\", \"Power_value\", \"Power_name\", \"Retired\", " + "\"Birth_date\" FROM \"TestTable\" ORDER BY \"ID\""); uno::Reference<XRow> xRow(xRes, UNO_QUERY_THROW); // assert first row diff --git a/dbaccess/qa/unit/tdf119625.cxx b/dbaccess/qa/unit/tdf119625.cxx index 8431c5426e90..5486a476f166 100644 --- a/dbaccess/qa/unit/tdf119625.cxx +++ b/dbaccess/qa/unit/tdf119625.cxx @@ -86,11 +86,10 @@ void Tdf119625Test::testTime() // select basically everything from the .odb uno::Reference<XStatement> statement = xConnection->createStatement(); - const OUString sql{ " SELECT id, tst_dt, tst_d, tst_t " - " FROM tst_data " - "ORDER BY id" }; - uno::Reference<XResultSet> xRes = statement->executeQuery(sql); + uno::Reference<XResultSet> xRes = statement->executeQuery(" SELECT id, tst_dt, tst_d, tst_t " + " FROM tst_data " + "ORDER BY id"); uno::Reference<XRow> xRow(xRes, UNO_QUERY_THROW); // check result diff --git a/dbaccess/qa/unit/tdf126268.cxx b/dbaccess/qa/unit/tdf126268.cxx index b0719936f588..426edee37f0c 100644 --- a/dbaccess/qa/unit/tdf126268.cxx +++ b/dbaccess/qa/unit/tdf126268.cxx @@ -64,9 +64,9 @@ void Tdf126268Test::testNumbers() // select basically everything from the .odb uno::Reference<XStatement> statement = xConnection->createStatement(); - const OUString sql{ "SELECT ID, Column1, Column2 FROM tableTest ORDER BY ID" }; - uno::Reference<XResultSet> xRes = statement->executeQuery(sql); + uno::Reference<XResultSet> xRes + = statement->executeQuery("SELECT ID, Column1, Column2 FROM tableTest ORDER BY ID"); uno::Reference<XRow> xRow(xRes, UNO_QUERY_THROW); // check result diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 402880eedb0c..37cb8e2cbc61 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1549,7 +1549,6 @@ void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rE { _rEvent.Accessor >>= sName; Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY); - OUString sNewName; ElementType eType = getElementType(xContainer); switch( eType ) @@ -1558,7 +1557,9 @@ void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rE { ensureConnection(); if ( xProp.is() && m_xMetaData.is() ) - sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false ); + //TODO: tdf#133497 "OApplicationController::elementReplaced effectively does + // nothing": + (void) ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false ); } break; case E_FORM: diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index a9f4418a2219..063c5320e566 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -217,24 +217,22 @@ namespace dbaui break; case ::dbaccess::DST_MSACCESS: { - const OUString sExt("*.mdb;*.mde"); OUString sFilterName(DBA_RES (STR_MSACCESS_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, GetFrameWeld()); - aFileDlg.AddFilter(sFilterName,sExt); + aFileDlg.AddFilter(sFilterName,"*.mdb;*.mde"); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); } break; case ::dbaccess::DST_MSACCESS_2007: { - const OUString sAccdb("*.accdb;*.accde"); OUString sFilterName2(DBA_RES (STR_MSACCESS_2007_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, GetFrameWeld()); - aFileDlg.AddFilter(sFilterName2,sAccdb); + aFileDlg.AddFilter(sFilterName2,"*.accdb;*.accde"); aFileDlg.SetCurrentFilter(sFilterName2); askForFileName(aFileDlg); } @@ -321,12 +319,11 @@ namespace dbaui } case ::dbaccess::DST_FIREBIRD: { - const OUString sExt("*.fdb"); OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); - aFileDlg.AddFilter(sFilterName,sExt); + aFileDlg.AddFilter(sFilterName,"*.fdb"); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); break; @@ -346,12 +343,11 @@ namespace dbaui { case ::dbaccess::DST_FIREBIRD: { - const OUString sExt("*.fdb"); OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, GetFrameWeld()); - aFileDlg.AddFilter(sFilterName,sExt); + aFileDlg.AddFilter(sFilterName,"*.fdb"); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); break; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 58dbc4d65327..f395a59d2ba9 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1495,8 +1495,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType, bool& _bN if ( !pType ) { _bNotConvert = false; - OUString const sCreate("x"); - pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,sCreate,50,0,false,bForce); + pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,"x",50,0,false,bForce); if ( !pType ) pType = m_pTypeInfo; } diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index c06de9bcab34..f42521524d60 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -352,8 +352,7 @@ void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr, sal_uInt _pFieldDescr->SetPrimaryKey(_bSet); if( _bSet ) { - OUString sImage(BMP_PRIMARY_KEY); - m_xControl->set_image(_nPos, sImage); + m_xControl->set_image(_nPos, BMP_PRIMARY_KEY); } else if( _pFieldDescr->getTypeInfo()->bNullable ) { diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx index aef183bb641d..9481f6518cf5 100644 --- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx +++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx @@ -184,8 +184,7 @@ namespace dbaui Reference < XPropertySet > xLMPropSet(m_xBeamer->getLayoutManager(), UNO_QUERY); if ( xLMPropSet.is() ) { - const OUString aAutomaticToolbars( "AutomaticToolbars" ); - xLMPropSet->setPropertyValue( aAutomaticToolbars, Any( false )); + xLMPropSet->setPropertyValue( "AutomaticToolbars", Any( false )); } } catch( Exception& ) diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index f88110b48362..670fc6ef5bdb 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -810,8 +810,7 @@ void OTableController::loadData() pTabEdRow->SetReadOnly(!bIsAlterAllowed); // search for type bool bForce; - OUString const sCreate("x"); - TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,sCreate,nPrecision,nScale,bIsAutoIncrement,bForce); + TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,"x",nPrecision,nScale,bIsAutoIncrement,bForce); if ( !pTypeInfo ) pTypeInfo = m_pTypeInfo; pTabEdRow->SetFieldType( pTypeInfo, bForce ); diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx index 36bad3a1057d..9dc357eb2a8c 100644 --- a/dbaccess/source/ui/uno/ColumnPeer.cxx +++ b/dbaccess/source/ui/uno/ColumnPeer.cxx @@ -87,9 +87,8 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn) m_pActFieldDescr = new OFieldDescription(_xColumn,true); // search for type - OUString const sCreateParam("x"); bool bForce; - TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce); + TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,"x",nPrecision,nScale,bAutoIncrement,bForce); if ( !pTypeInfo ) pTypeInfo = pFieldControl->getDefaultTyp(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits