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 "NTable.hxx"
28 #include "NTables.hxx"
29 #include "NColumns.hxx"
30 #ifndef _CONNECTIVITY_EVOAB_CATALOG_HXX__
31 #include "NCatalog.hxx"
32 #endif
33 
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::sdbcx;
39 using namespace ::com::sun::star::sdbc;
40 using namespace ::com::sun::star::container;
41 using namespace ::com::sun::star::lang;
42 using namespace connectivity::evoab;
43 // -------------------------------------------------------------------------
OEvoabTable(sdbcx::OCollection * _pTables,OEvoabConnection * _pConnection,const::rtl::OUString & _Name,const::rtl::OUString & _Type,const::rtl::OUString & _Description,const::rtl::OUString & _SchemaName,const::rtl::OUString & _CatalogName)44 OEvoabTable::OEvoabTable( sdbcx::OCollection* _pTables,
45 	            OEvoabConnection* _pConnection,
46 	            const ::rtl::OUString& _Name,
47 	            const ::rtl::OUString& _Type,
48 	            const ::rtl::OUString& _Description ,
49 	            const ::rtl::OUString& _SchemaName,
50 	            const ::rtl::OUString& _CatalogName
51 	            ) : OEvoabTable_TYPEDEF(_pTables,sal_True,
52 	                              _Name,
53 	                              _Type,
54 	                              _Description,
55 	                              _SchemaName,
56 	                              _CatalogName),
57 	                m_pConnection(_pConnection)
58 {
59 	construct();
60 }
61 // -------------------------------------------------------------------------
refreshColumns()62 void OEvoabTable::refreshColumns()
63 {
64 	TStringVector aVector;
65 
66 	if (!isNew())
67 	{
68 	    Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(
69 				Any(),
70 				m_SchemaName,
71 				m_Name,
72 				::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")));
73 
74 	    if (xResult.is())
75 	    {
76 		Reference< XRow > xRow(xResult, UNO_QUERY);
77 		while (xResult->next())
78 				aVector.push_back(xRow->getString(4));
79 	    }
80 	}
81 	if (m_pColumns)
82 	    m_pColumns->reFill(aVector);
83 	else
84 	    m_pColumns  = new OEvoabColumns(this,m_aMutex,aVector);
85 }
86