diff options
Diffstat (limited to 'connectivity/source/drivers/writer/WConnection.cxx')
-rw-r--r-- | connectivity/source/drivers/writer/WConnection.cxx | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx index c4cc699e4ad2..c9900a4e5544 100644 --- a/connectivity/source/drivers/writer/WConnection.cxx +++ b/connectivity/source/drivers/writer/WConnection.cxx @@ -32,7 +32,7 @@ #include <unotools/pathoptions.hxx> #include <connectivity/dbexception.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> using namespace ::com::sun::star; @@ -42,7 +42,6 @@ namespace connectivity::writer { OWriterConnection::OWriterConnection(ODriver* _pDriver) : OConnection(_pDriver) - , m_nDocCount(0) { } @@ -55,9 +54,9 @@ void OWriterConnection::construct(const OUString& rURL, sal_Int32 nLen = rURL.indexOf(':'); nLen = rURL.indexOf(':', nLen + 1); - OUString aDSN(rURL.copy(nLen + 1)); - m_aFileName = aDSN; + m_aFileName = rURL.copy(nLen + 1); // DSN + INetURLObject aURL; aURL.SetSmartProtocol(INetProtocol::File); { @@ -97,18 +96,17 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc() return m_xDoc; } // open read-only as long as updating isn't implemented - uno::Sequence<beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Hidden"; - aArgs[0].Value <<= true; - aArgs[1].Name = "ReadOnly"; - aArgs[1].Value <<= true; + uno::Sequence<beans::PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3); + auto pArgs = aArgs.getArray(); + pArgs[0].Name = "Hidden"; + pArgs[0].Value <<= true; + pArgs[1].Name = "ReadOnly"; + pArgs[1].Value <<= true; if (!m_sPassword.isEmpty()) { - const sal_Int32 nPos = aArgs.getLength(); - aArgs.realloc(nPos + 1); - aArgs[nPos].Name = "Password"; - aArgs[nPos].Value <<= m_sPassword; + pArgs[2].Name = "Password"; + pArgs[2].Value <<= m_sPassword; } uno::Reference<frame::XDesktop2> xDesktop @@ -203,8 +201,7 @@ css::uno::Reference<css::sdbcx::XTablesSupplier> OWriterConnection::createCatalo uno::Reference<css::sdbcx::XTablesSupplier> xTab = m_xCatalog; if (!xTab.is()) { - auto pCat = new OWriterCatalog(this); - xTab = pCat; + xTab = new OWriterCatalog(this); m_xCatalog = xTab; } return xTab; @@ -216,7 +213,7 @@ uno::Reference<sdbc::XStatement> SAL_CALL OWriterConnection::createStatement() checkDisposed(OConnection_BASE::rBHelper.bDisposed); uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this); - m_aStatements.push_back(uno::WeakReferenceHelper(xReturn)); + m_aStatements.emplace_back(xReturn); return xReturn; } @@ -226,10 +223,10 @@ uno::Reference<sdbc::XPreparedStatement> ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - auto pStmt = new component::OComponentPreparedStatement(this); - uno::Reference<sdbc::XPreparedStatement> xHoldAlive = pStmt; + rtl::Reference<component::OComponentPreparedStatement> pStmt + = new component::OComponentPreparedStatement(this); pStmt->construct(sql); - m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt)); + m_aStatements.emplace_back(*pStmt); return pStmt; } |