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