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_connectivity.hxx"
26 
27 #include "NColumns.hxx"
28 #include "NTable.hxx"
29 #include "NTables.hxx"
30 #include "NCatalog.hxx"
31 #include "connectivity/sdbcx/VColumn.hxx"
32 
33 using namespace connectivity::sdbcx;
34 using namespace connectivity;
35 using namespace ::comphelper;
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::beans;
38 using namespace ::com::sun::star::sdbc;
39 using namespace ::com::sun::star::container;
40 using namespace ::com::sun::star::lang;
41 using namespace connectivity::evoab;
42 
43 // -------------------------------------------------------------------------
createObject(const::rtl::OUString & _rName)44 sdbcx::ObjectType OEvoabColumns::createObject(const ::rtl::OUString& _rName)
45 {
46 	Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(
47 		Any(),
48 		m_pTable->getSchema(),
49 		m_pTable->getTableName(),
50 		_rName);
51 
52 	sdbcx::ObjectType xRet = NULL;
53 	if (xResult.is())
54 	{
55 		Reference< XRow > xRow(xResult,UNO_QUERY);
56 
57 		while (xResult->next())
58 		{
59 			if (xRow->getString(4) == _rName)
60 			{
61 				OColumn* pRet = new OColumn(
62 						_rName,
63 						xRow->getString(6),
64 						xRow->getString(13),
65                         xRow->getString(12),
66 						xRow->getInt(11),
67 						xRow->getInt(7),
68 						xRow->getInt(9),
69 						xRow->getInt(5),
70 						sal_False,
71 						sal_False,
72 						sal_False,
73 						sal_True);
74 				xRet = pRet;
75 				break;
76 			}
77 		}
78 	}
79 
80 	return xRet;
81 }
82 // -------------------------------------------------------------------------
impl_refresh()83 void OEvoabColumns::impl_refresh() throw(RuntimeException)
84 {
85 	m_pTable->refreshColumns();
86 }
87