summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-11-09 06:05:38 +0000
committerOcke Janssen <oj@openoffice.org>2001-11-09 06:05:38 +0000
commit30c616da2b5d0e0ee32bc4b8e87540257b24dbd6 (patch)
tree92318a5c7ffb0f72581e28e571f7c46dbcb9415f /connectivity/source/drivers
parent538702315171ec91ae6da4effccc7e2c7dbf0ce4 (diff)
#94371# primary key fixes
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r--connectivity/source/drivers/ado/AColumns.cxx46
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx5
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx26
-rw-r--r--connectivity/source/drivers/ado/AGroups.cxx22
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx26
-rw-r--r--connectivity/source/drivers/ado/AIndexes.cxx38
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx26
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx72
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx5
-rw-r--r--connectivity/source/drivers/ado/ATable.cxx108
-rw-r--r--connectivity/source/drivers/ado/ATables.cxx46
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx37
-rw-r--r--connectivity/source/drivers/ado/AUsers.cxx28
-rw-r--r--connectivity/source/drivers/ado/AViews.cxx37
14 files changed, 183 insertions, 339 deletions
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index 862cd52ce291..6d4818b21e71 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AColumns.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,29 +86,28 @@
#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
using namespace connectivity::ado;
using namespace connectivity;
+using namespace comphelper;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName)
{
- ADOColumn* pColumn = NULL;
- m_pCollection->get_Item(OLEVariant(_rName),&pColumn);
-
- return new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn);
+ return new OAdoColumn(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
// -------------------------------------------------------------------------
void OColumns::impl_refresh() throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OColumns::createEmptyObject()
@@ -119,36 +118,29 @@ Reference< XPropertySet > OColumns::createEmptyObject()
// XAppend
void OColumns::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OAdoColumn* pColumn = NULL;
+ if(getImplementation(pColumn,descriptor) && pColumn != NULL)
{
- OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn::getUnoTunnelImplementationId());
- if(pColumn)
- {
- WpADOColumn aColumn = pColumn->getColumnImpl();
- m_pCollection->Append(OLEVariant(aColumn));
+ if(!m_aCollection.Append(pColumn->getColumnImpl()))
ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
// -------------------------------------------------------------------------
// XDrop
void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ if(!m_aCollection.Delete(_sElementName))
+ ADOS::ThrowException(*m_pConnection->getConnection(),*this);
}
// -----------------------------------------------------------------------------
Reference< XNamed > OColumns::cloneObject(const Reference< XPropertySet >& _xDescriptor)
{
- OAdoColumn* pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection);
- Reference<XPropertySet> xProp = pColumn;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- Reference< XNamed > xName(xProp,UNO_QUERY);
- OSL_ENSURE(xName.is(),"Must be a XName interface here !");
- return xName;
+ OAdoColumn* pColumn = NULL;
+ if(getImplementation(pColumn,_xDescriptor) && pColumn != NULL)
+ return new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn->getColumnImpl());
+ return Reference< XNamed >();
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
index 93d66b14ce3a..4e9175460f92 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ADatabaseMetaDataResultSetMetaData.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-07-30 09:11:52 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,7 @@
#include "connectivity/dbexception.hxx"
#endif
+
using namespace connectivity;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
index 668ce6e1a56d..9b52a99af406 100644
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ b/connectivity/source/drivers/ado/AGroup.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AGroup.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -131,29 +131,13 @@ void OAdoGroup::refreshUsers()
{
TStringVector aVector;
- ADOUsers* pUsers = m_aGroup.get_Users();
- if(pUsers)
- {
- pUsers->Refresh();
-
- sal_Int32 nCount = 0;
- pUsers->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOUser* pUser = NULL;
- pUsers->get_Item(OLEVariant(i),&pUser);
- if(pUser)
- {
- WpADOUser aUser(pUser);
- aVector.push_back(aUser.get_Name());
- }
- }
- }
+ WpADOUsers aUsers = m_aGroup.get_Users();
+ aUsers.fillElementNames(aVector);
if(m_pUsers)
m_pUsers->reFill(aVector);
else
- m_pUsers = new OUsers(m_pCatalog,m_aMutex,aVector,pUsers,isCaseSensitive());
+ m_pUsers = new OUsers(m_pCatalog,m_aMutex,aVector,aUsers,isCaseSensitive());
}
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx
index 47db6741f82b..bfb7b13226e2 100644
--- a/connectivity/source/drivers/ado/AGroups.cxx
+++ b/connectivity/source/drivers/ado/AGroups.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AGroups.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,8 +80,11 @@
#ifndef CONNECTIVITY_CONNECTION_HXX
#include "TConnection.hxx"
#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
-
+using namespace comphelper;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -98,7 +101,7 @@ Reference< XNamed > OGroups::createObject(const ::rtl::OUString& _rName)
// -------------------------------------------------------------------------
void OGroups::impl_refresh() throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OGroups::createEmptyObject()
@@ -109,18 +112,15 @@ Reference< XPropertySet > OGroups::createEmptyObject()
// XAppend
void OGroups::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- OAdoGroup* pGroup = (OAdoGroup*)xTunnel->getSomething(OAdoGroup::getUnoTunnelImplementationId());
- m_pCollection->Append(OLEVariant(pGroup->getImpl()));
- }
+ OAdoGroup* pGroup = NULL;
+ if(getImplementation(pGroup,descriptor) && pGroup != NULL)
+ m_aCollection.Append(pGroup->getImpl());
}
// -------------------------------------------------------------------------
// XDrop
void OGroups::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
+ m_aCollection.Delete(_sElementName);
}
// -----------------------------------------------------------------------------
Reference< XNamed > OGroups::cloneObject(const Reference< XPropertySet >& _xDescriptor)
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
index 1191f8f8c104..19ac91e3af10 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndex.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -119,28 +119,12 @@ void OAdoIndex::refreshColumns()
{
TStringVector aVector;
- ADOColumns* pColumns = m_aIndex.get_Columns();
- if(pColumns)
- {
- pColumns->Refresh();
-
- sal_Int32 nCount = 0;
- pColumns->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOColumn* pColumn = NULL;
- pColumns->get_Item(OLEVariant(i),&pColumn);
- if(pColumn)
- {
- WpADOColumn aColumn(pColumn);
- aVector.push_back(aColumn.get_Name());
- }
- }
- }
+ WpADOColumns aColumns = m_aIndex.get_Columns();
+ aColumns.fillElementNames(aVector);
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pConnection);
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx
index af040ba934fa..87299a51bdaf 100644
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ b/connectivity/source/drivers/ado/AIndexes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndexes.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,19 +91,14 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
Reference< XNamed > OIndexes::createObject(const ::rtl::OUString& _rName)
{
- ADOIndex* pIndex = NULL;
- m_pCollection->get_Item(OLEVariant(_rName),&pIndex);
-
- return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex);
+ return new OAdoIndex(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
// -------------------------------------------------------------------------
void OIndexes::impl_refresh() throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OIndexes::createEmptyObject()
@@ -114,29 +109,30 @@ Reference< XPropertySet > OIndexes::createEmptyObject()
// XAppend
void OIndexes::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OAdoIndex* pIndex = NULL;
+ sal_Bool bError = sal_True;
+ if(getImplementation(pIndex,descriptor) && pIndex != NULL)
{
- OAdoIndex* pIndex = (OAdoIndex*)xTunnel->getSomething(OAdoIndex:: getUnoTunnelImplementationId());
- if(pIndex)
- m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))),
- OLEVariant(pIndex->getImpl()));
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
+ ADOIndexes* pIndexes = m_aCollection;
+ bError = FAILED(pIndexes->Append(OLEVariant(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))),
+ OLEVariant(pIndex->getImpl())));
}
+ if(bError)
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
// -------------------------------------------------------------------------
// XDrop
void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
+ m_aCollection.Delete(_sElementName);
}
// -------------------------------------------------------------------------
Reference< XNamed > OIndexes::cloneObject(const Reference< XPropertySet >& _xDescriptor)
{
- Reference< XNamed > xName(_xDescriptor,UNO_QUERY);
- OSL_ENSURE(xName.is(),"Must be a XName interface here !");
- return xName.is() ? createObject(xName->getName()) : Reference< XNamed >();
+ OAdoIndex* pIndex = NULL;
+ if(getImplementation(pIndex,_xDescriptor) && pIndex != NULL)
+ return new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex->getImpl());
+ return Reference< XNamed >();
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
index 6e3094885497..5ab0937b97c9 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKey.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,29 +110,13 @@ void OAdoKey::refreshColumns()
{
TStringVector aVector;
- ADOColumns* pColumns = m_aKey.get_Columns();
- if(pColumns)
- {
- pColumns->Refresh();
-
- sal_Int32 nCount = 0;
- pColumns->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOColumn* pColumn = NULL;
- pColumns->get_Item(OLEVariant(i),&pColumn);
- if(pColumn)
- {
- WpADOColumn aColumn(pColumn);
- aVector.push_back(aColumn.get_Name());
- }
- }
- }
+ WpADOColumns aColumns = m_aKey.get_Columns();
+ aColumns.fillElementNames(aVector);
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pConnection);
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
}
// -------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index 32e21b0a1166..cb12d7732070 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKeys.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,9 +89,9 @@
#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HDL_
-#include <com/sun/star/sdbcx/XColumnsSupplier.hdl>
-#endif
+//#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HDL_
+//#include <com/sun/star/sdbcx/XColumnsSupplier.hdl>
+//#endif
using namespace ::comphelper;
using namespace connectivity;
@@ -103,18 +103,14 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
Reference< XNamed > OKeys::createObject(const ::rtl::OUString& _rName)
{
- ADOKey* pKey = NULL;
- m_pCollection->get_Item(OLEVariant(_rName),&pKey);
- return new OAdoKey(isCaseSensitive(),m_pConnection,pKey);
+ return new OAdoKey(isCaseSensitive(),m_pConnection,m_aCollection.GetItem(_rName));
}
// -------------------------------------------------------------------------
void OKeys::impl_refresh() throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OKeys::createEmptyObject()
@@ -125,50 +121,42 @@ Reference< XPropertySet > OKeys::createEmptyObject()
// XAppend
void OKeys::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OAdoKey* pKey = NULL;
+ if(getImplementation(pKey,descriptor) && pKey != NULL)
{
- OAdoKey* pKey = (OAdoKey*)xTunnel->getSomething(OAdoKey:: getUnoTunnelImplementationId());
- if(pKey)
- {
- // To pass as column parameter to Key's Apppend method
- OLEVariant vOptional;
-// vOptional.vt = VT_ERROR;
-// vOptional.scode = DISP_E_PARAMNOTFOUND;
+ // To pass as column parameter to Key's Apppend method
+ OLEVariant vOptional;
+ vOptional.setNoArg();
+
+ KeyTypeEnum eKey = OAdoKey::Map2KeyRule(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
+ WpADOKey aKey = pKey->getImpl();
+ ::rtl::OUString sName = aKey.get_Name();
+ if(!sName.getLength())
+ aKey.put_Name(::rtl::OUString::createFromAscii("PrimaryKey") );
- m_pCollection->Append(OLEVariant(pKey->getImpl()),OAdoKey::Map2KeyRule(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))),vOptional);
+ ADOKeys* pKeys = m_aCollection;
+ if(FAILED(pKeys->Append(OLEVariant((ADOKey*)pKey->getImpl()),
+ eKey,
+ vOptional)))
ADOS::ThrowException(*m_pConnection->getConnection(),*this);
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
// -------------------------------------------------------------------------
// XDrop
void OKeys::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
- ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+ if(!m_aCollection.Delete(OLEVariant(_sElementName)))
+ ADOS::ThrowException(*m_pConnection->getConnection(),*this);
}
// -----------------------------------------------------------------------------
Reference< XNamed > OKeys::cloneObject(const Reference< XPropertySet >& _xDescriptor)
{
- OAdoKey* pKey = new OAdoKey(isCaseSensitive(),m_pConnection);
- Reference<XPropertySet> xProp = pKey;
- Reference< XNamed > xName = pKey;
- ::comphelper::copyProperties(_xDescriptor,xProp);
- Reference<XColumnsSupplier> xSup(_xDescriptor,UNO_QUERY);
- Reference<XIndexAccess> xIndex(xSup->getColumns(),UNO_QUERY);
- Reference<XAppend> xAppend(pKey->getColumns(),UNO_QUERY);
- sal_Int32 nCount = xIndex->getCount();
- for(sal_Int32 i=0;i< nCount;++i)
- {
- Reference<XPropertySet> xProp;
- xIndex->getByIndex(i) >>= xProp;
- xAppend->appendByDescriptor(xProp);
- }
-
- return xName;
+ OAdoKey* pKey = NULL;
+ if(getImplementation(pKey,_xDescriptor) && pKey != NULL)
+ return new OAdoKey(isCaseSensitive(),m_pConnection,pKey->getImpl());
+ return Reference< XNamed >();
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index 88581eb0666f..e0cd49e43f59 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AResultSet.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,6 @@
*
************************************************************************/
-
#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_
#include "ado/AResultSet.hxx"
#endif
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index 9ded893c86d6..8dc2aa3c2222 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATable.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2001-09-25 13:12:49 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,86 +146,39 @@ void OAdoTable::refreshColumns()
{
TStringVector aVector;
- ADOColumns* pColumns = m_aTable.get_Columns();
- if(pColumns)
- {
- pColumns->Refresh();
-
- sal_Int32 nCount = 0;
- pColumns->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOColumn* pColumn = NULL;
- pColumns->get_Item(OLEVariant(i),&pColumn);
- if(pColumn)
- {
- WpADOColumn aColumn(pColumn);
- aVector.push_back(aColumn.get_Name());
- }
- }
- }
+ WpADOColumns aColumns = m_aTable.get_Columns();
+ aColumns.fillElementNames(aVector);
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pCatalog->getConnection());
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pCatalog->getConnection());
}
// -------------------------------------------------------------------------
void OAdoTable::refreshKeys()
{
TStringVector aVector;
- ADOKeys* pKeys = m_aTable.get_Keys();
- if(pKeys)
- {
- pKeys->Refresh();
-
- sal_Int32 nCount = 0;
- pKeys->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOKey* pKey = NULL;
- pKeys->get_Item(OLEVariant(i),&pKey);
- if(pKey)
- {
- WpADOKey aKey(pKey);
- aVector.push_back(aKey.get_Name());
- }
- }
- }
+ WpADOKeys aKeys = m_aTable.get_Keys();
+ aKeys.fillElementNames(aVector);
if(m_pKeys)
m_pKeys->reFill(aVector);
else
- m_pKeys = new OKeys(*this,m_aMutex,aVector,pKeys,isCaseSensitive(),m_pCatalog->getConnection());
+ m_pKeys = new OKeys(*this,m_aMutex,aVector,aKeys,isCaseSensitive(),m_pCatalog->getConnection());
}
// -------------------------------------------------------------------------
void OAdoTable::refreshIndexes()
{
TStringVector aVector;
- ADOIndexes* pIndexes = m_aTable.get_Indexes();
- if(pIndexes)
- {
- pIndexes->Refresh();
+ WpADOIndexes aIndexes = m_aTable.get_Indexes();
+ aIndexes.fillElementNames(aVector);
- sal_Int32 nCount = 0;
- pIndexes->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOIndex* pIndex = NULL;
- pIndexes->get_Item(OLEVariant(i),&pIndex);
- if(pIndex)
- {
- WpADOIndex aIndex(pIndex);
- aVector.push_back(aIndex.get_Name());
- }
- }
- }
if(m_pIndexes)
m_pIndexes->reFill(aVector);
else
- m_pIndexes = new OIndexes(*this,m_aMutex,aVector,pIndexes,isCaseSensitive(),m_pCatalog->getConnection());
+ m_pIndexes = new OIndexes(*this,m_aMutex,aVector,aIndexes,isCaseSensitive(),m_pCatalog->getConnection());
}
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoTable::getUnoTunnelImplementationId()
@@ -272,22 +225,19 @@ void SAL_CALL OAdoTable::alterColumnByName( const ::rtl::OUString& colName, cons
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
-
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ sal_Bool bError = sal_True;
+ OAdoColumn* pColumn = NULL;
+ if(getImplementation(pColumn,descriptor) && pColumn != NULL)
{
- OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId());
- if(pColumn)
- {
- m_aTable.get_Columns()->Delete(OLEVariant(colName));
- m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by name!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
+ WpADOColumns aColumns = m_aTable.get_Columns();
+ bError = !aColumns.Delete(colName);
+ bError = bError || !aColumns.Append(pColumn->getColumnImpl());
}
+ if(bError)
+ ADOS::ThrowException(*(m_pCatalog->getConnection()->getConnection()),*this);
m_pColumns->refresh();
-
+ refreshColumns();
}
// -------------------------------------------------------------------------
void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
@@ -295,20 +245,10 @@ void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< X
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
-
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
- {
- OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId());
- if(pColumn)
- {
- m_aTable.get_Columns()->Delete(OLEVariant(index));
- m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by index!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
- }
- m_pColumns->refresh();
+ Reference< XPropertySet > xOld;
+ m_pColumns->getByIndex(index) >>= xOld;
+ if(xOld.is())
+ alterColumnByName(getString(xOld->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))),descriptor);
}
// -------------------------------------------------------------------------
void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
index f896a5ba48aa..8d7354919777 100644
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ b/connectivity/source/drivers/ado/ATables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATables.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,8 +92,12 @@
#ifndef CONNECTIVITY_CONNECTION_HXX
#include "TConnection.hxx"
#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
using namespace connectivity;
+using namespace comphelper;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -106,14 +110,14 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE;
Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
{
- ADOTable* pTable = NULL;
- m_pCollection->get_Item(OLEVariant(_rName),&pTable);
- return new OAdoTable(this,isCaseSensitive(),m_pCatalog,pTable);
+ OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
+ return new OAdoTable(this,isCaseSensitive(),m_pCatalog,m_aCollection.GetItem(_rName));
}
// -------------------------------------------------------------------------
void OTables::impl_refresh( ) throw(RuntimeException)
{
- m_pCollection->Refresh();
+ OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OTables::createEmptyObject()
@@ -124,32 +128,34 @@ Reference< XPropertySet > OTables::createEmptyObject()
// XAppend
void OTables::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OAdoTable* pTable = NULL;
+ if(getImplementation(pTable,descriptor) && pTable != NULL)
{
- OAdoTable* pTable = (OAdoTable*)xTunnel->getSomething(OAdoTable:: getUnoTunnelImplementationId());
- if(pTable)
- {
- m_pCollection->Append(OLEVariant(pTable->getImpl()));
+ OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
+ if(!m_aCollection.Append(pTable->getImpl()))
ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
// -------------------------------------------------------------------------
// XDrop
void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
+ if(!m_aCollection.Delete(_sElementName))
+ ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
}
// -------------------------------------------------------------------------
Reference< XNamed > OTables::cloneObject(const Reference< XPropertySet >& _xDescriptor)
{
- Reference< XNamed > xName(_xDescriptor,UNO_QUERY);
- OSL_ENSURE(xName.is(),"Must be a XName interface here !");
- return xName.is() ? createObject(xName->getName()) : Reference< XNamed >();
+ OAdoTable* pTable = NULL;
+ if(getImplementation(pTable,_xDescriptor) && pTable != NULL)
+ {
+ WpADOTable aTable = pTable->getImpl();
+ return new OAdoTable(this,isCaseSensitive(),m_pCatalog,aTable);
+ }
+ return Reference< XNamed >();
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
index c117d3300bc7..e2c1aa2cb10f 100644
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ b/connectivity/source/drivers/ado/AUser.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AUser.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,10 +58,12 @@
*
*
************************************************************************/
-
#ifndef _CONNECTIVITY_ADO_USER_HXX_
#include "ado/AUser.hxx"
#endif
+#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_
+#include "ado/ACatalog.hxx"
+#endif
#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_
#include "ado/AGroups.hxx"
#endif
@@ -80,9 +82,7 @@
#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_
#include "ado/AConnection.hxx"
#endif
-#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_
-#include "ado/ACatalog.hxx"
-#endif
+
#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_
#include "ado/Awrapado.hxx"
#endif
@@ -117,32 +117,13 @@ OAdoUser::OAdoUser(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString&
// -------------------------------------------------------------------------
void OAdoUser::refreshGroups()
{
-
TStringVector aVector;
-
- ADOGroups* pGroups = m_aUser.get_Groups();
- if(pGroups)
- {
- pGroups->Refresh();
-
- sal_Int32 nCount = 0;
- pGroups->get_Count(&nCount);
- for(sal_Int32 i=0;i< nCount;++i)
- {
- ADOGroup* pGroup = NULL;
- pGroups->get_Item(OLEVariant(i),&pGroup);
- if(pGroup)
- {
- WpADOGroup aGroup(pGroup);
- aVector.push_back(aGroup.get_Name());
- }
- }
- }
-
+ WpADOGroups aGroups(m_aUser.get_Groups());
+ aGroups.fillElementNames(aVector);
if(m_pGroups)
m_pGroups->reFill(aVector);
else
- m_pGroups = new OGroups(m_pCatalog,m_aMutex,aVector,pGroups,isCaseSensitive());
+ m_pGroups = new OGroups(m_pCatalog,m_aMutex,aVector,aGroups,isCaseSensitive());
}
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoUser::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
index 85eb74f964ee..f4655265edcb 100644
--- a/connectivity/source/drivers/ado/AUsers.cxx
+++ b/connectivity/source/drivers/ado/AUsers.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AUsers.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,8 +77,12 @@
#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
#include "connectivity/sdbcx/IRefreshable.hxx"
#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+using namespace comphelper;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -90,38 +94,34 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE;
Reference< XNamed > OUsers::createObject(const ::rtl::OUString& _rName)
{
- OAdoUser* pRet = new OAdoUser(m_pCatalog,isCaseSensitive(),_rName);
- Reference< XNamed > xRet = pRet;
- return xRet;
+ return new OAdoUser(m_pCatalog,isCaseSensitive(),_rName);
}
// -------------------------------------------------------------------------
void OUsers::impl_refresh() throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OUsers::createEmptyObject()
{
- OUserExtend* pNew = new OUserExtend(m_pCatalog,isCaseSensitive());
- return pNew;
+ return new OUserExtend(m_pCatalog,isCaseSensitive());
}
// -------------------------------------------------------------------------
// XAppend
void OUsers::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OUserExtend* pUser = NULL;
+ if(getImplementation(pUser,descriptor) && pUser != NULL)
{
- OUserExtend* pUser = (OUserExtend*)xTunnel->getSomething(OUserExtend::getUnoTunnelImplementationId());
- if(pUser)
- m_pCollection->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()));
+ ADOUsers* pUsers = (ADOUsers*)m_aCollection;
+ pUsers->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()));
}
}
// -------------------------------------------------------------------------
// XDrop
void OUsers::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
+ m_aCollection.Delete(_sElementName);
}
// -------------------------------------------------------------------------
Reference< XNamed > OUsers::cloneObject(const Reference< XPropertySet >& _xDescriptor)
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx
index 38ba7e13aab1..800181fa108f 100644
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ b/connectivity/source/drivers/ado/AViews.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AViews.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:43:13 $
+ * last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,52 +105,41 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::container;
-typedef connectivity::sdbcx::OCollection OCollection_TYPE;
-
Reference< XNamed > OViews::createObject(const ::rtl::OUString& _rName)
{
- ADOView* pView = NULL;
- m_pCollection->get_Item(OLEVariant(_rName),&pView);
-
- Reference< XNamed > xRet = new OAdoView(isCaseSensitive(),pView);
-
- return xRet;
+ return new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
}
// -------------------------------------------------------------------------
void OViews::impl_refresh( ) throw(RuntimeException)
{
- m_pCollection->Refresh();
+ m_aCollection.Refresh();
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OViews::createEmptyObject()
{
- OAdoView* pNew = new OAdoView(isCaseSensitive());
- return pNew;
+ return new OAdoView(isCaseSensitive());
}
// -------------------------------------------------------------------------
// XAppend
void OViews::appendObject( const Reference< XPropertySet >& descriptor )
{
- Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ OAdoView* pView = NULL;
+ if(getImplementation(pView,descriptor) && pView != NULL)
{
- OAdoView* pView = (OAdoView*)xTunnel->getSomething(OAdoView:: getUnoTunnelImplementationId());
- if(pView)
- {
- m_pCollection->Append(OLEString(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))),(IDispatch *)pView->getImpl());
+ ADOViews* pViews = (ADOViews*)m_aCollection;
+ if(FAILED(pViews->Append(OLEString(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))),pView->getImpl())))
ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
- }
- else
- throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_HY0000),1000,Any());
}
// -------------------------------------------------------------------------
// XDrop
void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
{
- m_pCollection->Delete(OLEVariant(_sElementName));
- ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
+ if(!m_aCollection.Delete(_sElementName))
+ ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
}
// -------------------------------------------------------------------------
Reference< XNamed > OViews::cloneObject(const Reference< XPropertySet >& _xDescriptor)