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