xref: /trunk/main/dbaccess/source/core/api/table.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #include "table.hxx"
32 #include <definitioncolumn.hxx>
33 #include "dbastrings.hrc"
34 #include "core_resource.hxx"
35 #include "core_resource.hrc"
36 #include "CIndexes.hxx"
37 
38 #include <tools/debug.hxx>
39 #include <cppuhelper/typeprovider.hxx>
40 #include <comphelper/enumhelper.hxx>
41 #include <comphelper/container.hxx>
42 #include <comphelper/sequence.hxx>
43 #include <comphelper/types.hxx>
44 //#include <comphelper/extract.hxx>
45 #include <com/sun/star/util/XRefreshListener.hpp>
46 #include <com/sun/star/sdbc/XConnection.hpp>
47 #include <com/sun/star/sdbc/XRow.hpp>
48 #include <com/sun/star/sdbcx/Privilege.hpp>
49 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
50 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
51 
52 #include <connectivity/TKeys.hxx>
53 #include <connectivity/dbtools.hxx>
54 #include <connectivity/dbexception.hxx>
55 
56 #include "sdbcoretools.hxx"
57 #include "ContainerMediator.hxx"
58 #include <rtl/logfile.hxx>
59 
60 using namespace dbaccess;
61 using namespace connectivity;
62 using namespace ::com::sun::star::uno;
63 using namespace ::com::sun::star::util;
64 using namespace ::com::sun::star::lang;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::sdbc;
67 using namespace ::com::sun::star::sdbcx;
68 using namespace ::com::sun::star::container;
69 using namespace ::osl;
70 using namespace ::comphelper;
71 using namespace ::cppu;
72 
73 typedef ::std::map <sal_Int32, OTableColumn*, std::less <sal_Int32> > OColMap;
74 
75 //==========================================================================
76 //= ODBTable
77 //==========================================================================
78 DBG_NAME(ODBTable)
79 //--------------------------------------------------------------------------
80 ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables
81         ,const Reference< XConnection >& _rxConn
82         ,const ::rtl::OUString& _rCatalog
83         ,const ::rtl::OUString& _rSchema
84         ,const ::rtl::OUString& _rName
85         ,const ::rtl::OUString& _rType
86         ,const ::rtl::OUString& _rDesc
87         ,const Reference< XNameAccess >& _xColumnDefinitions) throw(SQLException)
88     :OTable_Base(_pTables,_rxConn,_rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers(), _rName, _rType, _rDesc, _rSchema, _rCatalog )
89     ,m_xColumnDefinitions(_xColumnDefinitions)
90     ,m_nPrivileges(0)
91 {
92     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" );
93     DBG_CTOR(ODBTable, NULL);
94     DBG_ASSERT(getMetaData().is(), "ODBTable::ODBTable : invalid conn !");
95     DBG_ASSERT(_rName.getLength(), "ODBTable::ODBTable : name !");
96     // TODO : think about collecting the privileges here, as we can't ensure that in getFastPropertyValue, where
97     // we do this at the moment, the statement needed can be supplied by the connection (for example the SQL-Server
98     // ODBC driver does not allow more than one statement per connection, and in getFastPropertyValue it's more
99     // likely that it's already used up than it's here.)
100 }
101 // -----------------------------------------------------------------------------
102 ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables
103                    ,const Reference< XConnection >& _rxConn)
104                 throw(SQLException)
105     :OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers())
106     ,m_nPrivileges(-1)
107 {
108     DBG_CTOR(ODBTable, NULL);
109     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" );
110 }
111 // -------------------------------------------------------------------------
112 ODBTable::~ODBTable()
113 {
114     DBG_DTOR(ODBTable, NULL);
115 }
116 // -----------------------------------------------------------------------------
117 IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base)
118 
119 //--------------------------------------------------------------------------
120 OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const
121 {
122     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumn" );
123     OColumn* pReturn = NULL;
124 
125     Reference<XPropertySet> xProp;
126     if ( m_xDriverColumns.is() && m_xDriverColumns->hasByName(_rName) )
127     {
128         xProp.set(m_xDriverColumns->getByName(_rName),UNO_QUERY);
129     }
130     else
131     {
132         OColumns* pColumns = static_cast<OColumns*>(m_pColumns);
133         xProp.set(pColumns->createBaseObject(_rName),UNO_QUERY);
134     }
135 
136     Reference<XPropertySet> xColumnDefintion;
137     if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
138         xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
139     pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
140 
141     return pReturn;
142 }
143 // -----------------------------------------------------------------------------
144 void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ )
145 {
146     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnAppended" );
147     // not interested in
148 }
149 // -----------------------------------------------------------------------------
150 void ODBTable::columnDropped(const ::rtl::OUString& _sName)
151 {
152     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnDropped" );
153     Reference<XDrop> xDrop(m_xColumnDefinitions,UNO_QUERY);
154     if ( xDrop.is() && m_xColumnDefinitions->hasByName(_sName) )
155     {
156         xDrop->dropByName(_sName);
157     }
158 }
159 //--------------------------------------------------------------------------
160 Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException)
161 {
162     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getImplementationId" );
163     static OImplementationId * pId = 0;
164     if (! pId)
165     {
166         MutexGuard aGuard( Mutex::getGlobalMutex() );
167         if (! pId)
168         {
169             static OImplementationId aId;
170             pId = &aId;
171         }
172     }
173     return pId->getImplementationId();
174 }
175 
176 // OComponentHelper
177 //------------------------------------------------------------------------------
178 void SAL_CALL ODBTable::disposing()
179 {
180     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::disposing" );
181     OPropertySetHelper::disposing();
182     OTable_Base::disposing();
183     m_xColumnDefinitions = NULL;
184     m_xDriverColumns = NULL;
185     m_pColumnMediator = NULL;
186 }
187 
188 //------------------------------------------------------------------------------
189 void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
190 {
191     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getFastPropertyValue" );
192     if ((PROPERTY_ID_PRIVILEGES == _nHandle) && (-1 == m_nPrivileges))
193     {   // somebody is asking for the privileges an we do not know them, yet
194         const_cast<ODBTable*>(this)->m_nPrivileges = ::dbtools::getTablePrivileges(getMetaData(),m_CatalogName,m_SchemaName, m_Name);
195     }
196 
197     OTable_Base::getFastPropertyValue(_rValue, _nHandle);
198 }
199 // -------------------------------------------------------------------------
200 void ODBTable::construct()
201 {
202     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::construct" );
203     ::osl::MutexGuard aGuard(m_aMutex);
204 
205     // we don't collect the privileges here, this is potentially expensive. Instead we determine them on request.
206     // (see getFastPropertyValue)
207     m_nPrivileges = -1;
208 
209     OTable_Base::construct();
210 
211     registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
212                     &m_sFilter, ::getCppuType(&m_sFilter));
213 
214     registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
215                     &m_sOrder, ::getCppuType(&m_sOrder));
216 
217     registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
218                     &m_bApplyFilter, ::getBooleanCppuType());
219 
220     registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
221                     &m_aFont, ::getCppuType(&m_aFont));
222 
223     registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
224                     &m_aRowHeight, ::getCppuType(static_cast<sal_Int32*>(NULL)));
225 
226     registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
227                     &m_aTextColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
228 
229     registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, PropertyAttribute::BOUND | PropertyAttribute::READONLY,
230                     &m_nPrivileges, ::getCppuType(static_cast<sal_Int32*>(NULL)));
231 
232     registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
233                     &m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
234 
235     registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
236                     &m_nFontEmphasis, ::getCppuType(&m_nFontEmphasis));
237 
238     registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,
239                     &m_nFontRelief, ::getCppuType(&m_nFontRelief));
240 
241     registerProperty(PROPERTY_FONTNAME,         PROPERTY_ID_FONTNAME,        PropertyAttribute::BOUND,&m_aFont.Name,            ::getCppuType(&m_aFont.Name));
242     registerProperty(PROPERTY_FONTHEIGHT,       PROPERTY_ID_FONTHEIGHT,      PropertyAttribute::BOUND,&m_aFont.Height,          ::getCppuType(&m_aFont.Height));
243     registerProperty(PROPERTY_FONTWIDTH,        PROPERTY_ID_FONTWIDTH,       PropertyAttribute::BOUND,&m_aFont.Width,           ::getCppuType(&m_aFont.Width));
244     registerProperty(PROPERTY_FONTSTYLENAME,    PROPERTY_ID_FONTSTYLENAME,   PropertyAttribute::BOUND,&m_aFont.StyleName,       ::getCppuType(&m_aFont.StyleName));
245     registerProperty(PROPERTY_FONTFAMILY,       PROPERTY_ID_FONTFAMILY,      PropertyAttribute::BOUND,&m_aFont.Family,          ::getCppuType(&m_aFont.Family));
246     registerProperty(PROPERTY_FONTCHARSET,      PROPERTY_ID_FONTCHARSET,     PropertyAttribute::BOUND,&m_aFont.CharSet,         ::getCppuType(&m_aFont.CharSet));
247     registerProperty(PROPERTY_FONTPITCH,        PROPERTY_ID_FONTPITCH,       PropertyAttribute::BOUND,&m_aFont.Pitch,           ::getCppuType(&m_aFont.Pitch));
248     registerProperty(PROPERTY_FONTCHARWIDTH,    PROPERTY_ID_FONTCHARWIDTH,   PropertyAttribute::BOUND,&m_aFont.CharacterWidth,  ::getCppuType(&m_aFont.CharacterWidth));
249     registerProperty(PROPERTY_FONTWEIGHT,       PROPERTY_ID_FONTWEIGHT,      PropertyAttribute::BOUND,&m_aFont.Weight,          ::getCppuType(&m_aFont.Weight));
250     registerProperty(PROPERTY_FONTSLANT,        PROPERTY_ID_FONTSLANT,       PropertyAttribute::BOUND,&m_aFont.Slant,           ::getCppuType(&m_aFont.Slant));
251     registerProperty(PROPERTY_FONTUNDERLINE,    PROPERTY_ID_FONTUNDERLINE,   PropertyAttribute::BOUND,&m_aFont.Underline,       ::getCppuType(&m_aFont.Underline));
252     registerProperty(PROPERTY_FONTSTRIKEOUT,    PROPERTY_ID_FONTSTRIKEOUT,   PropertyAttribute::BOUND,&m_aFont.Strikeout,       ::getCppuType(&m_aFont.Strikeout));
253     registerProperty(PROPERTY_FONTORIENTATION,  PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&m_aFont.Orientation,     ::getCppuType(&m_aFont.Orientation));
254     registerProperty(PROPERTY_FONTKERNING,      PROPERTY_ID_FONTKERNING,     PropertyAttribute::BOUND,&m_aFont.Kerning,         ::getCppuType(&m_aFont.Kerning));
255     registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&m_aFont.WordLineMode,    ::getCppuType(&m_aFont.WordLineMode));
256     registerProperty(PROPERTY_FONTTYPE,         PROPERTY_ID_FONTTYPE,        PropertyAttribute::BOUND,&m_aFont.Type,            ::getCppuType(&m_aFont.Type));
257 
258     refreshColumns();
259 }
260 // -----------------------------------------------------------------------------
261 ::cppu::IPropertyArrayHelper* ODBTable::createArrayHelper( sal_Int32 _nId) const
262 {
263     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createArrayHelper" );
264     Sequence< Property > aProps;
265     describeProperties(aProps);
266     if(!_nId)
267     {
268         Property* pIter = aProps.getArray();
269         Property* pEnd  = pIter + aProps.getLength();
270         for(;pIter != pEnd;++pIter)
271         {
272             if (0 == pIter->Name.compareToAscii(PROPERTY_CATALOGNAME))
273                 pIter->Attributes = PropertyAttribute::READONLY;
274             else if (0 == pIter->Name.compareToAscii(PROPERTY_SCHEMANAME))
275                 pIter->Attributes = PropertyAttribute::READONLY;
276             else if (0 == pIter->Name.compareToAscii(PROPERTY_DESCRIPTION))
277                 pIter->Attributes = PropertyAttribute::READONLY;
278             else if (0 == pIter->Name.compareToAscii(PROPERTY_NAME))
279                 pIter->Attributes = PropertyAttribute::READONLY;
280         }
281     }
282 
283     return new ::cppu::OPropertyArrayHelper(aProps);
284 }
285 // -----------------------------------------------------------------------------
286 ::cppu::IPropertyArrayHelper & SAL_CALL ODBTable::getInfoHelper()
287 {
288     return *ODBTable_PROP::getArrayHelper(isNew() ? 1 : 0);
289 }
290 // -------------------------------------------------------------------------
291 // XServiceInfo
292 IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE)
293 // -------------------------------------------------------------------------
294 Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException)
295 {
296     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" );
297     if(rType == getCppuType( (Reference<XRename>*)0) && !getRenameService().is() )
298         return Any();
299     if(rType == getCppuType( (Reference<XAlterTable>*)0) && !getAlterService().is() )
300         return Any();
301     return OTable_Base::queryInterface( rType);
302 }
303 // -------------------------------------------------------------------------
304 Sequence< Type > SAL_CALL ODBTable::getTypes(  ) throw(RuntimeException)
305 {
306     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getTypes" );
307     Type aRenameType = getCppuType( (Reference<XRename>*)0);
308     Type aAlterType = getCppuType( (Reference<XAlterTable>*)0);
309 
310     Sequence< Type > aTypes(OTable_Base::getTypes());
311     ::std::vector<Type> aOwnTypes;
312     aOwnTypes.reserve(aTypes.getLength());
313 
314     const Type* pIter = aTypes.getConstArray();
315     const Type* pEnd = pIter + aTypes.getLength();
316     for(;pIter != pEnd ;++pIter)
317     {
318         if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is()))
319             aOwnTypes.push_back(*pIter);
320     }
321 
322     Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
323     return Sequence< Type >(pTypes, aOwnTypes.size());
324 }
325 // XRename,
326 //------------------------------------------------------------------------------
327 void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException)
328 {
329     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" );
330     ::osl::MutexGuard aGuard(m_aMutex);
331     checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
332     if ( !getRenameService().is() )
333         throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
334 
335     Reference<XPropertySet> xTable(this);
336     getRenameService()->rename(xTable,_rNewName);
337     ::connectivity::OTable_TYPEDEF::rename(_rNewName);
338 }
339 
340 // XAlterTable,
341 //------------------------------------------------------------------------------
342 void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
343 {
344     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" );
345     ::osl::MutexGuard aGuard(m_aMutex);
346     checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
347     if ( !getAlterService().is() )
348         throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
349 
350     if ( !m_pColumns->hasByName(_rName) )
351         throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() );
352 
353     Reference<XPropertySet> xTable(this);
354     getAlterService()->alterColumnByName(xTable,_rName,_rxDescriptor);
355     m_pColumns->refresh();
356 }
357 // -----------------------------------------------------------------------------
358 sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
359 {
360     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getSomething" );
361     sal_Int64 nRet(0);
362     if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
363         nRet = reinterpret_cast<sal_Int64>(this);
364     else
365         nRet = OTable_Base::getSomething(rId);
366 
367     return nRet;
368 }
369 // -----------------------------------------------------------------------------
370 Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
371 {
372     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getUnoTunnelImplementationId" );
373     static ::cppu::OImplementationId * pId = 0;
374     if (! pId)
375     {
376         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
377         if (! pId)
378         {
379             static ::cppu::OImplementationId aId;
380             pId = &aId;
381         }
382     }
383     return pId->getImplementationId();
384 }
385 // -----------------------------------------------------------------------------
386 Reference< XPropertySet > ODBTable::createColumnDescriptor()
387 {
388     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" );
389     return new OTableColumnDescriptor( true );
390 }
391 // -----------------------------------------------------------------------------
392 sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames)
393 {
394     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" );
395     Reference<XDatabaseMetaData> xMeta = getMetaData();
396     OColumns* pCol = new OColumns(*this, m_aMutex, NULL, isCaseSensitive(), _rNames, this,this,
397                                     getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithAddColumn()),
398                                     getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithDropColumn()));
399     static_cast<OColumnsHelper*>(pCol)->setParent(this);
400     pCol->setParent(*this);
401     m_pColumnMediator = new OContainerMediator( pCol, m_xColumnDefinitions, getConnection(), OContainerMediator::eColumns );
402     pCol->setMediator( m_pColumnMediator.get() );
403     return pCol;
404 }
405 // -----------------------------------------------------------------------------
406 sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames)
407 {
408     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createKeys" );
409     return new connectivity::OKeysHelper(this,m_aMutex,_rNames);
410 }
411 // -----------------------------------------------------------------------------
412 sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames)
413 {
414     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createIndexes" );
415     return new OIndexes(this,m_aMutex,_rNames,NULL);
416 }
417 // -----------------------------------------------------------------------------
418