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_connectivity.hxx"
30 #include "ado/ADatabaseMetaData.hxx"
31 #include "ado/ADatabaseMetaDataResultSetMetaData.hxx"
32 #include "ado/Awrapado.hxx"
33 #include "ado/AGroup.hxx"
34 #include "ado/adoimp.hxx"
35 #include "ado/AIndex.hxx"
36 #include "ado/AKey.hxx"
37 #include "ado/ATable.hxx"
38 #include <com/sun/star/sdbc/DataType.hpp>
39 #include <com/sun/star/sdbc/ProcedureResult.hpp>
40 #include <com/sun/star/sdbc/ColumnValue.hpp>
41 #ifdef DELETE
42 #undef DELETE
43 #endif
44 #include <com/sun/star/sdbcx/Privilege.hpp>
45 #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
46 #include <com/sun/star/sdbc/KeyRule.hpp>
47 #include <com/sun/star/sdbcx/KeyType.hpp>
48 
49 using namespace connectivity::ado;
50 using namespace ::com::sun::star::sdbc;
51 using namespace ::com::sun::star::sdbcx;
52 using namespace ::com::sun::star::uno;
53 
54 // -------------------------------------------------------------------------
55 void ODatabaseMetaData::fillLiterals()
56 {
57 	ADORecordset *pRecordset = NULL;
58 	OLEVariant  vtEmpty;
59 	vtEmpty.setNoArg();
60 	m_pADOConnection->OpenSchema(adSchemaDBInfoLiterals,vtEmpty,vtEmpty,&pRecordset);
61 
62 	ADOS::ThrowException(*m_pADOConnection,*this);
63 
64 	OSL_ENSURE(pRecordset,"fillLiterals: no resultset!");
65 	if ( pRecordset )
66 	{
67 		WpADORecordset aRecordset(pRecordset);
68 
69 		aRecordset.MoveFirst();
70 		OLEVariant  aValue;
71 		LiteralInfo aInfo;
72 		while(!aRecordset.IsAtEOF())
73 		{
74 			WpOLEAppendCollection<ADOFields, ADOField, WpADOField>	aFields(aRecordset.GetFields());
75 			WpADOField aField(aFields.GetItem(1));
76 			aInfo.pwszLiteralValue = aField.get_Value();
77 			aField = aFields.GetItem(5);
78 			aInfo.fSupported = aField.get_Value();
79 			aField = aFields.GetItem(6);
80 			aInfo.cchMaxLen = aField.get_Value().getUInt32();
81 
82 			aField = aFields.GetItem(4);
83 			sal_uInt32 nId = aField.get_Value().getUInt32();
84 			m_aLiteralInfo[nId] = aInfo;
85 
86 			aRecordset.MoveNext();
87 		}
88 		aRecordset.Close();
89 	}
90 }
91 // -------------------------------------------------------------------------
92 sal_Int32 ODatabaseMetaData::getMaxSize(sal_uInt32 _nId)
93 {
94 	if(!m_aLiteralInfo.size())
95 		fillLiterals();
96 
97 	sal_Int32 nSize = 0;
98 	::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
99 	if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported)
100 		nSize = ((*aIter).second.cchMaxLen == (-1)) ? 0 : (*aIter).second.cchMaxLen;
101 	return nSize;
102 }
103 // -------------------------------------------------------------------------
104 sal_Bool ODatabaseMetaData::isCapable(sal_uInt32 _nId)
105 {
106 	if(!m_aLiteralInfo.size())
107 		fillLiterals();
108 	sal_Bool bSupported = sal_False;
109 	::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
110 	if(aIter != m_aLiteralInfo.end())
111 		bSupported = (*aIter).second.fSupported;
112 	return bSupported;
113 }
114 
115 // -------------------------------------------------------------------------
116 ::rtl::OUString ODatabaseMetaData::getLiteral(sal_uInt32 _nId)
117 {
118 	if(!m_aLiteralInfo.size())
119 		fillLiterals();
120 	::rtl::OUString sStr;
121 	::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId);
122 	if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported)
123 		sStr = (*aIter).second.pwszLiteralValue;
124 	return sStr;
125 }
126 // -----------------------------------------------------------------------------
127 // -------------------------------------------------------------------------
128 void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap()
129 {
130 	m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"),
131 		ColumnValue::NULLABLE,
132 		3,3,0,
133 		DataType::VARCHAR);
134 }
135 // -------------------------------------------------------------------------
136 void ODatabaseMetaDataResultSetMetaData::setColumnsMap()
137 {
138 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"),
139 		ColumnValue::NO_NULLS,
140 		0,0,0,
141 		DataType::VARCHAR);
142 	m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
143 		ColumnValue::NO_NULLS,
144 		1,1,0,
145 		DataType::INTEGER);
146 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
147 		ColumnValue::NULLABLE,
148 		0,0,0,
149 		DataType::VARCHAR);
150 	m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_DEF"),
151 		ColumnValue::NULLABLE,
152 		0,0,0,
153 		DataType::VARCHAR);
154 	m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"),
155 		ColumnValue::NO_NULLS,
156 		1,1,0,
157 		DataType::INTEGER);
158 	m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"),
159 		ColumnValue::NO_NULLS,
160 		1,1,0,
161 		DataType::INTEGER);
162 	m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CHAR_OCTET_LENGTH"),
163 		ColumnValue::NO_NULLS,
164 		1,1,0,
165 		DataType::INTEGER);
166 }
167 // -------------------------------------------------------------------------
168 void ODatabaseMetaDataResultSetMetaData::setTablesMap()
169 {
170 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
171 		ColumnValue::NULLABLE,
172 		0,0,0,
173 		DataType::VARCHAR);
174 }
175 // -------------------------------------------------------------------------
176 void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap()
177 {
178 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
179 		ColumnValue::NO_NULLS,
180 		1,1,0,
181 		DataType::INTEGER);
182 }
183 // -------------------------------------------------------------------------
184 void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap()
185 {
186 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"),
187 		ColumnValue::NO_NULLS,
188 		1,1,0,
189 		DataType::INTEGER);
190 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"),
191 		ColumnValue::NULLABLE,
192 		0,0,0,
193 		DataType::VARCHAR);
194 }
195 // -------------------------------------------------------------------------
196 void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap()
197 {
198 	m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NON_UNIQUE"),
199 		ColumnValue::NO_NULLS,
200 		1,1,0,
201 		DataType::BIT);
202 	m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_QUALIFIER"),
203 		ColumnValue::NULLABLE,
204 		0,0,0,
205 		DataType::VARCHAR);
206 	m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ASC_OR_DESC"),
207 		ColumnValue::NULLABLE,
208 		0,0,0,
209 		DataType::VARCHAR);
210 }
211 // -------------------------------------------------------------------------
212 void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap()
213 {
214 	m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"),
215 		ColumnValue::NULLABLE,
216 		0,0,0,
217 		DataType::VARCHAR);
218 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"),
219 		ColumnValue::NULLABLE,
220 		0,0,0,
221 		DataType::VARCHAR);
222 }
223 // -------------------------------------------------------------------------
224 void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap()
225 {
226 	m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"),
227 		ColumnValue::NO_NULLS,
228 		1,1,0,
229 		DataType::INTEGER);
230 }
231 // -------------------------------------------------------------------------
232 void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap()
233 {
234 	m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"),
235 		ColumnValue::NO_NULLS,
236 		1,1,0,
237 		DataType::INTEGER);
238 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"),
239 		ColumnValue::NO_NULLS,
240 		1,1,0,
241 		DataType::INTEGER);
242 	m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("AUTO_INCREMENT"),
243 		ColumnValue::NO_NULLS,
244 		1,1,0,
245 		DataType::BIT);
246 	m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"),
247 		ColumnValue::NO_NULLS,
248 		1,1,0,
249 		DataType::INTEGER);
250 	m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"),
251 		ColumnValue::NO_NULLS,
252 		1,1,0,
253 		DataType::INTEGER);
254 	m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"),
255 		ColumnValue::NO_NULLS,
256 		1,1,0,
257 		DataType::INTEGER);
258 }
259 // -------------------------------------------------------------------------
260 void ODatabaseMetaDataResultSetMetaData::setProceduresMap()
261 {
262 	m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"),
263 		ColumnValue::NULLABLE,
264 		0,0,0,
265 		DataType::VARCHAR);
266 }
267 // -------------------------------------------------------------------------
268 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
269 {
270 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
271 		return (*m_mColumnsIter).second.isSearchable();
272 	return sal_True;
273 }
274 // -------------------------------------------------------------------------
275 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
276 {
277 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
278 		return (*m_mColumnsIter).second.isAutoIncrement();
279 	return sal_False;
280 }
281 // -------------------------------------------------------------------------
282 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
283 {
284 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
285 		return (*m_mColumnsIter).second.getColumnServiceName();
286 	return ::rtl::OUString();
287 }
288 // -------------------------------------------------------------------------
289 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
290 {
291 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
292 		return (*m_mColumnsIter).second.getTableName();
293 	return ::rtl::OUString();
294 }
295 // -------------------------------------------------------------------------
296 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
297 {
298 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
299 		return (*m_mColumnsIter).second.getCatalogName();
300 	return ::rtl::OUString();
301 }
302 // -------------------------------------------------------------------------
303 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
304 {
305 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
306 		return (*m_mColumnsIter).second.getColumnTypeName();
307 	return ::rtl::OUString();
308 }
309 // -------------------------------------------------------------------------
310 
311 sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
312 {
313 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
314 		return (*m_mColumnsIter).second.isCaseSensitive();
315 	return sal_True;
316 }
317 // -------------------------------------------------------------------------
318 
319 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
320 {
321 	if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
322 		return (*m_mColumnsIter).second.getSchemaName();
323 	return ::rtl::OUString();
324 }
325 // -----------------------------------------------------------------------------
326 // -------------------------------------------------------------------------
327 ObjectTypeEnum OAdoGroup::MapObjectType(sal_Int32 _ObjType)
328 {
329 	ObjectTypeEnum eNumType= adPermObjTable;
330 	switch(_ObjType)
331 	{
332         case PrivilegeObject::TABLE:
333 			break;
334         case PrivilegeObject::VIEW:
335 			eNumType = adPermObjView;
336 			break;
337         case PrivilegeObject::COLUMN:
338 			eNumType = adPermObjColumn;
339 			break;
340 	}
341 	return eNumType;
342 }
343 // -------------------------------------------------------------------------
344 sal_Int32 OAdoGroup::MapRight(RightsEnum _eNum)
345 {
346 	sal_Int32 nRight = 0;
347 	if(_eNum & adRightRead)
348                 nRight |= Privilege::SELECT;
349 	if(_eNum & adRightInsert)
350                 nRight |= Privilege::INSERT;
351 	if(_eNum & adRightUpdate)
352                 nRight |= Privilege::UPDATE;
353 	if(_eNum & adRightDelete)
354                 nRight |= Privilege::DELETE;
355 	if(_eNum & adRightReadDesign)
356                 nRight |= Privilege::READ;
357 	if(_eNum & adRightCreate)
358                 nRight |= Privilege::CREATE;
359 	if(_eNum & adRightWriteDesign)
360                 nRight |= Privilege::ALTER;
361 	if(_eNum & adRightReference)
362                 nRight |= Privilege::REFERENCE;
363 	if(_eNum & adRightDrop)
364                 nRight |= Privilege::DROP;
365 
366 	return nRight;
367 }
368 // -------------------------------------------------------------------------
369 RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum)
370 {
371 	sal_Int32 nRight = adRightNone;
372         if(_eNum & Privilege::SELECT)
373 		nRight |= adRightRead;
374 
375         if(_eNum & Privilege::INSERT)
376 		nRight |= adRightInsert;
377 
378         if(_eNum & Privilege::UPDATE)
379 		nRight |= adRightUpdate;
380 
381         if(_eNum & Privilege::DELETE)
382 		nRight |= adRightDelete;
383 
384         if(_eNum & Privilege::READ)
385 		nRight |= adRightReadDesign;
386 
387         if(_eNum & Privilege::CREATE)
388 		nRight |= adRightCreate;
389 
390         if(_eNum & Privilege::ALTER)
391 		nRight |= adRightWriteDesign;
392 
393         if(_eNum & Privilege::REFERENCE)
394 		nRight |= adRightReference;
395 
396         if(_eNum & Privilege::DROP)
397 		nRight |= adRightDrop;
398 
399 	return (RightsEnum)nRight;
400 }
401 // -------------------------------------------------------------------------
402 void WpADOIndex::Create()
403 {
404 	HRESULT         hr = -1;
405 
406 	_ADOIndex* pIndex = NULL;
407 	hr = CoCreateInstance(ADOS::CLSID_ADOINDEX_25,
408 						  NULL,
409 						  CLSCTX_INPROC_SERVER,
410 						  ADOS::IID_ADOINDEX_25,
411 						  (void**)&pIndex );
412 
413 
414 	if( !FAILED( hr ) )
415 	{
416 		operator=( pIndex );
417 		pIndex->Release();
418 	}
419 }
420 // -------------------------------------------------------------------------
421 void OAdoIndex::fillPropertyValues()
422 {
423 	if(m_aIndex.IsValid())
424 	{
425 		m_Name				= m_aIndex.get_Name();
426 		m_IsUnique			= m_aIndex.get_Unique();
427         m_IsPrimaryKeyIndex = m_aIndex.get_PrimaryKey();
428 		m_IsClustered		= m_aIndex.get_Clustered();
429 	}
430 }
431 // -----------------------------------------------------------------------------
432 void WpADOKey::Create()
433 {
434 	HRESULT         hr = -1;
435 	_ADOKey* pKey = NULL;
436 	hr = CoCreateInstance(ADOS::CLSID_ADOKEY_25,
437 						  NULL,
438 						  CLSCTX_INPROC_SERVER,
439 						  ADOS::IID_ADOKEY_25,
440 						  (void**)&pKey );
441 
442 
443 	if( !FAILED( hr ) )
444 	{
445 		operator=( pKey );
446 		pKey->Release();
447 	}
448 }
449 // -------------------------------------------------------------------------
450 void OAdoKey::fillPropertyValues()
451 {
452 	if(m_aKey.IsValid())
453 	{
454 		m_aProps->m_Type			= MapKeyRule(m_aKey.get_Type());
455 		m_Name			            = m_aKey.get_Name();
456 		m_aProps->m_ReferencedTable	= m_aKey.get_RelatedTable();
457 		m_aProps->m_UpdateRule		= MapRule(m_aKey.get_UpdateRule());
458 		m_aProps->m_DeleteRule		= MapRule(m_aKey.get_DeleteRule());
459 	}
460 }
461 // -------------------------------------------------------------------------
462 sal_Int32 OAdoKey::MapRule(const RuleEnum& _eNum)
463 {
464         sal_Int32 eNum = KeyRule::NO_ACTION;
465 	switch(_eNum)
466 	{
467 		case adRICascade:
468 			eNum = KeyRule::CASCADE;
469 			break;
470 		case adRISetNull:
471             eNum = KeyRule::SET_NULL;
472 			break;
473 		case adRINone:
474             eNum = KeyRule::NO_ACTION;
475 			break;
476 		case adRISetDefault:
477             eNum = KeyRule::SET_DEFAULT;
478 			break;
479 	}
480 	return eNum;
481 }
482 // -------------------------------------------------------------------------
483 RuleEnum OAdoKey::Map2Rule(const sal_Int32& _eNum)
484 {
485 	RuleEnum eNum = adRINone;
486 	switch(_eNum)
487 	{
488 		case KeyRule::CASCADE:
489 			eNum = adRICascade;
490 			break;
491         case KeyRule::SET_NULL:
492 			eNum = adRISetNull;
493 			break;
494         case KeyRule::NO_ACTION:
495 			eNum = adRINone;
496 			break;
497         case KeyRule::SET_DEFAULT:
498 			eNum = adRISetDefault;
499 			break;
500 	}
501 	return eNum;
502 }
503 // -------------------------------------------------------------------------
504 sal_Int32 OAdoKey::MapKeyRule(const KeyTypeEnum& _eNum)
505 {
506 	sal_Int32 nKeyType = KeyType::PRIMARY;
507 	switch(_eNum)
508 	{
509 		case adKeyPrimary:
510 			nKeyType = KeyType::PRIMARY;
511 			break;
512 		case adKeyForeign:
513 			nKeyType = KeyType::FOREIGN;
514 			break;
515 		case adKeyUnique:
516 			nKeyType = KeyType::UNIQUE;
517 			break;
518 	}
519 	return nKeyType;
520 }
521 // -------------------------------------------------------------------------
522 KeyTypeEnum OAdoKey::Map2KeyRule(const sal_Int32& _eNum)
523 {
524     KeyTypeEnum eNum( adKeyPrimary );
525 	switch(_eNum)
526 	{
527 		case KeyType::PRIMARY:
528 			eNum = adKeyPrimary;
529 			break;
530         case KeyType::FOREIGN:
531 			eNum = adKeyForeign;
532 			break;
533         case KeyType::UNIQUE:
534 			eNum = adKeyUnique;
535 			break;
536         default:
537             OSL_ENSURE( false, "OAdoKey::Map2KeyRule: invalid key type!" );
538 	}
539 	return eNum;
540 }
541 // -----------------------------------------------------------------------------
542 void WpADOTable::Create()
543 {
544 	HRESULT         hr = -1;
545 	_ADOTable* pTable = NULL;
546 	hr = CoCreateInstance(ADOS::CLSID_ADOTABLE_25,
547 						  NULL,
548 						  CLSCTX_INPROC_SERVER,
549 						  ADOS::IID_ADOTABLE_25,
550 						  (void**)&pTable );
551 
552 
553 	if( !FAILED( hr ) )
554 	{
555 		operator=( pTable );
556 		pTable->Release();
557 	}
558 }
559 // -------------------------------------------------------------------------
560 ::rtl::OUString WpADOCatalog::GetObjectOwner(const ::rtl::OUString& _rName, ObjectTypeEnum _eNum)
561 {
562 	OLEVariant _rVar;
563 	_rVar.setNoArg();
564 	OLEString aBSTR;
565 	OLEString sStr1(_rName);
566 	pInterface->GetObjectOwner(sStr1,_eNum,_rVar,&aBSTR);
567 	return aBSTR;
568 }
569 // -----------------------------------------------------------------------------
570 void OAdoTable::fillPropertyValues()
571 {
572 	if(m_aTable.IsValid())
573 	{
574 		m_Name	= m_aTable.get_Name();
575 		m_Type	= m_aTable.get_Type();
576 		{
577 			WpADOCatalog aCat(m_aTable.get_ParentCatalog());
578 			if(aCat.IsValid())
579 				m_CatalogName = aCat.GetObjectOwner(m_aTable.get_Name(),adPermObjTable);
580 		}
581 		{
582 			WpADOProperties aProps = m_aTable.get_Properties();
583 			if(aProps.IsValid())
584 				m_Description = OTools::getValue(aProps,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description")));
585 		}
586 	}
587 }
588 // -----------------------------------------------------------------------------
589 void WpADOUser::Create()
590 {
591 	HRESULT         hr = -1;
592 	_ADOUser* pUser = NULL;
593 	hr = CoCreateInstance(ADOS::CLSID_ADOUSER_25,
594 						  NULL,
595 						  CLSCTX_INPROC_SERVER,
596 						  ADOS::IID_ADOUSER_25,
597 						  (void**)&pUser );
598 
599 
600 	if( !FAILED( hr ) )
601 	{
602 		operator=( pUser );
603 		pUser->Release();
604 	}
605 }
606 // -------------------------------------------------------------------------
607 
608 
609