diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2012-11-01 14:19:14 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2012-11-02 10:54:12 +0100 |
commit | 10359585eb1fa338b686c288c1d3b3e0fe9fca66 (patch) | |
tree | 2ef2c81441026c718c258d19451f1d453e00eab3 /connectivity | |
parent | 20380f26b47faffe0cf541f46b8706439a5d4219 (diff) |
Columns should know their table
For example dbaccess::OSingleSelectQueryComposer::appendOrderByColumn expects it
(via impl_getColumnName_throw via getTableAlias)
There is some vagueness:
Should the TableName property contain just the table name,
or the *composed* table name
(that is with catalog and/or schema if used by this DB)?
In the case of a query, should it contain the table name (alias)
*in* *the* *query* or of the original table?
In the former case, what meaning do SchemaName and CatalogName have?
They should be empty?
For now, commit as such and deal with the fallout, if any,
when it hits the fan.
If we really need to store these *different* values,
(that is, some code validly needs them)
it would be easier / cleaner / ...
to define *different* properties
for these *different* notions.
Change-Id: I032e619a60e7563cd51478db16cb5e0e5452bfde
Diffstat (limited to 'connectivity')
23 files changed, 213 insertions, 109 deletions
diff --git a/connectivity/inc/connectivity/PColumn.hxx b/connectivity/inc/connectivity/PColumn.hxx index 9ac4eb5a272c..7da2c0691769 100644 --- a/connectivity/inc/connectivity/PColumn.hxx +++ b/connectivity/inc/connectivity/PColumn.hxx @@ -41,7 +41,6 @@ namespace connectivity public OParseColumn_BASE, public OParseColumn_PROP { ::rtl::OUString m_aRealName; - ::rtl::OUString m_aTableName; ::rtl::OUString m_sLabel; sal_Bool m_bFunction; sal_Bool m_bDbasePrecisionChanged; @@ -65,21 +64,24 @@ namespace connectivity sal_Int32 _Type, sal_Bool _IsAutoIncrement, sal_Bool _IsCurrency, - sal_Bool _bCase); + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName); virtual void construct(); void setRealName(const ::rtl::OUString& _rName) { m_aRealName = _rName; } void setLabel(const ::rtl::OUString& i_sLabel) { m_sLabel = i_sLabel; } - void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; } + void setTableName(const ::rtl::OUString& _rName) { m_TableName = _rName; } void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; } void setAggregateFunction(sal_Bool _bFunction) { m_bAggregateFunction = _bFunction; } void setIsSearchable( sal_Bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; } void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; } - ::rtl::OUString getRealName() const { return m_aRealName; } - ::rtl::OUString getLabel() const { return m_sLabel; } - ::rtl::OUString getTableName() const { return m_aTableName; } + const ::rtl::OUString& getRealName() const { return m_aRealName; } + const ::rtl::OUString& getLabel() const { return m_sLabel; } + const ::rtl::OUString& getTableName() const { return m_TableName; } sal_Bool getFunction() const { return m_bFunction; } sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; } @@ -118,7 +120,6 @@ namespace connectivity public OOrderColumn_BASE, public OOrderColumn_PROP { const sal_Bool m_bAscending; - const ::rtl::OUString m_sTableName; protected: virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; diff --git a/connectivity/inc/connectivity/sdbcx/VColumn.hxx b/connectivity/inc/connectivity/sdbcx/VColumn.hxx index c58e7cf2d81e..ca7a0bcc0b1c 100644 --- a/connectivity/inc/connectivity/sdbcx/VColumn.hxx +++ b/connectivity/inc/connectivity/sdbcx/VColumn.hxx @@ -63,6 +63,10 @@ namespace connectivity sal_Bool m_IsRowVersion; sal_Bool m_IsCurrency; + ::rtl::OUString m_CatalogName; + ::rtl::OUString m_SchemaName; + ::rtl::OUString m_TableName; + using OColumnDescriptor_BASE::rBHelper; virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); @@ -74,17 +78,20 @@ namespace connectivity OColumn( sal_Bool _bCase); OColumn( const ::rtl::OUString& _Name, - const ::rtl::OUString& _TypeName, - const ::rtl::OUString& _DefaultValue, - const ::rtl::OUString& _Description, - sal_Int32 _IsNullable, - sal_Int32 _Precision, - sal_Int32 _Scale, - sal_Int32 _Type, - sal_Bool _IsAutoIncrement, - sal_Bool _IsRowVersion, - sal_Bool _IsCurrency, - sal_Bool _bCase); + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + const ::rtl::OUString& _Description, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName); DECLARE_SERVICE_INFO(); //XInterface diff --git a/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx index d5c11c40b985..bdccd128f172 100644 --- a/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx +++ b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx @@ -50,7 +50,10 @@ namespace connectivity sal_Bool _IsAutoIncrement, sal_Bool _IsRowVersion, sal_Bool _IsCurrency, - sal_Bool _bCase); + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName); virtual void construct(); DECLARE_SERVICE_INFO(); diff --git a/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx index 92624b5caad6..b3624bd69a3a 100644 --- a/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx +++ b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx @@ -50,7 +50,10 @@ namespace connectivity sal_Bool _IsAutoIncrement, sal_Bool _IsRowVersion, sal_Bool _IsCurrency, - sal_Bool _bCase); + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName); // just to make it not inline virtual ~OKeyColumn(); diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx index 83bfe69746d1..ad725c4f1e64 100644 --- a/connectivity/source/commontools/TColumnsHelper.cxx +++ b/connectivity/source/commontools/TColumnsHelper.cxx @@ -115,6 +115,11 @@ sdbcx::ObjectType OColumnsHelper::createObject(const ::rtl::OUString& _rName) { nField11 = ColumnValue::NO_NULLS; } // if ( xKeys.is() ) + ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); + ::rtl::OUString aCatalog, aSchema, aTable; + m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) >>= aCatalog; + m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; + m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable; connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName, pColDesc->aField6, pColDesc->sField13, @@ -126,7 +131,10 @@ sdbcx::ObjectType OColumnsHelper::createObject(const ::rtl::OUString& _rName) bAutoIncrement, sal_False, bIsCurrency, - isCaseSensitive()); + isCaseSensitive(), + aCatalog, + aSchema, + aTable); xRet = pRet; } diff --git a/connectivity/source/commontools/TIndexColumns.cxx b/connectivity/source/commontools/TIndexColumns.cxx index 7edd3ea706df..c64e94bf1d14 100644 --- a/connectivity/source/commontools/TIndexColumns.cxx +++ b/connectivity/source/commontools/TIndexColumns.cxx @@ -47,8 +47,9 @@ OIndexColumns::OIndexColumns( OIndexHelper* _pIndex, sdbcx::ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName) { ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - ::rtl::OUString aSchema,aTable; + ::rtl::OUString aCatalog, aSchema, aTable; ::com::sun::star::uno::Any Catalog(m_pIndex->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME))); + Catalog >>= aCatalog; m_pIndex->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; m_pIndex->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable; @@ -93,7 +94,8 @@ sdbcx::ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName) nSize, nDec, nDataType, - sal_False,sal_False,sal_False,sal_True); + sal_False,sal_False,sal_False,sal_True, + aCatalog, aSchema, aTable); xRet = pRet; break; } diff --git a/connectivity/source/commontools/TKeyColumns.cxx b/connectivity/source/commontools/TKeyColumns.cxx index f9a9a223f82b..bb5a36a38f2a 100644 --- a/connectivity/source/commontools/TKeyColumns.cxx +++ b/connectivity/source/commontools/TKeyColumns.cxx @@ -48,13 +48,15 @@ OKeyColumnsHelper::OKeyColumnsHelper( OTableKeyHelper* _pKey, sdbcx::ObjectType OKeyColumnsHelper::createObject(const ::rtl::OUString& _rName) { ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - ::rtl::OUString aSchema,aTable; + ::rtl::OUString aCatalog, aSchema, aTable; + ::com::sun::star::uno::Any Catalog(m_pKey->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME))); + Catalog >>= aCatalog; m_pKey->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; m_pKey->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable; // frist get the related column to _rName Reference< XResultSet > xResult = m_pKey->getTable()->getMetaData()->getImportedKeys( - m_pKey->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)),aSchema,aTable); + Catalog, aSchema, aTable); ::rtl::OUString aRefColumnName; if ( xResult.is() ) @@ -75,8 +77,7 @@ sdbcx::ObjectType OKeyColumnsHelper::createObject(const ::rtl::OUString& _rName) sdbcx::ObjectType xRet; // now describe the column _rName and set his related column - xResult = m_pKey->getTable()->getMetaData()->getColumns( - m_pKey->getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)),aSchema,aTable,_rName); + xResult = m_pKey->getTable()->getMetaData()->getColumns(Catalog, aSchema, aTable, _rName); if ( xResult.is() ) { @@ -101,17 +102,20 @@ sdbcx::ObjectType OKeyColumnsHelper::createObject(const ::rtl::OUString& _rName) } OKeyColumn* pRet = new OKeyColumn(aRefColumnName, - _rName, - aTypeName, - sColumnDef, - nNull, - nSize, - nDec, - nDataType, - sal_False, - sal_False, - sal_False, - isCaseSensitive()); + _rName, + aTypeName, + sColumnDef, + nNull, + nSize, + nDec, + nDataType, + sal_False, + sal_False, + sal_False, + isCaseSensitive(), + aCatalog, + aSchema, + aTable); xRet = pRet; } } diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index bb832535cbfe..4092e9e185de 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -389,6 +389,8 @@ namespace Reference<XPropertySet> xProp; Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData(); Reference< XResultSet > xResult = xMetaData->getColumns(_aCatalog, _aSchema, _aTable, _rQueryName); + ::rtl::OUString sCatalog; + _aCatalog >>= sCatalog; if ( xResult.is() ) { @@ -472,7 +474,10 @@ namespace bAutoIncrement, sal_False, bIsCurrency, - _bCase); + _bCase, + sCatalog, + _aSchema, + _aTable); xProp = pRet; break; @@ -515,6 +520,8 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable Reference<XDatabaseMetaData> xMetaData = _xConnection->getMetaData(); Any aCatalog; aCatalog = _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)); + ::rtl::OUString sCatalog; + aCatalog >>= sCatalog; ::rtl::OUString aSchema, aTable; _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; @@ -536,7 +543,10 @@ Reference<XPropertySet> createSDBCXColumn(const Reference<XPropertySet>& _xTable _bIsAutoIncrement, sal_False, _bIsCurrency, - _bCase); + _bCase, + sCatalog, + aSchema, + aTable); } diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 4950de6fd7a7..f8f89601f21c 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -374,7 +374,10 @@ namespace dbtools nType, sal_False, sal_False, - xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()); + xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(), + ::rtl::OUString(), + ::rtl::OUString(), + ::rtl::OUString()); Reference<XPropertySet> xColumn = pColumn; pColumn->setFunction(sal_True); pColumn->setRealName(sField); diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index da8cbe573657..ff3c33319a48 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -514,7 +514,8 @@ void OCalcTable::fillColumns() sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(),::rtl::OUString(), ColumnValue::NULLABLE, nPrecision, nDecimals, eType, sal_False, sal_False, bCurrency, - bStoresMixedCaseQuotedIdentifiers); + bStoresMixedCaseQuotedIdentifiers, + m_CatalogName, getSchema(), getName()); Reference< XPropertySet> xCol = pColumn; m_aColumns->get().push_back(xCol); m_aTypes.push_back(eType); diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx index 1fbff248ee24..73aa3d525cda 100644 --- a/connectivity/source/drivers/dbase/DIndexColumns.cxx +++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx @@ -59,7 +59,10 @@ sdbcx::ObjectType ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName ,sal_False ,sal_False ,sal_False - ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); + ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers() + ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME))) + ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + ,getString(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME)))); return xRet; } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index f1bdb3237a94..499b238284cf 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -436,7 +436,8 @@ OSL_TRACE("column type: %c",aDBFColumn.db_typ); sal_False, bIsRowVersion, bIsCurrency, - bCase); + bCase, + m_CatalogName, getSchema(), getName()); m_aColumns->get().push_back(xCol); } // for (; i < nFieldCount; i++) OSL_ENSURE(i,"No columns in table!"); diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx index c4cae93cfcfe..b131bc36bb95 100644 --- a/connectivity/source/drivers/evoab2/NColumns.cxx +++ b/connectivity/source/drivers/evoab2/NColumns.cxx @@ -37,10 +37,14 @@ using namespace connectivity::evoab; // ------------------------------------------------------------------------- sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName) { + const Any aCatalog; + const ::rtl::OUString sCatalogName; + const ::rtl::OUString sSchemaName(m_pTable->getSchema()); + const ::rtl::OUString sTableName(m_pTable->getTableName()); Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns( - Any(), - m_pTable->getSchema(), - m_pTable->getTableName(), + aCatalog, + sSchemaName, + sTableName, _rName); sdbcx::ObjectType xRet = NULL; @@ -64,7 +68,10 @@ sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName) sal_False, sal_False, sal_False, - sal_True); + sal_True, + sCatalogName, + sSchemaName, + sTableName); xRet = pRet; break; } diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index f916b2ddd7bc..199c0acda4d3 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -37,9 +37,12 @@ using namespace ::com::sun::star::lang; sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) { - + const Any aCatalog; + const ::rtl::OUString sCatalogName; + const ::rtl::OUString sSchemaName(m_pTable->getSchema()); + const ::rtl::OUString sTableName(m_pTable->getName()); Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), - m_pTable->getSchema(),m_pTable->getName(),_rName); + sSchemaName, sTableName, _rName); sdbcx::ObjectType xRet = NULL; if(xResult.is()) @@ -60,7 +63,10 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) sal_False, sal_False, sal_False, - m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); + m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(), + sCatalogName, + sSchemaName, + sTableName); xRet = pRet; break; } diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 0d810fcc2b32..f99cf3c959b6 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -506,7 +506,10 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re ,eType ,sal_False ,sal_False - ,m_aSQLIterator.isCaseSensitive()); + ,m_aSQLIterator.isCaseSensitive() + ,::rtl::OUString() + ,::rtl::OUString() + ,::rtl::OUString()); m_xParamColumns->get().push_back(xParaColumn); return m_xParamColumns->get().size(); } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 14732280c6af..110f40195be4 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -171,7 +171,8 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) sal_False, sal_False, sal_False, - bCase); + bCase, + m_CatalogName, getSchema(), getName()); Reference< XPropertySet> xCol = pColumn; m_aColumns->get().push_back(xCol); } diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx index f6fb6e217942..786280cbbe5e 100644 --- a/connectivity/source/drivers/mozab/MColumns.cxx +++ b/connectivity/source/drivers/mozab/MColumns.cxx @@ -43,8 +43,12 @@ using namespace ::com::sun::star::lang; sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) { - Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), - m_pTable->getSchema(),m_pTable->getTableName(),_rName); + const Any aCatalog; + const ::rtl::OUString sCatalogName; + const ::rtl::OUString sSchemaName(m_pTable->getSchema()); + const ::rtl::OUString sTableName(m_pTable->getTableName()); + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns( + aCatalog, sSchemaName, sTableName, _rName); sdbcx::ObjectType xRet = NULL; if(xResult.is()) @@ -66,7 +70,10 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) nPrec, xRow->getInt(9), nType, - sal_False,sal_False,sal_False,sal_True); + sal_False,sal_False,sal_False,sal_True, + sCatalogName, + sSchemaName, + sTableName); xRet = pRet; break; } diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 9a650effd215..971749d03cc0 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -443,7 +443,10 @@ size_t OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Refere ,sal_False ,sal_False ,sal_False - ,m_pSQLIterator->isCaseSensitive()); + ,m_pSQLIterator->isCaseSensitive() + ,::rtl::OUString() + ,::rtl::OUString() + ,::rtl::OUString()); m_xParamColumns->get().push_back(xParaColumn); return nParameter; } diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index f9523c98fcac..1eebf8484da6 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -25,6 +25,8 @@ #include <comphelper/types.hxx> #include <tools/diagnose_ex.h> +#include <bitset> + using namespace ::comphelper; using namespace connectivity; using namespace dbtools; @@ -48,6 +50,9 @@ OParseColumn::OParseColumn(const Reference<XPropertySet>& _xColumn,sal_Bool , sal_False , getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))) , _bCase + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))) ) , m_bFunction(sal_False) , m_bDbasePrecisionChanged(sal_False) @@ -68,7 +73,10 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, sal_Int32 _Type, sal_Bool _IsAutoIncrement, sal_Bool _IsCurrency, - sal_Bool _bCase + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName ) : connectivity::sdbcx::OColumn(_Name, _TypeName, _DefaultValue, @@ -80,7 +88,10 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, _IsAutoIncrement, sal_False, _IsCurrency, - _bCase) + _bCase, + _CatalogName, + _SchemaName, + _TableName) , m_bFunction(sal_False) , m_bDbasePrecisionChanged(sal_False) , m_bAggregateFunction(sal_False) @@ -116,7 +127,7 @@ OParseColumn::OParseColumn( const ::rtl::OUString& _Name, // ------------------------------------------------------------------------- OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSetMetaData >& _rxResMetaData, - const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos,StringMap& _rColumns ) + const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos, StringMap& _rColumns ) { ::rtl::OUString sLabel = _rxResMetaData->getColumnLabel( _nColumnPos ); // retrieve the name of the column @@ -143,17 +154,11 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe _rxResMetaData->getColumnType( _nColumnPos ), _rxResMetaData->isAutoIncrement( _nColumnPos ), _rxResMetaData->isCurrency( _nColumnPos ), - _rxDBMetaData->supportsMixedCaseQuotedIdentifiers() + _rxDBMetaData->supportsMixedCaseQuotedIdentifiers(), + _rxResMetaData->getCatalogName( _nColumnPos ), + _rxResMetaData->getSchemaName( _nColumnPos ), + _rxResMetaData->getTableName( _nColumnPos ) ); - const ::rtl::OUString sTableName = _rxResMetaData->getTableName( _nColumnPos ); - if ( !sTableName.isEmpty() ) - pColumn->setTableName( ::dbtools::composeTableName( _rxDBMetaData, - _rxResMetaData->getCatalogName( _nColumnPos ), - _rxResMetaData->getSchemaName( _nColumnPos ), - sTableName, - sal_False, - eComplete - ) ); pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) ); pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos )); pColumn->setLabel(sLabel); @@ -169,7 +174,6 @@ void OParseColumn::construct() { registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION), PROPERTY_ID_FUNCTION, 0, &m_bFunction, ::getCppuType(static_cast< sal_Bool*>(0))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AGGREGATEFUNCTION), PROPERTY_ID_AGGREGATEFUNCTION, 0, &m_bAggregateFunction, ::getCppuType(static_cast< sal_Bool*>(0))); - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME), PROPERTY_ID_TABLENAME, 0, &m_aTableName, ::getCppuType(static_cast< ::rtl::OUString*>(0))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME), PROPERTY_ID_REALNAME, 0, &m_aRealName, ::getCppuType(static_cast< ::rtl::OUString*>(0))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DBASEPRECISIONCHANGED), PROPERTY_ID_DBASEPRECISIONCHANGED, 0, &m_bDbasePrecisionChanged, ::getCppuType(static_cast<sal_Bool*>(0))); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISSEARCHABLE), PROPERTY_ID_ISSEARCHABLE, 0, &m_bIsSearchable, ::getCppuType(static_cast< sal_Bool*>(0))); @@ -188,24 +192,6 @@ void OParseColumn::construct() } // ----------------------------------------------------------------------------- -namespace -{ - ::rtl::OUString lcl_getColumnTableName( const Reference< XPropertySet >& i_parseColumn ) - { - ::rtl::OUString sColumnTableName; - try - { - OSL_VERIFY( i_parseColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TABLENAME ) ) >>= sColumnTableName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return sColumnTableName; - } -} - -// ----------------------------------------------------------------------------- OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn, const ::rtl::OUString& i_rOriginatingTableName, sal_Bool _bCase, sal_Bool _bAscending ) : connectivity::sdbcx::OColumn( @@ -220,12 +206,17 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn, const ::rtl getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))), sal_False, getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))), - _bCase + _bCase, + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))), + i_rOriginatingTableName ) ,m_bAscending(_bAscending) - ,m_sTableName( i_rOriginatingTableName ) { construct(); + OSL_ENSURE( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))).isEmpty() || + i_rOriginatingTableName == getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME)) ), + "dbaccess::OOrderColumn::OOrderColumn: forced originating table name != underlying column table name" ); } // ----------------------------------------------------------------------------- @@ -242,10 +233,12 @@ OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn, sal_Bool _b getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))), sal_False, getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))), - _bCase + _bCase, + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME))) ) ,m_bAscending(_bAscending) - ,m_sTableName( lcl_getColumnTableName( _xColumn ) ) { construct(); } @@ -260,8 +253,6 @@ void OOrderColumn::construct() { registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, PropertyAttribute::READONLY, const_cast< sal_Bool* >( &m_bAscending ), ::getCppuType( static_cast< sal_Bool* >( 0 ) ) ); - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME), PROPERTY_ID_TABLENAME, - PropertyAttribute::READONLY, const_cast< ::rtl::OUString* >( &m_sTableName ), ::getCppuType(static_cast< ::rtl::OUString*>(0))); } // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OOrderColumn::createArrayHelper() const diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 5ee583e15605..7d91655b6394 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -899,7 +899,8 @@ void OSQLParseTreeIterator::traverseCreateColumns(const OSQLParseNode* pSelectNo { //TODO:Create a new class for create statement to handle field length OParseColumn* pColumn = new OParseColumn(aColumnName,aTypeName,::rtl::OUString(),::rtl::OUString(), - ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive()); + ColumnValue::NULLABLE_UNKNOWN,0,0,nType,sal_False,sal_False,isCaseSensitive(), + ::rtl::OUString(),::rtl::OUString(),::rtl::OUString()); pColumn->setFunction(sal_False); pColumn->setRealName(aColumnName); @@ -1500,7 +1501,10 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode nType, sal_False, sal_False, - isCaseSensitive()); + isCaseSensitive(), + ::rtl::OUString(), + ::rtl::OUString(), + ::rtl::OUString()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(sal_True); pColumn->setRealName(sFunctionName); @@ -1564,7 +1568,10 @@ void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode nType, sal_False, sal_False, - isCaseSensitive() ); + isCaseSensitive(), + ::rtl::OUString(), + ::rtl::OUString(), + ::rtl::OUString()); pColumn->setName(aNewColName); pColumn->setRealName(sParameterName); m_aParameters->get().push_back(pColumn); @@ -1707,7 +1714,10 @@ void OSQLParseTreeIterator::appendColumns(::rtl::Reference<OSQLColumns>& _rColum , getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) , getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))) , getBOOL(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))) - , isCaseSensitive() ); + , isCaseSensitive() + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME))) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME))) + , getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME)))); pColumn->setTableName(_rTableAlias); pColumn->setRealName(*pBegin); @@ -1785,7 +1795,10 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ _nType, sal_False, sal_False, - isCaseSensitive() + isCaseSensitive(), + ::rtl::OUString(), + ::rtl::OUString(), + ::rtl::OUString() ); xNewColumn = pColumn; @@ -1799,7 +1812,8 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), - ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); + ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive(), + ::rtl::OUString(),::rtl::OUString(),::rtl::OUString()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); pColumn->setRealName(rColumnName); @@ -1820,7 +1834,8 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), - ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive()); + ColumnValue::NULLABLE_UNKNOWN,0,0,_nType,sal_False,sal_False,isCaseSensitive(), + ::rtl::OUString(),::rtl::OUString(),::rtl::OUString()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); pColumn->setRealName(rColumnName); @@ -1857,7 +1872,8 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(),::rtl::OUString(), - ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive()); + ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,isCaseSensitive(), + ::rtl::OUString(),::rtl::OUString(),::rtl::OUString()); pColumn->setFunction(sal_True); pColumn->setAggregateFunction(bAggFkt); diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx index f8cae2530774..8de64c8ff189 100644 --- a/connectivity/source/sdbcx/VColumn.cxx +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -87,7 +87,10 @@ OColumn::OColumn( const ::rtl::OUString& _Name, sal_Bool _IsAutoIncrement, sal_Bool _IsRowVersion, sal_Bool _IsCurrency, - sal_Bool _bCase) + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName) :OColumnDescriptor_BASE(m_aMutex) ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase) ,m_TypeName(_TypeName) @@ -100,6 +103,9 @@ OColumn::OColumn( const ::rtl::OUString& _Name, ,m_IsAutoIncrement(_IsAutoIncrement) ,m_IsRowVersion(_IsRowVersion) ,m_IsCurrency(_IsCurrency) + ,m_CatalogName(_CatalogName) + ,m_SchemaName(_SchemaName) + ,m_TableName(_TableName) { m_Name = _Name; @@ -167,6 +173,9 @@ void OColumn::construct() registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT), PROPERTY_ID_ISAUTOINCREMENT, nAttrib, &m_IsAutoIncrement, ::getBooleanCppuType()); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISROWVERSION), PROPERTY_ID_ISROWVERSION, nAttrib, &m_IsRowVersion, ::getBooleanCppuType()); registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY), PROPERTY_ID_ISCURRENCY, nAttrib, &m_IsCurrency, ::getBooleanCppuType()); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME), PROPERTY_ID_CATALOGNAME, nAttrib, &m_CatalogName, ::getCppuType(&m_CatalogName)); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME), PROPERTY_ID_SCHEMANAME, nAttrib, &m_SchemaName, ::getCppuType(&m_SchemaName)); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME), PROPERTY_ID_TABLENAME, nAttrib, &m_TableName, ::getCppuType(&m_TableName)); } // ------------------------------------------------------------------------- void OColumn::disposing(void) @@ -195,7 +204,10 @@ Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( ) throw(Runti m_IsAutoIncrement, m_IsRowVersion, m_IsCurrency, - isCaseSensitive()); + isCaseSensitive(), + m_CatalogName, + m_SchemaName, + m_TableName); pNewColumn->setNew(sal_True); return pNewColumn; } diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index be5fd014ff72..15a20a2dec59 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -71,7 +71,10 @@ OIndexColumn::OIndexColumn( sal_Bool _IsAscending, sal_Bool _IsAutoIncrement, sal_Bool _IsRowVersion, sal_Bool _IsCurrency, - sal_Bool _bCase + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName ) : OColumn(_Name, _TypeName, _DefaultValue, @@ -83,7 +86,10 @@ OIndexColumn::OIndexColumn( sal_Bool _IsAscending, _IsAutoIncrement, _IsRowVersion, _IsCurrency, - _bCase) + _bCase, + _CatalogName, + _SchemaName, + _TableName) , m_IsAscending(_IsAscending) { construct(); diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index edb052277d2b..48e1df5154f3 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -71,7 +71,10 @@ OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, sal_Bool _IsAutoIncrement, sal_Bool _IsRowVersion, sal_Bool _IsCurrency, - sal_Bool _bCase + sal_Bool _bCase, + const ::rtl::OUString& _CatalogName, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _TableName ) : OColumn(_Name, _TypeName, _DefaultValue, @@ -83,7 +86,10 @@ OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, _IsAutoIncrement, _IsRowVersion, _IsCurrency, - _bCase) + _bCase, + _CatalogName, + _SchemaName, + _TableName) , m_ReferencedColumn(_ReferencedColumn) { construct(); |