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