diff options
Diffstat (limited to 'connectivity/source/drivers/file/FDatabaseMetaData.cxx')
-rw-r--r-- | connectivity/source/drivers/file/FDatabaseMetaData.cxx | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 215c381aa8c1..6d157bb575da 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_fuzzers.h> + #include <file/FDatabaseMetaData.hxx> #include <FDatabaseMetaDataResultSet.hxx> #include <com/sun/star/sdbc/ResultSetType.hpp> @@ -28,14 +30,13 @@ #include <file/FTable.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <ucbhelper/content.hxx> using namespace com::sun::star::ucb; using namespace connectivity::file; using namespace connectivity; using namespace com::sun::star::uno; -using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; @@ -71,6 +72,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( namespace { +#if !ENABLE_FUZZERS sal_Int16 isCaseSensitiveParentFolder( const OUString& _rFolderOrDoc, std::u16string_view _rDocName ) { sal_Int16 nIsCS = 1; @@ -149,6 +151,7 @@ namespace return nIsCS; } +#endif } @@ -163,7 +166,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static constexpr OUStringLiteral aTable = u"TABLE"; + static constexpr OUString aTable = u"TABLE"_ustr; bool bTableFound = true; sal_Int32 nLength = types.getLength(); @@ -227,7 +230,11 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( if ( !bKnowCaseSensitivity ) { bKnowCaseSensitivity = true; +#if ENABLE_FUZZERS + sal_Int16 nCase = 1; +#else sal_Int16 nCase = isCaseSensitiveParentFolder( m_pConnection->getURL(), aURL.getName() ); +#endif switch( nCase ) { case 1: @@ -291,14 +298,14 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( } if(bNewRow) { - aRow.push_back(new ORowSetValueDecorator(OUString(aTable))); + aRow.push_back(new ORowSetValueDecorator(aTable)); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRows.push_back(aRow); } } - pResult->setRows(aRows); + pResult->setRows(std::move(aRows)); return pResult; } @@ -393,7 +400,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( xNames->getByName(*pBegin), css::uno::UNO_QUERY); if(xTable.is()) { - auto pTable = comphelper::getUnoTunnelImplementation<OFileTable>(xTable); + auto pTable = dynamic_cast<OFileTable*>(xTable.get()); if(pTable && !pTable->isReadOnly()) { aRow[6] = ODatabaseMetaDataResultSet::getInsertValue(); @@ -419,7 +426,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( } } - pResult->setRows(aRows); + pResult->setRows(std::move(aRows)); return pResult; } @@ -610,15 +617,10 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes ); - static ODatabaseMetaDataResultSet::ORows aRows; - if(aRows.empty()) - { - aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } ); - } - pResult->setRows(aRows); + ODatabaseMetaDataResultSet::ORows aRows; + aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } ); + pResult->setRows(std::move(aRows)); return pResult; } |