summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/TColumnsHelper.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-09-08 09:50:48 +0000
committerOliver Bolte <obo@openoffice.org>2009-09-08 09:50:48 +0000
commit2dca9f97c600b3ab22155ba24390e3654fa8ff66 (patch)
treeded290eaf4b7a4797212e43f0712c86c6984139e /connectivity/source/commontools/TColumnsHelper.cxx
parent47b189a5b78253040718e509989c4637743bee9a (diff)
CWS-TOOLING: integrate CWS dbaperf3
2009-08-28 08:04:41 +0200 oj r275515 : wrong replacement 2009-08-28 07:57:44 +0200 oj r275514 : declaration of 'nRealSize' shadows a previous local 2009-08-20 10:17:11 +0200 oj r275168 : CWS-TOOLING: rebase CWS dbaperf3 to trunk@275001 (milestone: DEV300:m55) 2009-08-19 11:50:49 +0200 oj r275145 : #ii102891# minimize metadata calls 2009-06-22 12:20:15 +0200 oj r273213 : compile error 2009-06-22 12:19:45 +0200 oj r273212 : compile error 2009-06-18 08:54:08 +0200 oj r273099 : #i102891# reduce calls to databasemetadata 2009-06-18 08:19:55 +0200 oj r273095 : #i102891# reduce calls to databasemetadata
Diffstat (limited to 'connectivity/source/commontools/TColumnsHelper.cxx')
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx73
1 files changed, 63 insertions, 10 deletions
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index 97dfbb42c3..032d859575 100644
--- a/connectivity/source/commontools/TColumnsHelper.cxx
+++ b/connectivity/source/commontools/TColumnsHelper.cxx
@@ -37,6 +37,9 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
#include <comphelper/types.hxx>
#include "connectivity/dbtools.hxx"
#include "TConnection.hxx"
@@ -51,7 +54,7 @@ using namespace connectivity;
using namespace dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-// using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
@@ -114,17 +117,67 @@ sdbcx::ObjectType OColumnsHelper::createObject(const ::rtl::OUString& _rName)
bAutoIncrement = aFind->second.first.first;
bIsCurrency = aFind->second.first.second;
nDataType = aFind->second.second;
+ } // if ( aFind != m_pImpl->m_aColumnInfo.end() )
+
+ sdbcx::ObjectType xRet;
+ const ColumnDesc* pColDesc = m_pTable->getColumnDescription(_rName);
+ if ( pColDesc )
+ {
+ Reference<XPropertySet> xPr = m_pTable;
+ Reference<XKeysSupplier> xKeysSup(xPr,UNO_QUERY);
+ Reference<XNameAccess> xPrimaryKeyColumns;
+ if ( xKeysSup.is() )
+ {
+ const Reference<XIndexAccess> xKeys = xKeysSup->getKeys();
+ if ( xKeys.is() )
+ {
+ ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
+ const sal_Int32 nKeyCount = xKeys->getCount();
+ for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++nKeyIter)
+ {
+ const Reference<XPropertySet> xKey(xKeys->getByIndex(nKeyIter),UNO_QUERY_THROW);
+ sal_Int32 nType = 0;
+ xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nType;
+ if ( nType == KeyType::PRIMARY )
+ {
+ const Reference<XColumnsSupplier> xColS(xKey,UNO_QUERY_THROW);
+ xPrimaryKeyColumns = xColS->getColumns();
+ break;
+ }
+ } // for(sal_Int32 nKeyIter = 0; nKeyIter < nKeyCount;++)
+ }
+ }
+ sal_Int32 nField11 = pColDesc->nField11;
+ if ( nField11 != ColumnValue::NO_NULLS && xPrimaryKeyColumns.is() && xPrimaryKeyColumns->hasByName(_rName) )
+ {
+ nField11 = ColumnValue::NO_NULLS;
+ } // if ( xKeys.is() )
+ connectivity::sdbcx::OColumn* pRet = new connectivity::sdbcx::OColumn(_rName,
+ pColDesc->aField6,
+ pColDesc->sField13,
+ nField11,
+ pColDesc->nField7,
+ pColDesc->nField9,
+ pColDesc->nField5,
+ bAutoIncrement,
+ sal_False,
+ bIsCurrency,
+ isCaseSensitive());
+
+ xRet = pRet;
}
-
+ else
+ {
- sdbcx::ObjectType xRet(::dbtools::createSDBCXColumn( m_pTable,
- xConnection,
- _rName,
- isCaseSensitive(),
- bQueryInfo,
- bAutoIncrement,
- bIsCurrency,
- nDataType),UNO_QUERY);
+ xRet.set(::dbtools::createSDBCXColumn( m_pTable,
+ xConnection,
+ _rName,
+ isCaseSensitive(),
+ bQueryInfo,
+ bAutoIncrement,
+ bIsCurrency,
+ nDataType),UNO_QUERY);
+ }
return xRet;
}