xref: /aoo41x/main/dbaccess/source/core/api/table.cxx (revision 96de5490)
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) throw(SQLException)
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 				throw(SQLException)
101 	:OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers())
102 	,m_nPrivileges(-1)
103 {
104     DBG_CTOR(ODBTable, NULL);
105     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" );
106 }
107 // -------------------------------------------------------------------------
~ODBTable()108 ODBTable::~ODBTable()
109 {
110 	DBG_DTOR(ODBTable, NULL);
111 }
112 // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base)113 IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base)
114 
115 //--------------------------------------------------------------------------
116 OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const
117 {
118     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumn" );
119 	OColumn* pReturn = NULL;
120 
121 	Reference<XPropertySet> xProp;
122 	if ( m_xDriverColumns.is() && m_xDriverColumns->hasByName(_rName) )
123 	{
124 		xProp.set(m_xDriverColumns->getByName(_rName),UNO_QUERY);
125 	}
126 	else
127 	{
128 		OColumns* pColumns = static_cast<OColumns*>(m_pColumns);
129 		xProp.set(pColumns->createBaseObject(_rName),UNO_QUERY);
130 	}
131 
132 	Reference<XPropertySet> xColumnDefintion;
133 	if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
134 		xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
135 	pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
136 
137 	return pReturn;
138 }
139 // -----------------------------------------------------------------------------
columnAppended(const Reference<XPropertySet> &)140 void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ )
141 {
142     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnAppended" );
143     // not interested in
144 }
145 // -----------------------------------------------------------------------------
columnDropped(const::rtl::OUString & _sName)146 void ODBTable::columnDropped(const ::rtl::OUString& _sName)
147 {
148     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnDropped" );
149 	Reference<XDrop> xDrop(m_xColumnDefinitions,UNO_QUERY);
150 	if ( xDrop.is() && m_xColumnDefinitions->hasByName(_sName) )
151 	{
152 		xDrop->dropByName(_sName);
153 	}
154 }
155 //--------------------------------------------------------------------------
getImplementationId()156 Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException)
157 {
158     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getImplementationId" );
159 	static OImplementationId * pId = 0;
160 	if (! pId)
161 	{
162 		MutexGuard aGuard( Mutex::getGlobalMutex() );
163 		if (! pId)
164 		{
165 			static OImplementationId aId;
166 			pId = &aId;
167 		}
168 	}
169 	return pId->getImplementationId();
170 }
171 
172 // OComponentHelper
173 //------------------------------------------------------------------------------
disposing()174 void SAL_CALL ODBTable::disposing()
175 {
176     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::disposing" );
177 	OPropertySetHelper::disposing();
178 	OTable_Base::disposing();
179 	m_xColumnDefinitions = NULL;
180 	m_xDriverColumns = NULL;
181 	m_pColumnMediator = NULL;
182 }
183 
184 //------------------------------------------------------------------------------
getFastPropertyValue(Any & _rValue,sal_Int32 _nHandle) const185 void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
186 {
187     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getFastPropertyValue" );
188 	if ((PROPERTY_ID_PRIVILEGES == _nHandle) && (-1 == m_nPrivileges))
189 	{	// somebody is asking for the privileges an we do not know them, yet
190 		const_cast<ODBTable*>(this)->m_nPrivileges = ::dbtools::getTablePrivileges(getMetaData(),m_CatalogName,m_SchemaName, m_Name);
191 	}
192 
193 	OTable_Base::getFastPropertyValue(_rValue, _nHandle);
194 }
195 // -------------------------------------------------------------------------
construct()196 void ODBTable::construct()
197 {
198     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::construct" );
199 	::osl::MutexGuard aGuard(m_aMutex);
200 
201 	// we don't collect the privileges here, this is potentially expensive. Instead we determine them on request.
202 	// (see getFastPropertyValue)
203 	m_nPrivileges = -1;
204 
205 	OTable_Base::construct();
206 
207 	registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
208 					&m_sFilter, ::getCppuType(&m_sFilter));
209 
210 	registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
211 					&m_sOrder, ::getCppuType(&m_sOrder));
212 
213 	registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
214 					&m_bApplyFilter, ::getBooleanCppuType());
215 
216 	registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
217 					&m_aFont, ::getCppuType(&m_aFont));
218 
219 	registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
220 					&m_aRowHeight, ::getCppuType(static_cast<sal_Int32*>(NULL)));
221 
222 	registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
223 					&m_aTextColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
224 
225 	registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, PropertyAttribute::BOUND | PropertyAttribute::READONLY,
226 					&m_nPrivileges, ::getCppuType(static_cast<sal_Int32*>(NULL)));
227 
228 	registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
229 					&m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
230 
231 	registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
232 					&m_nFontEmphasis, ::getCppuType(&m_nFontEmphasis));
233 
234 	registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,
235 					&m_nFontRelief, ::getCppuType(&m_nFontRelief));
236 
237 	registerProperty(PROPERTY_FONTNAME,			PROPERTY_ID_FONTNAME,		 PropertyAttribute::BOUND,&m_aFont.Name,			::getCppuType(&m_aFont.Name));
238 	registerProperty(PROPERTY_FONTHEIGHT,		PROPERTY_ID_FONTHEIGHT,		 PropertyAttribute::BOUND,&m_aFont.Height,			::getCppuType(&m_aFont.Height));
239 	registerProperty(PROPERTY_FONTWIDTH,		PROPERTY_ID_FONTWIDTH,		 PropertyAttribute::BOUND,&m_aFont.Width,			::getCppuType(&m_aFont.Width));
240 	registerProperty(PROPERTY_FONTSTYLENAME,	PROPERTY_ID_FONTSTYLENAME,	 PropertyAttribute::BOUND,&m_aFont.StyleName,		::getCppuType(&m_aFont.StyleName));
241 	registerProperty(PROPERTY_FONTFAMILY,		PROPERTY_ID_FONTFAMILY,		 PropertyAttribute::BOUND,&m_aFont.Family,			::getCppuType(&m_aFont.Family));
242 	registerProperty(PROPERTY_FONTCHARSET,		PROPERTY_ID_FONTCHARSET,	 PropertyAttribute::BOUND,&m_aFont.CharSet,			::getCppuType(&m_aFont.CharSet));
243 	registerProperty(PROPERTY_FONTPITCH,		PROPERTY_ID_FONTPITCH,		 PropertyAttribute::BOUND,&m_aFont.Pitch,			::getCppuType(&m_aFont.Pitch));
244 	registerProperty(PROPERTY_FONTCHARWIDTH,	PROPERTY_ID_FONTCHARWIDTH,	 PropertyAttribute::BOUND,&m_aFont.CharacterWidth,	::getCppuType(&m_aFont.CharacterWidth));
245 	registerProperty(PROPERTY_FONTWEIGHT,		PROPERTY_ID_FONTWEIGHT,		 PropertyAttribute::BOUND,&m_aFont.Weight,			::getCppuType(&m_aFont.Weight));
246 	registerProperty(PROPERTY_FONTSLANT,		PROPERTY_ID_FONTSLANT,		 PropertyAttribute::BOUND,&m_aFont.Slant,			::getCppuType(&m_aFont.Slant));
247 	registerProperty(PROPERTY_FONTUNDERLINE,	PROPERTY_ID_FONTUNDERLINE,	 PropertyAttribute::BOUND,&m_aFont.Underline,		::getCppuType(&m_aFont.Underline));
248 	registerProperty(PROPERTY_FONTSTRIKEOUT,	PROPERTY_ID_FONTSTRIKEOUT,	 PropertyAttribute::BOUND,&m_aFont.Strikeout,		::getCppuType(&m_aFont.Strikeout));
249 	registerProperty(PROPERTY_FONTORIENTATION,	PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&m_aFont.Orientation,		::getCppuType(&m_aFont.Orientation));
250 	registerProperty(PROPERTY_FONTKERNING,		PROPERTY_ID_FONTKERNING,	 PropertyAttribute::BOUND,&m_aFont.Kerning,			::getCppuType(&m_aFont.Kerning));
251 	registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&m_aFont.WordLineMode,	::getCppuType(&m_aFont.WordLineMode));
252 	registerProperty(PROPERTY_FONTTYPE,			PROPERTY_ID_FONTTYPE,		 PropertyAttribute::BOUND,&m_aFont.Type,			::getCppuType(&m_aFont.Type));
253 
254 	refreshColumns();
255 }
256 // -----------------------------------------------------------------------------
createArrayHelper(sal_Int32 _nId) const257 ::cppu::IPropertyArrayHelper* ODBTable::createArrayHelper( sal_Int32 _nId) const
258 {
259     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createArrayHelper" );
260 	Sequence< Property > aProps;
261 	describeProperties(aProps);
262 	if(!_nId)
263 	{
264 		Property* pIter	= aProps.getArray();
265 		Property* pEnd	= pIter + aProps.getLength();
266 		for(;pIter != pEnd;++pIter)
267 		{
268 			if (0 == pIter->Name.compareToAscii(PROPERTY_CATALOGNAME))
269 				pIter->Attributes = PropertyAttribute::READONLY;
270 			else if (0 == pIter->Name.compareToAscii(PROPERTY_SCHEMANAME))
271 				pIter->Attributes = PropertyAttribute::READONLY;
272 			else if (0 == pIter->Name.compareToAscii(PROPERTY_DESCRIPTION))
273 				pIter->Attributes = PropertyAttribute::READONLY;
274 			else if (0 == pIter->Name.compareToAscii(PROPERTY_NAME))
275 				pIter->Attributes = PropertyAttribute::READONLY;
276 		}
277 	}
278 
279 	return new ::cppu::OPropertyArrayHelper(aProps);
280 }
281 // -----------------------------------------------------------------------------
getInfoHelper()282 ::cppu::IPropertyArrayHelper & SAL_CALL ODBTable::getInfoHelper()
283 {
284 	return *ODBTable_PROP::getArrayHelper(isNew() ? 1 : 0);
285 }
286 // -------------------------------------------------------------------------
287 // XServiceInfo
288 IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE)
289 // -------------------------------------------------------------------------
queryInterface(const Type & rType)290 Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException)
291 {
292     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" );
293 	if(rType == getCppuType( (Reference<XRename>*)0) && !getRenameService().is() )
294 		return Any();
295 	if(rType == getCppuType( (Reference<XAlterTable>*)0) && !getAlterService().is() )
296 		return Any();
297 	return OTable_Base::queryInterface( rType);
298 }
299 // -------------------------------------------------------------------------
getTypes()300 Sequence< Type > SAL_CALL ODBTable::getTypes(  ) throw(RuntimeException)
301 {
302     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getTypes" );
303 	Type aRenameType = getCppuType( (Reference<XRename>*)0);
304 	Type aAlterType = getCppuType( (Reference<XAlterTable>*)0);
305 
306 	Sequence< Type > aTypes(OTable_Base::getTypes());
307 	::std::vector<Type> aOwnTypes;
308 	aOwnTypes.reserve(aTypes.getLength());
309 
310 	const Type* pIter = aTypes.getConstArray();
311 	const Type* pEnd = pIter + aTypes.getLength();
312 	for(;pIter != pEnd ;++pIter)
313 	{
314 		if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is()))
315 			aOwnTypes.push_back(*pIter);
316 	}
317 
318 	Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
319 	return Sequence< Type >(pTypes, aOwnTypes.size());
320 }
321 // XRename,
322 //------------------------------------------------------------------------------
rename(const::rtl::OUString & _rNewName)323 void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException)
324 {
325     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" );
326     ::osl::MutexGuard aGuard(m_aMutex);
327 	checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
328     if ( !getRenameService().is() )
329 	    throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
330 
331     Reference<XPropertySet> xTable(this);
332     getRenameService()->rename(xTable,_rNewName);
333     ::connectivity::OTable_TYPEDEF::rename(_rNewName);
334 }
335 
336 // XAlterTable,
337 //------------------------------------------------------------------------------
alterColumnByName(const::rtl::OUString & _rName,const Reference<XPropertySet> & _rxDescriptor)338 void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
339 {
340     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" );
341 	::osl::MutexGuard aGuard(m_aMutex);
342 	checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
343     if ( !getAlterService().is() )
344 	    throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
345 
346     if ( !m_pColumns->hasByName(_rName) )
347         throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() );
348 
349     Reference<XPropertySet> xTable(this);
350     getAlterService()->alterColumnByName(xTable,_rName,_rxDescriptor);
351 	m_pColumns->refresh();
352 }
353 // -----------------------------------------------------------------------------
getSomething(const Sequence<sal_Int8> & rId)354 sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
355 {
356     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getSomething" );
357 	sal_Int64 nRet(0);
358 	if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
359 		nRet = reinterpret_cast<sal_Int64>(this);
360 	else
361 		nRet = OTable_Base::getSomething(rId);
362 
363 	return nRet;
364 }
365 // -----------------------------------------------------------------------------
getUnoTunnelImplementationId()366 Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
367 {
368     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getUnoTunnelImplementationId" );
369 	static ::cppu::OImplementationId * pId = 0;
370 	if (! pId)
371 	{
372 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
373 		if (! pId)
374 		{
375 			static ::cppu::OImplementationId aId;
376 			pId = &aId;
377 		}
378 	}
379 	return pId->getImplementationId();
380 }
381 // -----------------------------------------------------------------------------
createColumnDescriptor()382 Reference< XPropertySet > ODBTable::createColumnDescriptor()
383 {
384     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" );
385 	return new OTableColumnDescriptor( true );
386 }
387 // -----------------------------------------------------------------------------
createColumns(const TStringVector & _rNames)388 sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames)
389 {
390     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" );
391 	Reference<XDatabaseMetaData> xMeta = getMetaData();
392 	OColumns* pCol = new OColumns(*this, m_aMutex, NULL, isCaseSensitive(), _rNames, this,this,
393 									getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithAddColumn()),
394 									getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithDropColumn()));
395 	static_cast<OColumnsHelper*>(pCol)->setParent(this);
396 	pCol->setParent(*this);
397 	m_pColumnMediator = new OContainerMediator( pCol, m_xColumnDefinitions, getConnection(), OContainerMediator::eColumns );
398 	pCol->setMediator( m_pColumnMediator.get() );
399 	return pCol;
400 }
401 // -----------------------------------------------------------------------------
createKeys(const TStringVector & _rNames)402 sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames)
403 {
404     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createKeys" );
405 	return new connectivity::OKeysHelper(this,m_aMutex,_rNames);
406 }
407 // -----------------------------------------------------------------------------
createIndexes(const TStringVector & _rNames)408 sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames)
409 {
410     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createIndexes" );
411 	return new OIndexes(this,m_aMutex,_rNames,NULL);
412 }
413 // -----------------------------------------------------------------------------
414