/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
css::uno::Reference< css::beans::XPropertySet > Tables::createObject(const OUString& rName)
{ // Only retrieving a single table, so table type is irrelevant (param 4)
uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
OUString(),
rName,
uno::Sequence< OUString >());
if (!xTables.is()) throw RuntimeException(u"Could not acquire table."_ustr);
// check if the user enter a specific string to create autoincrement values
OUString sAutoIncrementValue;
Reference<XPropertySetInfo> xPropInfo = xColProp->getPropertySetInfo();
if ( xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) )
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION)) >>= sAutoIncrementValue;
aSql.append(" "
+ dbtools::createStandardTypePart(xColProp, _xConnection)); // Add character set for (VAR)BINARY (fix) types: // (VAR) BINARY is distinguished from other CHAR types by its character set. // Octets is a special character set for binary data. if ( xPropInfo.is() && xPropInfo->hasPropertyByName(rPropMap.getNameByIndex(
PROPERTY_ID_TYPE)) )
{
sal_Int32 aType = 0;
xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))
>>= aType; if(aType == DataType::BINARY || aType == DataType::VARBINARY)
{
aSql.append(" CHARACTER SET OCTETS");
}
}
if ( bIsAutoIncrement && !sAutoIncrementValue.isEmpty())
{
aSql.append(" " + sAutoIncrementValue);
} // AutoIncrement "IDENTITY" is implicitly "NOT NULL" elseif(::comphelper::getINT32(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
aSql.append(" NOT NULL");
return aSql.makeStringAndClear();
}
uno::Reference< XPropertySet > Tables::createDescriptor()
{ // There is some internal magic so that the same class can be used as either // a descriptor or as a normal table. See VTable.cxx for the details. In our // case we just need to ensure we use the correct constructor. returnnew Table(this, m_rMutex, m_xMetaData->getConnection());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.