summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/mysql_jdbc
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/mysql_jdbc')
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YCatalog.cxx17
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YColumns.cxx6
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx101
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTable.cxx43
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YTables.cxx25
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUser.cxx11
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YUsers.cxx17
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YViews.cxx9
8 files changed, 96 insertions, 133 deletions
diff --git a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
index ad98bfa1a7fa..7f4b0232e0c8 100644
--- a/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YCatalog.cxx
@@ -29,11 +29,8 @@ using namespace connectivity;
using namespace connectivity::mysql;
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OMySQLCatalog::OMySQLCatalog(const Reference<XConnection>& _xConnection)
: OCatalog(_xConnection)
@@ -44,7 +41,8 @@ OMySQLCatalog::OMySQLCatalog(const Reference<XConnection>& _xConnection)
void OMySQLCatalog::refreshObjects(const Sequence<OUString>& _sKindOfObject,
::std::vector<OUString>& _rNames)
{
- Reference<XResultSet> xResult = m_xMetaData->getTables(Any(), "%", "%", _sKindOfObject);
+ Reference<XResultSet> xResult
+ = m_xMetaData->getTables(Any(), u"%"_ustr, u"%"_ustr, _sKindOfObject);
fillNames(xResult, _rNames);
}
@@ -52,10 +50,9 @@ void OMySQLCatalog::refreshTables()
{
::std::vector<OUString> aVector;
- Sequence<OUString> sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence<OUString> sTableTypes{
+ u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr
+ }; // this last one just to be sure to include anything else...
refreshObjects(sTableTypes, aVector);
@@ -67,7 +64,7 @@ void OMySQLCatalog::refreshTables()
void OMySQLCatalog::refreshViews()
{
- Sequence<OUString> aTypes{ "VIEW" };
+ Sequence<OUString> aTypes{ u"VIEW"_ustr };
// let's simply assume the server is new enough to support views. Current drivers
// as of this writing might not return the proper information in getTableTypes, so
@@ -89,7 +86,7 @@ void OMySQLCatalog::refreshUsers()
::std::vector<OUString> aVector;
Reference<XStatement> xStmt = m_xConnection->createStatement();
Reference<XResultSet> xResult = xStmt->executeQuery(
- "SELECT grantee FROM information_schema.user_privileges GROUP BY grantee");
+ u"SELECT grantee FROM information_schema.user_privileges GROUP BY grantee"_ustr);
if (xResult.is())
{
Reference<XRow> xRow(xResult, UNO_QUERY);
diff --git a/connectivity/source/drivers/mysql_jdbc/YColumns.cxx b/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
index 54beb77ca061..8861037e9a0d 100644
--- a/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YColumns.cxx
@@ -26,10 +26,6 @@ using namespace connectivity::sdbcx;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OMySQLColumns::OMySQLColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector<OUString>& _rVector)
@@ -66,7 +62,7 @@ void OMySQLColumn::construct()
Sequence<OUString> SAL_CALL OMySQLColumn::getSupportedServiceNames()
{
- return { "com.sun.star.sdbcx.Column" };
+ return { u"com.sun.star.sdbcx.Column"_ustr };
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index d575ad874995..bc2a2314b939 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -17,8 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <mysql/YDriver.hxx>
#include <mysql/YCatalog.hxx>
+#include <o3tl/string_view.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
@@ -44,8 +49,8 @@ namespace
{
OUString getJavaDriverClass(css::uno::Sequence<css::beans::PropertyValue> const& info)
{
- return comphelper::NamedValueCollection(info).getOrDefault("JavaDriverClass",
- OUString("com.mysql.jdbc.Driver"));
+ return comphelper::NamedValueCollection::getOrDefault(info, u"JavaDriverClass",
+ u"com.mysql.jdbc.Driver"_ustr);
}
}
@@ -93,11 +98,14 @@ enum class T_DRIVERTYPE
Native
};
-bool isOdbcUrl(const OUString& _sUrl) { return _sUrl.startsWith("sdbc:mysql:odbc:"); }
+bool isOdbcUrl(std::u16string_view _sUrl) { return o3tl::starts_with(_sUrl, u"sdbc:mysql:odbc:"); }
-bool isNativeUrl(const OUString& _sUrl) { return _sUrl.startsWith("sdbc:mysql:mysqlc:"); }
+bool isNativeUrl(std::u16string_view _sUrl)
+{
+ return o3tl::starts_with(_sUrl, u"sdbc:mysql:mysqlc:");
+}
-T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl)
+T_DRIVERTYPE lcl_getDriverType(std::u16string_view _sUrl)
{
T_DRIVERTYPE eRet = T_DRIVERTYPE::Jdbc;
if (isOdbcUrl(_sUrl))
@@ -107,9 +115,9 @@ T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl)
return eRet;
}
-OUString transformUrl(const OUString& _sUrl)
+OUString transformUrl(std::u16string_view _sUrl)
{
- OUString sNewUrl = _sUrl.copy(11);
+ OUString sNewUrl(_sUrl.substr(11));
if (isOdbcUrl(_sUrl))
sNewUrl = "sdbc:" + sNewUrl;
else if (isNativeUrl(_sUrl))
@@ -150,36 +158,30 @@ Sequence<PropertyValue> lcl_convertProperties(T_DRIVERTYPE _eType,
if (_eType == T_DRIVERTYPE::Odbc)
{
- aProps.push_back(PropertyValue("Silent", 0, makeAny(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(PropertyValue("PreventGetVersionColumns", 0, makeAny(true),
- PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("Silent", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE);
}
else if (_eType == T_DRIVERTYPE::Jdbc)
{
if (!jdc)
{
- aProps.push_back(PropertyValue("JavaDriverClass", 0,
- makeAny(OUString("com.mysql.jdbc.Driver")),
- PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("JavaDriverClass", 0, Any(u"com.mysql.jdbc.Driver"_ustr),
+ PropertyState_DIRECT_VALUE);
}
}
else
{
- aProps.push_back(
- PropertyValue("PublicConnectionURL", 0, makeAny(_sUrl), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE);
}
- aProps.push_back(
- PropertyValue("IsAutoRetrievingEnabled", 0, makeAny(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(PropertyValue("AutoRetrievingStatement", 0,
- makeAny(OUString("SELECT LAST_INSERT_ID()")),
- PropertyState_DIRECT_VALUE));
- aProps.push_back(
- PropertyValue("ParameterNameSubstitution", 0, makeAny(true), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("AutoRetrievingStatement", 0, Any(u"SELECT LAST_INSERT_ID()"_ustr),
+ PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE);
return Sequence<PropertyValue>(aProps.data(), aProps.size());
}
}
-Reference<XDriver> ODriverDelegator::loadDriver(const OUString& url,
+Reference<XDriver> ODriverDelegator::loadDriver(std::u16string_view url,
const Sequence<PropertyValue>& info)
{
Reference<XDriver> xDriver;
@@ -224,8 +226,8 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
Sequence<PropertyValue> aConvertedProperties = lcl_convertProperties(eType, info, url);
if (eType == T_DRIVERTYPE::Jdbc)
{
- ::comphelper::NamedValueCollection aSettings(info);
- OUString sIanaName = aSettings.getOrDefault("CharSet", OUString());
+ OUString sIanaName = ::comphelper::NamedValueCollection::getOrDefault(
+ info, u"CharSet", OUString());
if (!sIanaName.isEmpty())
{
::dbtools::OCharsetMap aLookupIanaName;
@@ -236,7 +238,7 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
OUString sAdd;
if (RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding())
{
- static const char s_sCharSetOp[] = "useUnicode=true&";
+ static constexpr OUString s_sCharSetOp = u"useUnicode=true&"_ustr;
if (!sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp))
{
sAdd = s_sCharSetOp;
@@ -255,13 +257,12 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
if (xConnection.is())
{
// now we have to set the URL to get the correct answer for metadata()->getURL()
- auto pMetaConnection
- = comphelper::getUnoTunnelImplementation<OMetaConnection>(xConnection);
+ auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xConnection);
if (pMetaConnection)
pMetaConnection->setURL(url);
- m_aConnections.push_back(
- TWeakPair(WeakReferenceHelper(xConnection),
- TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
+ m_aConnections.emplace_back(
+ WeakReferenceHelper(xConnection),
+ TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection));
}
}
}
@@ -280,34 +281,30 @@ sal_Bool SAL_CALL ODriverDelegator::acceptsURL(const OUString& url)
Sequence<DriverPropertyInfo> SAL_CALL
ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyValue>& info)
{
- std::vector<DriverPropertyInfo> aDriverInfo;
if (!acceptsURL(url))
return Sequence<DriverPropertyInfo>();
- Sequence<OUString> aBoolean(2);
- aBoolean[0] = "0";
- aBoolean[1] = "1";
+ Sequence<OUString> aBoolean{ u"0"_ustr, u"1"_ustr };
- aDriverInfo.push_back(DriverPropertyInfo("CharSet", "CharSet of the database.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo("SuppressVersionColumns",
- "Display version columns (when available).", false,
- "0", aBoolean));
+ std::vector<DriverPropertyInfo> aDriverInfo{
+ { u"CharSet"_ustr, u"CharSet of the database."_ustr, false, {}, {} },
+ { u"SuppressVersionColumns"_ustr, u"Display version columns (when available)."_ustr, false,
+ u"0"_ustr, aBoolean }
+ };
const T_DRIVERTYPE eType = lcl_getDriverType(url);
if (eType == T_DRIVERTYPE::Jdbc)
{
- aDriverInfo.push_back(DriverPropertyInfo("JavaDriverClass", "The JDBC driver class name.",
- true, getJavaDriverClass(info),
- Sequence<OUString>()));
+ aDriverInfo.emplace_back("JavaDriverClass", "The JDBC driver class name.", true,
+ getJavaDriverClass(info), Sequence<OUString>());
}
else if (eType == T_DRIVERTYPE::Native)
{
- aDriverInfo.push_back(DriverPropertyInfo(
- "LocalSocket", "The file path of a socket to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo(
- "NamedPipe", "The name of a pipe to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
+ aDriverInfo.emplace_back("LocalSocket",
+ "The file path of a socket to connect to a local MySQL server.",
+ false, OUString(), Sequence<OUString>());
+ aDriverInfo.emplace_back("NamedPipe",
+ "The name of a pipe to connect to a local MySQL server.", false,
+ OUString(), Sequence<OUString>());
}
return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
@@ -324,7 +321,7 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co
checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
Reference<XTablesSupplier> xTab;
- auto pConnection = comphelper::getUnoTunnelImplementation<OMetaConnection>(connection);
+ auto pConnection = comphelper::getFromUnoTunnel<OMetaConnection>(connection);
if (pConnection)
{
TWeakPairVector::iterator i
@@ -380,7 +377,7 @@ ODriverDelegator::getDataDefinitionByURL(const OUString& url, const Sequence<Pro
OUString SAL_CALL ODriverDelegator::getImplementationName()
{
- return "org.openoffice.comp.drivers.MySQL.Driver";
+ return u"org.openoffice.comp.drivers.MySQL.Driver"_ustr;
}
sal_Bool SAL_CALL ODriverDelegator::supportsService(const OUString& _rServiceName)
@@ -390,7 +387,7 @@ sal_Bool SAL_CALL ODriverDelegator::supportsService(const OUString& _rServiceNam
Sequence<OUString> SAL_CALL ODriverDelegator::getSupportedServiceNames()
{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
+ return { u"com.sun.star.sdbc.Driver"_ustr, u"com.sun.star.sdbcx.Driver"_ustr };
}
} // namespace connectivity
diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
index 374825d32abb..dfb3e37a186f 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx
@@ -19,7 +19,6 @@
#include <mysql/YTable.hxx>
#include <mysql/YTables.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <comphelper/property.hxx>
@@ -49,7 +48,7 @@ namespace
class OMySQLKeysHelper : public OKeysHelper
{
protected:
- virtual OUString getDropForeignKey() const override { return " DROP FOREIGN KEY "; }
+ virtual OUString getDropForeignKey() const override { return u" DROP FOREIGN KEY "_ustr; }
public:
OMySQLKeysHelper(OTableHelper* _pTable, ::osl::Mutex& _rMutex,
@@ -117,21 +116,6 @@ sdbcx::OCollection* OMySQLTable::createIndexes(const ::std::vector<OUString>& _r
return new OIndexesHelper(this, m_aMutex, _rNames);
}
-Sequence<sal_Int8> OMySQLTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::lang::XUnoTunnel
-
-sal_Int64 OMySQLTable::getSomething(const Sequence<sal_Int8>& rId)
-{
- return (isUnoTunnelId<OMySQLTable>(rId)) ? reinterpret_cast<sal_Int64>(this)
- : OTable_TYPEDEF::getSomething(rId);
-}
-
// XAlterTable
void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
const Reference<XPropertySet>& descriptor)
@@ -198,9 +182,9 @@ void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
{
if (sTypeName.indexOf(s_sAutoIncrement) == -1)
{
- sTypeName += OUStringLiteral(u" ") + s_sAutoIncrement;
+ sTypeName += OUString::Concat(" ") + s_sAutoIncrement;
descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),
- makeAny(sTypeName));
+ Any(sTypeName));
}
}
else
@@ -212,7 +196,7 @@ void SAL_CALL OMySQLTable::alterColumnByName(const OUString& colName,
{
sTypeName = sTypeName.copy(0, nIndex);
descriptor->setPropertyValue(rProp.getNameByIndex(PROPERTY_ID_TYPENAME),
- makeAny(sTypeName));
+ Any(sTypeName));
}
}
}
@@ -268,18 +252,17 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType, const OUString& _rColName,
OUString sSql
= getAlterTableColumnPart() + " CHANGE " + ::dbtools::quoteName(sQuote, _rColName) + " ";
- OColumn* pColumn = new OColumn(true);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor, xProp);
- xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
- makeAny(nNewType));
+ rtl::Reference<OColumn> pColumn = new OColumn(true);
+ ::comphelper::copyProperties(_xDescriptor, pColumn);
+ pColumn->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),
+ Any(nNewType));
sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(
- xProp, getConnection(), static_cast<OTables*>(m_pTables), getTypeCreatePattern()));
+ pColumn, getConnection(), static_cast<OTables*>(m_pTables), getTypeCreatePattern()));
executeStatement(sSql);
}
-OUString OMySQLTable::getTypeCreatePattern() const { return "(M,D)"; }
+OUString OMySQLTable::getTypeCreatePattern() const { return u"(M,D)"_ustr; }
void OMySQLTable::alterDefaultValue(std::u16string_view _sNewDefault, const OUString& _rColName)
{
@@ -301,7 +284,7 @@ void OMySQLTable::dropDefaultValue(const OUString& _rColName)
OUString OMySQLTable::getAlterTableColumnPart() const
{
- OUString sSql("ALTER TABLE ");
+ OUString sSql(u"ALTER TABLE "_ustr);
OUString sComposedName(
::dbtools::composeTableName(getMetaData(), m_CatalogName, m_SchemaName, m_Name, true,
@@ -315,7 +298,7 @@ void OMySQLTable::executeStatement(const OUString& _rStatement)
{
OUString sSQL = _rStatement;
if (sSQL.endsWith(","))
- sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, ")");
+ sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, u")");
Reference<XStatement> xStmt = getConnection()->createStatement();
if (xStmt.is())
@@ -325,6 +308,6 @@ void OMySQLTable::executeStatement(const OUString& _rStatement)
}
}
-OUString OMySQLTable::getRenameStart() const { return "RENAME TABLE "; }
+OUString OMySQLTable::getRenameStart() const { return u"RENAME TABLE "_ustr; }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
index e21e05fb2914..8fd165b61654 100644
--- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx
@@ -37,7 +37,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbtools;
sdbcx::ObjectType OTables::createObject(const OUString& _rName)
@@ -46,10 +45,9 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable,
::dbtools::EComposeRule::InDataManipulation);
- Sequence<OUString> sTableTypes(3);
- sTableTypes[0] = "VIEW";
- sTableTypes[1] = "TABLE";
- sTableTypes[2] = "%"; // just to be sure to include anything else...
+ Sequence<OUString> sTableTypes{
+ u"VIEW"_ustr, u"TABLE"_ustr, u"%"_ustr
+ }; // this last one just to be sure to include anything else...
Any aCatalog;
if (!sCatalog.isEmpty())
@@ -67,10 +65,9 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName)
| Privilege::UPDATE | Privilege::INSERT
| Privilege::SELECT;
- OMySQLTable* pRet = new OMySQLTable(
- this, static_cast<OMySQLCatalog&>(m_rParent).getConnection(), sTable,
- xRow->getString(4), xRow->getString(5), sSchema, sCatalog, nPrivileges);
- xRet = pRet;
+ xRet = new OMySQLTable(this, static_cast<OMySQLCatalog&>(m_rParent).getConnection(),
+ sTable, xRow->getString(4), xRow->getString(5), sSchema,
+ sCatalog, nPrivileges);
}
::comphelper::disposeComponent(xResult);
}
@@ -113,7 +110,7 @@ void OTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
::dbtools::qualifiedNameComponents(m_xMetaData, _sElementName, sCatalog, sSchema, sTable,
::dbtools::EComposeRule::InDataManipulation);
- OUString aSql("DROP ");
+ OUString aSql(u"DROP "_ustr);
Reference<XPropertySet> xProp(xObject, UNO_QUERY);
bool bIsView = xProp.is()
@@ -155,7 +152,7 @@ OUString OTables::adjustSQL(const OUString& _sSql)
sal_Int32 nPos = nIndex + strlen(s_sUNSIGNED);
OUString sNewUnsigned(sSQL.copy(nPos, nParen - nPos + 1));
sSQL = sSQL.replaceAt(nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(),
- sNewUnsigned + s_sUNSIGNED);
+ rtl::Concat2View(sNewUnsigned + s_sUNSIGNED));
nIndex = sSQL.indexOf(s_sUNSIGNED, nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength());
}
return sSQL;
@@ -180,10 +177,10 @@ void OTables::appendNew(const OUString& _rsNewTable)
insertElement(_rsNewTable, nullptr);
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
- OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners);
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rsNewTable), Any(), Any());
+ OInterfaceIteratorHelper3 aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
+ aListenerLoop.next()->elementInserted(aEvent);
}
OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject)
diff --git a/connectivity/source/drivers/mysql_jdbc/YUser.cxx b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
index b683fe2b2757..6944aa7e4c3f 100644
--- a/connectivity/source/drivers/mysql_jdbc/YUser.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YUser.cxx
@@ -27,6 +27,7 @@
#include <TConnection.hxx>
#include <strings.hrc>
#include <comphelper/types.hxx>
+#include <utility>
using namespace connectivity;
using namespace connectivity::mysql;
@@ -37,17 +38,17 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-OMySQLUser::OMySQLUser(const css::uno::Reference<css::sdbc::XConnection>& _xConnection)
+OMySQLUser::OMySQLUser(css::uno::Reference<css::sdbc::XConnection> _xConnection)
: connectivity::sdbcx::OUser(true)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
{
construct();
}
-OMySQLUser::OMySQLUser(const css::uno::Reference<css::sdbc::XConnection>& _xConnection,
+OMySQLUser::OMySQLUser(css::uno::Reference<css::sdbc::XConnection> _xConnection,
const OUString& Name)
: connectivity::sdbcx::OUser(Name, true)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
{
construct();
}
@@ -116,7 +117,7 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I
Any aCatalog;
if (!sCatalog.isEmpty())
aCatalog <<= sCatalog;
- xRes = xMeta->getColumnPrivileges(aCatalog, sSchema, sTable, "%");
+ xRes = xMeta->getColumnPrivileges(aCatalog, sSchema, sTable, u"%"_ustr);
}
break;
}
diff --git a/connectivity/source/drivers/mysql_jdbc/YUsers.cxx b/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
index 17fc788179c1..73fa7069400a 100644
--- a/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YUsers.cxx
@@ -23,6 +23,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <TConnection.hxx>
+#include <utility>
using namespace ::comphelper;
using namespace connectivity;
@@ -30,15 +31,13 @@ using namespace connectivity::mysql;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
OUsers::OUsers(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
const ::std::vector<OUString>& _rVector,
- const css::uno::Reference<css::sdbc::XConnection>& _xConnection,
+ css::uno::Reference<css::sdbc::XConnection> _xConnection,
connectivity::sdbcx::IRefreshableUsers* _pParent)
: sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
- , m_xConnection(_xConnection)
+ , m_xConnection(std::move(_xConnection))
, m_pParent(_pParent)
{
}
@@ -50,17 +49,13 @@ sdbcx::ObjectType OUsers::createObject(const OUString& _rName)
void OUsers::impl_refresh() { m_pParent->refreshUsers(); }
-Reference<XPropertySet> OUsers::createDescriptor()
-{
- OUserExtend* pNew = new OUserExtend(m_xConnection);
- return pNew;
-}
+Reference<XPropertySet> OUsers::createDescriptor() { return new OUserExtend(m_xConnection); }
// XAppend
sdbcx::ObjectType OUsers::appendObject(const OUString& _rForName,
const Reference<XPropertySet>& descriptor)
{
- OUString aSql("GRANT USAGE ON * TO ");
+ OUString aSql(u"GRANT USAGE ON * TO "_ustr);
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString();
aSql += ::dbtools::quoteName(aQuote, _rForName) + " @\"%\" ";
OUString sPassword;
@@ -82,7 +77,7 @@ sdbcx::ObjectType OUsers::appendObject(const OUString& _rForName,
// XDrop
void OUsers::dropObject(sal_Int32 /*_nPos*/, const OUString& _sElementName)
{
- OUString aSql("DROP USER ");
+ OUString aSql(u"DROP USER "_ustr);
OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString();
aSql += ::dbtools::quoteName(aQuote, _sElementName);
diff --git a/connectivity/source/drivers/mysql_jdbc/YViews.cxx b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
index 4bdeca9596b3..4308d88c9949 100644
--- a/connectivity/source/drivers/mysql_jdbc/YViews.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YViews.cxx
@@ -32,10 +32,7 @@ using namespace connectivity;
using namespace connectivity::mysql;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbtools;
typedef connectivity::sdbcx::OCollection OCollection_TYPE;
@@ -59,7 +56,7 @@ void OViews::disposing()
Reference<XPropertySet> OViews::createDescriptor()
{
Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- connectivity::sdbcx::OView* pNew
+ rtl::Reference<connectivity::sdbcx::OView> pNew
= new connectivity::sdbcx::OView(true, xConnection->getMetaData());
return pNew;
}
@@ -83,7 +80,7 @@ void OViews::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
if (bIsNew)
return;
- OUString aSql("DROP VIEW");
+ OUString aSql(u"DROP VIEW"_ustr);
Reference<XPropertySet> xProp(xObject, UNO_QUERY);
aSql += ::dbtools::composeTableName(m_xMetaData, xProp,
@@ -106,7 +103,7 @@ void OViews::createView(const Reference<XPropertySet>& descriptor)
{
Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection();
- OUString aSql("CREATE VIEW ");
+ OUString aSql(u"CREATE VIEW "_ustr);
OUString sCommand;
aSql += ::dbtools::composeTableName(m_xMetaData, descriptor,