1*079eb577SAndrew Rist /**************************************************************
2*079eb577SAndrew Rist *
3*079eb577SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*079eb577SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*079eb577SAndrew Rist * distributed with this work for additional information
6*079eb577SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*079eb577SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*079eb577SAndrew Rist * "License"); you may not use this file except in compliance
9*079eb577SAndrew Rist * with the License. You may obtain a copy of the License at
10*079eb577SAndrew Rist *
11*079eb577SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*079eb577SAndrew Rist *
13*079eb577SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*079eb577SAndrew Rist * software distributed under the License is distributed on an
15*079eb577SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*079eb577SAndrew Rist * KIND, either express or implied. See the License for the
17*079eb577SAndrew Rist * specific language governing permissions and limitations
18*079eb577SAndrew Rist * under the License.
19*079eb577SAndrew Rist *
20*079eb577SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include "mysqlc_resultsetmetadata.hxx"
23cdf0e10cSrcweir #include "mysqlc_general.hxx"
24cdf0e10cSrcweir #include "cppconn/exception.h"
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
27cdf0e10cSrcweir
28cdf0e10cSrcweir using namespace connectivity::mysqlc;
29cdf0e10cSrcweir using namespace com::sun::star::uno;
30cdf0e10cSrcweir using namespace com::sun::star::lang;
31cdf0e10cSrcweir using namespace com::sun::star::sdbc;
32cdf0e10cSrcweir using ::rtl::OUString;
33cdf0e10cSrcweir
34cdf0e10cSrcweir // -------------------------------------------------------------------------
~OResultSetMetaData()35cdf0e10cSrcweir OResultSetMetaData::~OResultSetMetaData()
36cdf0e10cSrcweir {
37cdf0e10cSrcweir }
38cdf0e10cSrcweir /* }}} */
39cdf0e10cSrcweir
40cdf0e10cSrcweir
41cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnDisplaySize() -I- */
getColumnDisplaySize(sal_Int32 column)42cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize(sal_Int32 column)
43cdf0e10cSrcweir throw(SQLException, RuntimeException)
44cdf0e10cSrcweir {
45cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnDisplaySize");
46cdf0e10cSrcweir
47cdf0e10cSrcweir try {
48cdf0e10cSrcweir meta->getColumnDisplaySize(column);
49cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
50cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getColumnDisplaySize", *this);
51cdf0e10cSrcweir } catch (sql::SQLException &e) {
52cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
53cdf0e10cSrcweir }
54cdf0e10cSrcweir return 0; // fool compiler
55cdf0e10cSrcweir }
56cdf0e10cSrcweir /* }}} */
57cdf0e10cSrcweir
58cdf0e10cSrcweir
59cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnType() -I- */
getColumnType(sal_Int32 column)60cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
61cdf0e10cSrcweir throw(SQLException, RuntimeException)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnType");
64cdf0e10cSrcweir checkColumnIndex(column);
65cdf0e10cSrcweir
66cdf0e10cSrcweir try {
67cdf0e10cSrcweir return mysqlc_sdbc_driver::mysqlToOOOType(meta->getColumnType(column));
68cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
69cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
70cdf0e10cSrcweir } catch (sql::SQLException &e) {
71cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir return 0; // fool compiler
74cdf0e10cSrcweir }
75cdf0e10cSrcweir /* }}} */
76cdf0e10cSrcweir
77cdf0e10cSrcweir /*
78cdf0e10cSrcweir XXX: This method doesn't throw exceptions at all.
79cdf0e10cSrcweir Should it declare that it throws ?? What if throw() is removed?
80cdf0e10cSrcweir Does it change the API, the open-close principle?
81cdf0e10cSrcweir */
82cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnCount() -I- */
getColumnCount()83cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount()
84cdf0e10cSrcweir throw(SQLException, RuntimeException)
85cdf0e10cSrcweir {
86cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnCount");
87cdf0e10cSrcweir try {
88cdf0e10cSrcweir return meta->getColumnCount();
89cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
90cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
91cdf0e10cSrcweir } catch (sql::SQLException &e) {
92cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
93cdf0e10cSrcweir }
94cdf0e10cSrcweir return 0; // fool compiler
95cdf0e10cSrcweir }
96cdf0e10cSrcweir /* }}} */
97cdf0e10cSrcweir
98cdf0e10cSrcweir
99cdf0e10cSrcweir /* {{{ OResultSetMetaData::isCaseSensitive() -I- */
isCaseSensitive(sal_Int32 column)100cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column)
101cdf0e10cSrcweir throw(SQLException, RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isCaseSensitive");
104cdf0e10cSrcweir checkColumnIndex(column);
105cdf0e10cSrcweir
106cdf0e10cSrcweir try {
107cdf0e10cSrcweir return meta->isCaseSensitive(column);
108cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
109cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
110cdf0e10cSrcweir } catch (sql::SQLException &e) {
111cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
112cdf0e10cSrcweir }
113cdf0e10cSrcweir return sal_False; // fool compiler
114cdf0e10cSrcweir }
115cdf0e10cSrcweir /* }}} */
116cdf0e10cSrcweir
117cdf0e10cSrcweir
118cdf0e10cSrcweir /* {{{ OResultSetMetaData::getSchemaName() -I- */
getSchemaName(sal_Int32 column)119cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getSchemaName(sal_Int32 column)
120cdf0e10cSrcweir throw(SQLException, RuntimeException)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getSchemaName");
123cdf0e10cSrcweir checkColumnIndex(column);
124cdf0e10cSrcweir
125cdf0e10cSrcweir try {
126cdf0e10cSrcweir return convert(meta->getSchemaName(column));
127cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
128cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
129cdf0e10cSrcweir } catch (sql::SQLException &e) {
130cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
131cdf0e10cSrcweir }
132cdf0e10cSrcweir return OUString(); // fool compiler
133cdf0e10cSrcweir }
134cdf0e10cSrcweir /* }}} */
135cdf0e10cSrcweir
136cdf0e10cSrcweir
137cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnName() -I- */
getColumnName(sal_Int32 column)138cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getColumnName(sal_Int32 column)
139cdf0e10cSrcweir throw(SQLException, RuntimeException)
140cdf0e10cSrcweir {
141cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnName");
142cdf0e10cSrcweir checkColumnIndex(column);
143cdf0e10cSrcweir
144cdf0e10cSrcweir try {
145cdf0e10cSrcweir return convert( meta->getColumnName( column ) );
146cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
147cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
148cdf0e10cSrcweir } catch (sql::SQLException &e) {
149cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
150cdf0e10cSrcweir }
151cdf0e10cSrcweir return OUString(); // fool compiler
152cdf0e10cSrcweir }
153cdf0e10cSrcweir /* }}} */
154cdf0e10cSrcweir
155cdf0e10cSrcweir
156cdf0e10cSrcweir /* {{{ OResultSetMetaData::getTableName() -I- */
getTableName(sal_Int32 column)157cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getTableName(sal_Int32 column)
158cdf0e10cSrcweir throw(SQLException, RuntimeException)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getTableName");
161cdf0e10cSrcweir checkColumnIndex(column);
162cdf0e10cSrcweir
163cdf0e10cSrcweir try {
164cdf0e10cSrcweir return convert(meta->getTableName(column));
165cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
166cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
167cdf0e10cSrcweir } catch (sql::SQLException &e) {
168cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
169cdf0e10cSrcweir }
170cdf0e10cSrcweir return OUString(); // fool compiler
171cdf0e10cSrcweir }
172cdf0e10cSrcweir /* }}} */
173cdf0e10cSrcweir
174cdf0e10cSrcweir
175cdf0e10cSrcweir /* {{{ OResultSetMetaData::getCatalogName() -I- */
getCatalogName(sal_Int32 column)176cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getCatalogName(sal_Int32 column)
177cdf0e10cSrcweir throw(SQLException, RuntimeException)
178cdf0e10cSrcweir {
179cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getCatalogName");
180cdf0e10cSrcweir checkColumnIndex(column);
181cdf0e10cSrcweir
182cdf0e10cSrcweir try {
183cdf0e10cSrcweir return convert(meta->getCatalogName(column));
184cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
185cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
186cdf0e10cSrcweir } catch (sql::SQLException &e) {
187cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
188cdf0e10cSrcweir }
189cdf0e10cSrcweir return OUString(); // fool compiler
190cdf0e10cSrcweir }
191cdf0e10cSrcweir /* }}} */
192cdf0e10cSrcweir
193cdf0e10cSrcweir
194cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnTypeName() -I- */
getColumnTypeName(sal_Int32 column)195cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getColumnTypeName(sal_Int32 column)
196cdf0e10cSrcweir throw(SQLException, RuntimeException)
197cdf0e10cSrcweir {
198cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnTypeName");
199cdf0e10cSrcweir checkColumnIndex(column);
200cdf0e10cSrcweir
201cdf0e10cSrcweir try {
202cdf0e10cSrcweir return convert(meta->getColumnTypeName(column));
203cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
204cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
205cdf0e10cSrcweir } catch (sql::SQLException &e) {
206cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
207cdf0e10cSrcweir }
208cdf0e10cSrcweir return OUString(); // fool compiler
209cdf0e10cSrcweir }
210cdf0e10cSrcweir /* }}} */
211cdf0e10cSrcweir
212cdf0e10cSrcweir
213cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnLabel() -I- */
getColumnLabel(sal_Int32 column)214cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getColumnLabel(sal_Int32 column)
215cdf0e10cSrcweir throw(SQLException, RuntimeException)
216cdf0e10cSrcweir {
217cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnLabel");
218cdf0e10cSrcweir checkColumnIndex(column);
219cdf0e10cSrcweir
220cdf0e10cSrcweir try {
221cdf0e10cSrcweir return convert(meta->getColumnLabel(column));
222cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
223cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
224cdf0e10cSrcweir } catch (sql::SQLException &e) {
225cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
226cdf0e10cSrcweir }
227cdf0e10cSrcweir return OUString(); // fool compiler
228cdf0e10cSrcweir }
229cdf0e10cSrcweir /* }}} */
230cdf0e10cSrcweir
231cdf0e10cSrcweir
232cdf0e10cSrcweir /* {{{ OResultSetMetaData::getColumnServiceName() -I- */
getColumnServiceName(sal_Int32 column)233cdf0e10cSrcweir OUString SAL_CALL OResultSetMetaData::getColumnServiceName(sal_Int32 column)
234cdf0e10cSrcweir throw(SQLException, RuntimeException)
235cdf0e10cSrcweir {
236cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getColumnServiceName");
237cdf0e10cSrcweir checkColumnIndex(column);
238cdf0e10cSrcweir
239cdf0e10cSrcweir OUString aRet = OUString();
240cdf0e10cSrcweir return aRet;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir /* }}} */
243cdf0e10cSrcweir
244cdf0e10cSrcweir
245cdf0e10cSrcweir /* {{{ OResultSetMetaData::isCurrency() -I- */
isCurrency(sal_Int32 column)246cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isCurrency(sal_Int32 column)
247cdf0e10cSrcweir throw(SQLException, RuntimeException)
248cdf0e10cSrcweir {
249cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isCurrency");
250cdf0e10cSrcweir checkColumnIndex(column);
251cdf0e10cSrcweir
252cdf0e10cSrcweir try {
253cdf0e10cSrcweir return meta->isCurrency(column)? sal_True:sal_False;
254cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
255cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
256cdf0e10cSrcweir } catch (sql::SQLException &e) {
257cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
258cdf0e10cSrcweir }
259cdf0e10cSrcweir return sal_False; // fool compiler
260cdf0e10cSrcweir }
261cdf0e10cSrcweir /* }}} */
262cdf0e10cSrcweir
263cdf0e10cSrcweir
264cdf0e10cSrcweir /* {{{ OResultSetMetaData::isAutoIncrement() -I- */
isAutoIncrement(sal_Int32 column)265cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement(sal_Int32 column)
266cdf0e10cSrcweir throw(SQLException, RuntimeException)
267cdf0e10cSrcweir {
268cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isAutoIncrement");
269cdf0e10cSrcweir checkColumnIndex(column);
270cdf0e10cSrcweir
271cdf0e10cSrcweir try {
272cdf0e10cSrcweir return meta->isAutoIncrement(column)? sal_True:sal_False;
273cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
274cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
275cdf0e10cSrcweir } catch (sql::SQLException &e) {
276cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
277cdf0e10cSrcweir }
278cdf0e10cSrcweir return sal_False; // fool compiler
279cdf0e10cSrcweir }
280cdf0e10cSrcweir /* }}} */
281cdf0e10cSrcweir
282cdf0e10cSrcweir
283cdf0e10cSrcweir /* {{{ OResultSetMetaData::isSigned() -I- */
isSigned(sal_Int32 column)284cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isSigned(sal_Int32 column)
285cdf0e10cSrcweir throw(SQLException, RuntimeException)
286cdf0e10cSrcweir {
287cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isSigned");
288cdf0e10cSrcweir checkColumnIndex(column);
289cdf0e10cSrcweir
290cdf0e10cSrcweir try {
291cdf0e10cSrcweir return meta->isSigned(column)? sal_True:sal_False;
292cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
293cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
294cdf0e10cSrcweir } catch (sql::SQLException &e) {
295cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
296cdf0e10cSrcweir }
297cdf0e10cSrcweir return sal_False; // fool compiler
298cdf0e10cSrcweir }
299cdf0e10cSrcweir /* }}} */
300cdf0e10cSrcweir
301cdf0e10cSrcweir
302cdf0e10cSrcweir /* {{{ OResultSetMetaData::getPrecision() -I- */
getPrecision(sal_Int32 column)303cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getPrecision(sal_Int32 column)
304cdf0e10cSrcweir throw(SQLException, RuntimeException)
305cdf0e10cSrcweir {
306cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getPrecision");
307cdf0e10cSrcweir checkColumnIndex(column);
308cdf0e10cSrcweir
309cdf0e10cSrcweir try {
310cdf0e10cSrcweir return meta->getPrecision(column);
311cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
312cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getPrecision", *this);
313cdf0e10cSrcweir } catch (sql::SQLException &e) {
314cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
315cdf0e10cSrcweir }
316cdf0e10cSrcweir return 0; // fool compiler
317cdf0e10cSrcweir }
318cdf0e10cSrcweir /* }}} */
319cdf0e10cSrcweir
320cdf0e10cSrcweir
321cdf0e10cSrcweir /* {{{ OResultSetMetaData::getScale() -I- */
getScale(sal_Int32 column)322cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::getScale(sal_Int32 column)
323cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
324cdf0e10cSrcweir {
325cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::getScale");
326cdf0e10cSrcweir checkColumnIndex(column);
327cdf0e10cSrcweir try {
328cdf0e10cSrcweir return meta->getScale(column);
329cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
330cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getScale", *this);
331cdf0e10cSrcweir } catch (sql::SQLException &e) {
332cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir return 0; // fool compiler
335cdf0e10cSrcweir }
336cdf0e10cSrcweir /* }}} */
337cdf0e10cSrcweir
338cdf0e10cSrcweir
339cdf0e10cSrcweir /* {{{ OResultSetMetaData::isNullable() -I- */
isNullable(sal_Int32 column)340cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSetMetaData::isNullable(sal_Int32 column)
341cdf0e10cSrcweir throw(SQLException, RuntimeException)
342cdf0e10cSrcweir {
343cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isNullable");
344cdf0e10cSrcweir checkColumnIndex(column);
345cdf0e10cSrcweir
346cdf0e10cSrcweir try {
347cdf0e10cSrcweir return meta->isNullable(column)? sal_True:sal_False;
348cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
349cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
350cdf0e10cSrcweir } catch (sql::SQLException &e) {
351cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
352cdf0e10cSrcweir }
353cdf0e10cSrcweir return sal_False; // fool compiler
354cdf0e10cSrcweir }
355cdf0e10cSrcweir /* }}} */
356cdf0e10cSrcweir
357cdf0e10cSrcweir
358cdf0e10cSrcweir /* {{{ OResultSetMetaData::isSearchable() -I- */
isSearchable(sal_Int32 column)359cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isSearchable(sal_Int32 column)
360cdf0e10cSrcweir throw(SQLException, RuntimeException)
361cdf0e10cSrcweir {
362cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isSearchable");
363cdf0e10cSrcweir checkColumnIndex(column);
364cdf0e10cSrcweir
365cdf0e10cSrcweir try {
366cdf0e10cSrcweir return meta->isSearchable(column)? sal_True:sal_False;
367cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
368cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
369cdf0e10cSrcweir } catch (sql::SQLException &e) {
370cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
371cdf0e10cSrcweir }
372cdf0e10cSrcweir return sal_False; // fool compiler
373cdf0e10cSrcweir }
374cdf0e10cSrcweir /* }}} */
375cdf0e10cSrcweir
376cdf0e10cSrcweir
377cdf0e10cSrcweir /* {{{ OResultSetMetaData::isReadOnly() -I- */
isReadOnly(sal_Int32 column)378cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isReadOnly(sal_Int32 column)
379cdf0e10cSrcweir throw(SQLException, RuntimeException)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isReadOnly");
382cdf0e10cSrcweir checkColumnIndex(column);
383cdf0e10cSrcweir
384cdf0e10cSrcweir try {
385cdf0e10cSrcweir return meta->isReadOnly(column)? sal_True:sal_False;
386cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
387cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
388cdf0e10cSrcweir } catch (sql::SQLException &e) {
389cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
390cdf0e10cSrcweir }
391cdf0e10cSrcweir return sal_False; // fool compiler
392cdf0e10cSrcweir }
393cdf0e10cSrcweir /* }}} */
394cdf0e10cSrcweir
395cdf0e10cSrcweir
396cdf0e10cSrcweir /* {{{ OResultSetMetaData::isDefinitelyWritable() -I- */
isDefinitelyWritable(sal_Int32 column)397cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable(sal_Int32 column)
398cdf0e10cSrcweir throw(SQLException, RuntimeException)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isDefinitelyWritable");
401cdf0e10cSrcweir checkColumnIndex(column);
402cdf0e10cSrcweir
403cdf0e10cSrcweir try {
404cdf0e10cSrcweir return meta->isDefinitelyWritable(column)? sal_True:sal_False;
405cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
406cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
407cdf0e10cSrcweir } catch (sql::SQLException &e) {
408cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
409cdf0e10cSrcweir }
410cdf0e10cSrcweir return sal_False; // fool compiler
411cdf0e10cSrcweir }
412cdf0e10cSrcweir /* }}} */
413cdf0e10cSrcweir
414cdf0e10cSrcweir
415cdf0e10cSrcweir /* {{{ OResultSetMetaData::isWritable() -I- */
isWritable(sal_Int32 column)416cdf0e10cSrcweir sal_Bool SAL_CALL OResultSetMetaData::isWritable(sal_Int32 column)
417cdf0e10cSrcweir throw(SQLException, RuntimeException)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::isWritable");
420cdf0e10cSrcweir checkColumnIndex(column);
421cdf0e10cSrcweir
422cdf0e10cSrcweir try {
423cdf0e10cSrcweir return meta->isWritable(column)? sal_True:sal_False;
424cdf0e10cSrcweir } catch (sql::MethodNotImplementedException) {
425cdf0e10cSrcweir mysqlc_sdbc_driver::throwFeatureNotImplementedException("OResultSetMetaData::getMetaData", *this);
426cdf0e10cSrcweir } catch (sql::SQLException &e) {
427cdf0e10cSrcweir mysqlc_sdbc_driver::translateAndThrow(e, *this, m_encoding);
428cdf0e10cSrcweir }
429cdf0e10cSrcweir return sal_False; // fool compiler
430cdf0e10cSrcweir }
431cdf0e10cSrcweir /* }}} */
432cdf0e10cSrcweir
433cdf0e10cSrcweir
434cdf0e10cSrcweir /* {{{ OResultSetMetaData::checkColumnIndex() -I- */
checkColumnIndex(sal_Int32 columnIndex)435cdf0e10cSrcweir void OResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
436cdf0e10cSrcweir throw (SQLException, RuntimeException)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir OSL_TRACE("OResultSetMetaData::checkColumnIndex");
439cdf0e10cSrcweir if (columnIndex < 1 || columnIndex > (sal_Int32) meta->getColumnCount()) {
440cdf0e10cSrcweir
441cdf0e10cSrcweir ::rtl::OUStringBuffer buf;
442cdf0e10cSrcweir buf.appendAscii( "Column index out of range (expected 1 to " );
443cdf0e10cSrcweir buf.append( sal_Int32( meta->getColumnCount() ) );
444cdf0e10cSrcweir buf.appendAscii( ", got " );
445cdf0e10cSrcweir buf.append( sal_Int32( columnIndex ) );
446cdf0e10cSrcweir buf.append( sal_Unicode( '.' ) );
447cdf0e10cSrcweir throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir }
450cdf0e10cSrcweir /* }}} */
451cdf0e10cSrcweir
452cdf0e10cSrcweir /*
453cdf0e10cSrcweir * Local variables:
454cdf0e10cSrcweir * tab-width: 4
455cdf0e10cSrcweir * c-basic-offset: 4
456cdf0e10cSrcweir * End:
457cdf0e10cSrcweir * vim600: noet sw=4 ts=4 fdm=marker
458cdf0e10cSrcweir * vim<600: noet sw=4 ts=4
459cdf0e10cSrcweir */
460cdf0e10cSrcweir
461