tdf#162339: MariaDB: Table with spaces in table name couldn't be deleted by GUI

Use ::dbtools::qualifiedNameComponents to retrieve elements of table name (catalog/schema/table)
Use ::dbtools::composeTableName to compose the full table name

Change-Id: Ia6ebc1a46a4222315e43909356fb8c1d36990419
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171457
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet 2024-08-04 10:21:40 +02:00
parent 5850b22e04
commit bf2c4cead1

View file

@ -151,7 +151,14 @@ void connectivity::mysqlc::Tables::dropObject(sal_Int32 nPosition, const OUStrin
OUString sType;
xTable->getPropertyValue(u"Type"_ustr) >>= sType;
m_xMetaData->getConnection()->createStatement()->execute("DROP " + sType + " " + sName);
OUString sCatalog, sSchema, sTable;
::dbtools::qualifiedNameComponents(m_xMetaData, sName, sCatalog, sSchema, sTable,
::dbtools::EComposeRule::InDataManipulation);
OUString sComposedName(::dbtools::composeTableName(
m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation));
m_xMetaData->getConnection()->createStatement()->execute("DROP " + sType + " " + sComposedName);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */