Kaydet (Commit) f6064fa0 authored tarafından Ocke Janssen's avatar Ocke Janssen

#94754# general fixes for views

üst 693fc99a
......@@ -2,9 +2,9 @@
*
* $RCSfile: ADatabaseMetaDataImpl.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: oj $ $Date: 2001-09-17 14:09:15 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -666,23 +666,5 @@ void WpADOUser::Create()
operator=(pCommand);
}
// -------------------------------------------------------------------------
void WpADOView::Create()
{
IClassFactory2* pIUnknown = NULL;
IUnknown *pOuter = NULL;
HRESULT hr = -1;
ADOView* pCommand;
hr = CoCreateInstance(ADOS::CLSID_ADOVIEW_25,
NULL,
CLSCTX_INPROC_SERVER,
ADOS::IID_ADOVIEW_25,
(void**)&pCommand );
if( !FAILED( hr ) )
operator=(pCommand);
}
// -------------------------------------------------------------------------
......@@ -2,9 +2,9 @@
*
* $RCSfile: ATables.cxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -95,7 +95,11 @@
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
#include <cppuhelper/interfacecontainer.h>
#endif
using namespace ::cppu;
using namespace connectivity;
using namespace comphelper;
using namespace connectivity::ado;
......@@ -158,5 +162,19 @@ Reference< XNamed > OTables::cloneObject(const Reference< XPropertySet >& _xDesc
return Reference< XNamed >();
}
// -----------------------------------------------------------------------------
void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
{
OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
m_aCollection.Refresh();
insertElement(_rsNewTable,NULL);
// notify our container listeners
ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
while (aListenerLoop.hasMoreElements())
static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
}
// -----------------------------------------------------------------------------
......@@ -2,9 +2,9 @@
*
* $RCSfile: AView.cxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: oj $ $Date: 2001-08-24 06:13:55 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -76,11 +76,15 @@
#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#ifndef CONNECTIVITY_CONNECTION_HXX
#include "TConnection.hxx"
#endif
// -------------------------------------------------------------------------
using namespace comphelper;
using namespace connectivity::ado;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
......@@ -90,37 +94,8 @@ using namespace com::sun::star::sdbc;
// IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
// -------------------------------------------------------------------------
OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
,m_aView(_pView)
{
construct();
if(_pView)
m_aView = WpADOView(_pView);
else
m_aView.Create();
}
// -------------------------------------------------------------------------
OAdoView::OAdoView(sal_Bool _bCase, const ::rtl::OUString& _Name,
sal_Int32 _CheckOption,
const ::rtl::OUString& _Command,
const ::rtl::OUString& _SchemaName,
const ::rtl::OUString& _CatalogName)
: OView_ADO( _bCase,
_Name,
NULL,
_CheckOption,
_Command,
_SchemaName,
_CatalogName)
{
construct();
m_aView.Create();
WpADOCommand aCommand;
aCommand.Create();
aCommand.put_Name(_Name);
aCommand.put_CommandText(_Command);
m_aView.put_Command(OLEVariant((IDispatch*)aCommand));
}
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
......@@ -149,11 +124,6 @@ sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (Runt
OView_ADO::getSomething(rId);
}
// -------------------------------------------------------------------------
void OAdoView::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
{
throw Exception();
}
// -------------------------------------------------------------------------
void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{
......@@ -184,9 +154,10 @@ void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
break;
}
}
else
OView_ADO::getFastPropertyValue(rValue,nHandle);
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void SAL_CALL OAdoView::acquire() throw(::com::sun::star::uno::RuntimeException)
{
OView_ADO::acquire();
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: AViews.cxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: oj $ $Date: 2001-11-09 07:05:38 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -64,20 +64,8 @@
#ifndef _CONNECTIVITY_ADO_VIEW_HXX_
#include "ado/AView.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_
#include <com/sun/star/sdbc/KeyRule.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
#include <com/sun/star/sdbcx/KeyType.hpp>
#ifndef _CONNECTIVITY_ADO_TABLES_HXX_
#include "ado/ATables.hxx"
#endif
#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_
#include "ado/ACatalog.hxx"
......@@ -107,7 +95,9 @@ using namespace com::sun::star::container;
Reference< XNamed > OViews::createObject(const ::rtl::OUString& _rName)
{
return new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
OAdoView* pView = new OAdoView(isCaseSensitive(),m_aCollection.GetItem(_rName));
pView->setNew(sal_False);
return pView;
}
// -------------------------------------------------------------------------
void OViews::impl_refresh( ) throw(RuntimeException)
......@@ -127,9 +117,24 @@ void OViews::appendObject( const Reference< XPropertySet >& descriptor )
OAdoView* pView = NULL;
if(getImplementation(pView,descriptor) && pView != NULL)
{
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);
WpADOCommand aCommand;
aCommand.Create();
if(aCommand.IsValid())
{
::rtl::OUString sName;
descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName;
aCommand.put_Name(sName);
aCommand.put_CommandText(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND))));
ADOViews* pViews = (ADOViews*)m_aCollection;
if(FAILED(pViews->Append(OLEString(sName),aCommand)))
ADOS::ThrowException(*m_pCatalog->getConnection()->getConnection(),*this);
OTables* pTables = static_cast<OTables*>(static_cast<OCatalog&>(m_rParent).getPrivateTables());
if(pTables)
pTables->appendNew(sName);
}
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());
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ACatalog.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -88,7 +88,8 @@ namespace connectivity
public:
OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon);
OConnection* getConnection() { return m_pConnection; }
OConnection* getConnection() const { return m_pConnection; }
sdbcx::OCollection* getPrivateTables() const { return m_pTables;}
};
}
}
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ATables.hxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: oj $ $Date: 2001-11-09 06:59:00 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -99,6 +99,7 @@ namespace connectivity
{
OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
}
void appendNew(const ::rtl::OUString& _rsNewTable);
};
}
}
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: AView.hxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: hr $ $Date: 2001-10-17 18:13:31 $
* last change: $Author: oj $ $Date: 2001-11-15 10:50:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -82,21 +82,12 @@ namespace connectivity
protected:
// OPropertySetHelper
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
sal_Int32 nHandle,
const ::com::sun::star::uno::Any& rValue)
throw (::com::sun::star::uno::Exception);
virtual void SAL_CALL getFastPropertyValue(
::com::sun::star::uno::Any& rValue,
sal_Int32 nHandle
) const;
public:
OAdoView(sal_Bool _bCase, ADOView* _pView=NULL);
OAdoView(sal_Bool _bCase, const ::rtl::OUString& _rName,
sal_Int32 _nCheckOption = 0,
const ::rtl::OUString& _rCommand = ::rtl::OUString(),
const ::rtl::OUString& _rSchemaName = ::rtl::OUString(),
const ::rtl::OUString& _rCatalogName = ::rtl::OUString());
// com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: Awrapadox.hxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: oj $ $Date: 2001-11-09 06:59:00 $
* last change: $Author: oj $ $Date: 2001-11-15 10:51:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -241,8 +241,6 @@ namespace connectivity
inline WpADOView& operator=(const WpADOView& rhs)
{WpOLEBase<ADOView>::operator=(rhs); return *this;}
void Create();
::rtl::OUString get_Name() const;
void get_Command(OLEVariant& _rVar) const;
void put_Command(OLEVariant& _rVar);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment