summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/tabledesign/TableController.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/tabledesign/TableController.cxx')
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx33
1 files changed, 15 insertions, 18 deletions
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 17ad5ed2f28d..fd53297cad00 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -50,9 +50,10 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <o3tl/string_view.hxx>
#include <algorithm>
#include <functional>
@@ -314,9 +315,9 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
xTable = xFact->createDataDescriptor();
OSL_ENSURE(xTable.is(),"OTableController::doSaveDoc: Create query failed!");
// to set the name is only allowed when the query is new
- xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xTable->setPropertyValue(PROPERTY_NAME,makeAny(m_sName));
+ xTable->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xTable->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xTable->setPropertyValue(PROPERTY_NAME,Any(m_sName));
// now append the columns
Reference<XColumnsSupplier> xColSup(xTable,UNO_QUERY);
@@ -662,7 +663,7 @@ void OTableController::appendColumns(Reference<XColumnsSupplier> const & _rxColS
if(!_bKeyColumns)
::dbaui::setColumnProperties(xColumn,pField);
else
- xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
+ xColumn->setPropertyValue(PROPERTY_NAME,Any(pField->GetName()));
xAppend->appendByDescriptor(xColumn);
xColumn = nullptr;
@@ -721,7 +722,7 @@ void OTableController::appendPrimaryKey(Reference<XKeysSupplier> const & _rxSup,
Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
OSL_ENSURE(xKey.is(),"Key is null!");
- xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::PRIMARY));
+ xKey->setPropertyValue(PROPERTY_TYPE,Any(KeyType::PRIMARY));
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
if(xColSup.is())
@@ -902,15 +903,15 @@ bool OTableController::checkColumns(bool _bNew)
{
case RET_YES:
{
- auto pNewRow = std::make_shared<OTableRow>();
TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
if ( !pTypeInfo )
break;
+ auto pNewRow = std::make_shared<OTableRow>();
pNewRow->SetFieldType( pTypeInfo );
OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
- pActFieldDescr->SetAutoIncrement(false);
+ pActFieldDescr->SetAutoIncrement(pTypeInfo->bAutoIncrement);
pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
pActFieldDescr->SetName( createUniqueName("ID" ));
@@ -1120,14 +1121,14 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetHelpText()));
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,Any(pField->GetHelpText()));
if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+ xColumn->setPropertyValue(PROPERTY_FORMATKEY,Any(pField->GetFormatKey()));
if(xInfo->hasPropertyByName(PROPERTY_ALIGN))
- xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAlign(pField->GetHorJustify())));
+ xColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(pField->GetHorJustify())));
}
}
// second drop all columns which could be found by name
@@ -1163,15 +1164,11 @@ void OTableController::alterColumns()
}
catch (const SQLException&)
{
+ const auto caughtException = ::cppu::getCaughtException();
OUString sError( DBA_RES( STR_TABLEDESIGN_COULD_NOT_DROP_COL ) );
sError = sError.replaceFirst( "$column$", rColumnName );
- SQLException aNewException;
- aNewException.Message = sError;
- aNewException.SQLState = "S1000";
- aNewException.NextException = ::cppu::getCaughtException();
-
- throw aNewException;
+ throw SQLException(sError, {}, "S1000", 0, caughtException);
}
}
}
@@ -1443,7 +1440,7 @@ OUString OTableController::getPrivateTitle() const
if ( sTitle.isEmpty() )
{
OUString aName = DBA_RES(STR_TBL_TITLE);
- sTitle = aName.getToken(0,' ') + OUString::number(getCurrentStartNumber());
+ sTitle = o3tl::getToken(aName,0,' ') + OUString::number(getCurrentStartNumber());
}
}
catch( const Exception& )