diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-11 09:39:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-11 14:01:00 +0200 |
commit | 7430dfe2a4a3b13ffa248bf14a3a2ca87993f48d (patch) | |
tree | 3b9607225ec2df9934b71df223c482ca7a069ff1 /connectivity | |
parent | 3b835b8d546ca16d7edcb06eda017e276383ea0f (diff) |
loplugin:unusedmethods
Change-Id: I34009aabf0befb346470b5c0d96ad8fc476b7c4e
Reviewed-on: https://gerrit.libreoffice.org/60300
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
9 files changed, 5 insertions, 68 deletions
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx index e4d70bed516a..903481e27fe0 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx @@ -37,15 +37,13 @@ #include "mysqlc_preparedstatement.hxx" #include <stdio.h> +#include <sal/macros.h> using namespace connectivity::mysqlc; 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 mysqlc_sdbc_driver::getStringFromAny; - -#include <sal/macros.h> static std::string wild("%"); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx index 2651ec5f9a79..ee2a61a61f9f 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx @@ -78,28 +78,6 @@ Sequence<OUString> SAL_CALL MysqlCDriver::getSupportedServiceNames() return getSupportedServiceNames_Static(); } -void MysqlCDriver::impl_initCppConn_lck_throw() -{ -#ifdef BUNDLE_MARIADB - if (!m_bAttemptedLoadCConn) - { - const OUString sModuleName(BUNDLE_MARIADB); - m_hCConnModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0); - m_bAttemptedLoadCConn = true; - } - - // attempted to load - was it successful? - if (!m_hCConnModule) - { - OSL_FAIL("MysqlCDriver::impl_initCppConn_lck_throw: could not load the " BUNDLE_MARIADB - " library!"); - throw SQLException("Unable to load the " BUNDLE_MARIADB " library.", *this, - OUString("08001"), // "unable to connect" - 0, Any()); - } -#endif -} - Reference<XConnection> SAL_CALL MysqlCDriver::connect(const OUString& url, const Sequence<PropertyValue>& info) { diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx index d0f7febf8d13..9e810ee0748a 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.hxx @@ -87,9 +87,6 @@ public: const Reference<css::lang::XMultiServiceFactory>& getFactory() const { return m_xFactory; } static rtl_TextEncoding getDefaultEncoding() { return RTL_TEXTENCODING_UTF8; } - -private: - void impl_initCppConn_lck_throw(); }; } /* mysqlc */ } /* connectivity */ diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx index c1caf782016d..d56be8b88500 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.cxx @@ -87,16 +87,6 @@ void allocateSqlVar(void** mem, enum_field_types eType, unsigned nSize) } } -/// Use this instead of mysql_real_escape_string, because that one also escapes -/// single quote ('), which should not be escaped -rtl::OString escapeSql(const rtl::OString& from) -{ - rtl::OString sRet = from.replaceAll("\\", "\\\\"); - sRet = sRet.replaceAll("\"", "\\\""); - sRet = sRet.replaceAll("`", "\\`"); - return sRet; -} - void throwFeatureNotImplementedException(const sal_Char* _pAsciiFeatureName, const css::uno::Reference<XInterface>& _rxContext) { @@ -123,13 +113,6 @@ void throwSQLExceptionWithMsg(const char* msg, unsigned int errorNum, errorNum, Any()); } -rtl::OUString getStringFromAny(const Any& _rAny) -{ - rtl::OUString nReturn; - OSL_VERIFY(_rAny >>= nReturn); - return nReturn; -} - sal_Int32 mysqlToOOOType(int eType, int charsetnr) noexcept { // charset number 63 indicates binary @@ -344,11 +327,6 @@ rtl::OUString convert(const ::std::string& _string, const rtl_TextEncoding encod return rtl::OUString(_string.c_str(), _string.size(), encoding); } -::std::string convert(const rtl::OUString& _string, const rtl_TextEncoding encoding) -{ - return ::std::string(rtl::OUStringToOString(_string, encoding).getStr()); -} - } /* namespace */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx index 2c0879a14d9c..2d468bb367da 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_general.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_general.hxx @@ -92,10 +92,6 @@ void resetSqlVar(void** target, T* pValue, enum_field_types type, sal_Int32 nSiz void allocateSqlVar(void** mem, enum_field_types eType, unsigned nSize = 0); -rtl::OString escapeSql(const rtl::OString& from); - -rtl::OUString getStringFromAny(const css::uno::Any& _rAny); - /// @throws css::sdbc::SQLException void throwFeatureNotImplementedException( const sal_Char* _pAsciiFeatureName, @@ -116,8 +112,6 @@ rtl::OUString mysqlTypeToStr(MYSQL_FIELD* pField); sal_Int32 mysqlStrToOOOType(const rtl::OUString& sType); rtl::OUString convert(const ::std::string& _string, const rtl_TextEncoding encoding); - -::std::string convert(const rtl::OUString& _string, const rtl_TextEncoding encoding); } #endif diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx index 7348abbed855..e6e1a79c0728 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx @@ -295,7 +295,7 @@ uno::Reference<XResultSetMetaData> SAL_CALL OPreparedResultSet::getMetaData() checkDisposed(OPreparedResultSet_BASE::rBHelper.bDisposed); if (!m_xMetaData.is()) { - m_xMetaData = new OResultSetMetaData(m_rConnection, m_pResult, m_encoding); + m_xMetaData = new OResultSetMetaData(m_rConnection, m_pResult); } return m_xMetaData; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx index 97c1da289d02..358a2ca100d8 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx @@ -112,8 +112,7 @@ Reference<XResultSetMetaData> SAL_CALL OPreparedStatement::getMetaData() { MYSQL_RES* pRes = mysql_stmt_result_metadata(m_pStmt); // TODO warning or error if no meta data. - m_xMetaData = new OResultSetMetaData(*m_xConnection.get(), pRes, - getOwnConnection()->getConnectionEncoding()); + m_xMetaData = new OResultSetMetaData(*m_xConnection.get(), pRes); } return m_xMetaData; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx index 297fd4cdbd69..6109849e2a20 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultset.cxx @@ -363,7 +363,7 @@ uno::Reference<XResultSetMetaData> SAL_CALL OResultSet::getMetaData() checkDisposed(OResultSet_BASE::rBHelper.bDisposed); if (!m_xMetaData.is()) { - m_xMetaData = new OResultSetMetaData(m_rConnection, m_pResult, m_encoding); + m_xMetaData = new OResultSetMetaData(m_rConnection, m_pResult); } return m_xMetaData; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx index a78b8c9eb694..d139f8d0021b 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_resultsetmetadata.hxx @@ -46,24 +46,17 @@ class OResultSetMetaData final : public OResultSetMetaData_BASE private: OConnection& m_rConnection; MYSQL_RES* m_pRes; - rtl_TextEncoding m_encoding; virtual ~OResultSetMetaData() override = default; MYSQL_FIELD* getField(sal_Int32 column) const; public: - OResultSetMetaData(OConnection& rConn, MYSQL_RES* pResult, rtl_TextEncoding _encoding) + OResultSetMetaData(OConnection& rConn, MYSQL_RES* pResult) : m_rConnection(rConn) , m_pRes(pResult) - , m_encoding(_encoding) { } - rtl::OUString convert(const ::std::string& _string) const - { - return rtl::OUString(_string.c_str(), _string.size(), m_encoding); - } - sal_Int32 SAL_CALL getColumnCount() SAL_OVERRIDE; sal_Bool SAL_CALL isAutoIncrement(sal_Int32 column) SAL_OVERRIDE; |