Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "TConnection.hxx"
21 :
22 : #include "odbc/ODatabaseMetaDataResultSet.hxx"
23 : #include <com/sun/star/sdbc/DataType.hpp>
24 : #include <com/sun/star/sdbc/KeyRule.hpp>
25 : #include <com/sun/star/sdbc/ProcedureResult.hpp>
26 : #include <com/sun/star/sdbc/IndexType.hpp>
27 : #include <comphelper/property.hxx>
28 : #include <com/sun/star/lang/DisposedException.hpp>
29 : #include <cppuhelper/typeprovider.hxx>
30 : #include <comphelper/sequence.hxx>
31 : #include "odbc/OResultSetMetaData.hxx"
32 : #include "odbc/OTools.hxx"
33 : #include <comphelper/types.hxx>
34 : #include "FDatabaseMetaDataResultSetMetaData.hxx"
35 : #include <connectivity/dbexception.hxx>
36 :
37 : using namespace ::comphelper;
38 :
39 :
40 : using namespace connectivity::odbc;
41 : using namespace cppu;
42 :
43 : using namespace ::com::sun::star::lang;
44 : using namespace com::sun::star::uno;
45 : using namespace com::sun::star::beans;
46 : using namespace com::sun::star::sdbc;
47 : using namespace com::sun::star::util;
48 :
49 :
50 0 : ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection)
51 : :ODatabaseMetaDataResultSet_BASE(m_aMutex)
52 : ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
53 :
54 0 : ,m_aStatementHandle(_pConnection->createStatementHandle())
55 : ,m_aStatement(NULL)
56 : ,m_xMetaData(NULL)
57 : ,m_pRowStatusArray(NULL)
58 : ,m_pConnection(_pConnection)
59 0 : ,m_nTextEncoding(_pConnection->getTextEncoding())
60 : ,m_nRowPos(-1)
61 : ,m_nDriverColumnCount(0)
62 : ,m_nCurrentFetchState(0)
63 : ,m_bWasNull(true)
64 0 : ,m_bEOF(false)
65 : {
66 : OSL_ENSURE(m_pConnection,"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!");
67 0 : if( SQL_NULL_HANDLE == m_aStatementHandle )
68 0 : throw RuntimeException();
69 :
70 0 : osl_atomic_increment( &m_refCount );
71 0 : m_pConnection->acquire();
72 0 : m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
73 0 : osl_atomic_decrement( &m_refCount );
74 : // allocBuffer();
75 0 : }
76 :
77 :
78 0 : ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet()
79 : {
80 : OSL_ENSURE(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed,"Object wasn't disposed!");
81 0 : if(!ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed)
82 : {
83 0 : osl_atomic_increment( &m_refCount );
84 0 : dispose();
85 : }
86 0 : delete [] m_pRowStatusArray;
87 0 : }
88 :
89 0 : void ODatabaseMetaDataResultSet::disposing()
90 : {
91 0 : OPropertySetHelper::disposing();
92 :
93 0 : ::osl::MutexGuard aGuard(m_aMutex);
94 :
95 0 : m_pConnection->freeStatementHandle(m_aStatementHandle);
96 :
97 0 : m_aStatement = NULL;
98 0 : m_xMetaData.clear();
99 0 : m_pConnection->release();
100 0 : }
101 :
102 0 : Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
103 : {
104 0 : Any aRet = OPropertySetHelper::queryInterface(rType);
105 0 : return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType);
106 : }
107 :
108 0 : Reference< XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(RuntimeException, std::exception)
109 : {
110 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
111 : }
112 :
113 0 : void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
114 : {
115 0 : ODatabaseMetaDataResultSet_BASE::acquire();
116 0 : }
117 :
118 0 : void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
119 : {
120 0 : ODatabaseMetaDataResultSet_BASE::release();
121 0 : }
122 :
123 0 : Sequence< Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(RuntimeException, std::exception)
124 : {
125 0 : ::cppu::OTypeCollection aTypes( cppu::UnoType<XMultiPropertySet>::get(),
126 0 : cppu::UnoType<XFastPropertySet>::get(),
127 0 : cppu::UnoType<XPropertySet>::get());
128 :
129 0 : return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
130 : }
131 :
132 0 : sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column)
133 : {
134 0 : sal_Int32 map = column;
135 :
136 0 : if (!m_aColMapping.empty())
137 : {
138 : // Validate column number
139 0 : map = m_aColMapping[column];
140 : }
141 :
142 0 : return map;
143 : }
144 :
145 :
146 0 : sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& columnName ) throw(SQLException, RuntimeException, std::exception)
147 : {
148 :
149 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
150 0 : ::osl::MutexGuard aGuard( m_aMutex );
151 :
152 :
153 0 : Reference< XResultSetMetaData > xMeta = getMetaData();
154 0 : sal_Int32 nLen = xMeta->getColumnCount();
155 0 : sal_Int32 i = 1;
156 0 : for(;i<=nLen;++i)
157 : {
158 0 : if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
159 0 : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
160 0 : return i;
161 : }
162 :
163 0 : ::dbtools::throwInvalidColumnException( columnName, *this );
164 : assert(false);
165 0 : return 0; // Never reached
166 : }
167 :
168 0 : template < typename T, SQLSMALLINT sqlTypeId > T ODatabaseMetaDataResultSet::getInteger ( sal_Int32 columnIndex )
169 : {
170 0 : ::cppu::OBroadcastHelper& rBHelper(ODatabaseMetaDataResultSet_BASE::rBHelper);
171 0 : checkDisposed(rBHelper.bDisposed);
172 0 : ::osl::MutexGuard aGuard( m_aMutex );
173 :
174 0 : columnIndex = mapColumn(columnIndex);
175 0 : T nVal = 0;
176 0 : if(columnIndex <= m_nDriverColumnCount)
177 : {
178 0 : getValue<T>(m_pConnection, m_aStatementHandle, columnIndex, sqlTypeId, m_bWasNull, **this, nVal);
179 :
180 0 : if ( !m_aValueRange.empty() )
181 : {
182 0 : ::std::map<sal_Int32, ::connectivity::TInt2IntMap >::iterator aValueRangeIter (m_aValueRange.find(columnIndex));
183 0 : if ( aValueRangeIter != m_aValueRange.end() )
184 0 : return static_cast<T>(aValueRangeIter->second[nVal]);
185 : }
186 : }
187 : else
188 0 : m_bWasNull = true;
189 0 : return nVal;
190 : }
191 :
192 :
193 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
194 : {
195 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBinaryStream", *this );
196 0 : return NULL;
197 : }
198 :
199 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
200 : {
201 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getCharacterStream", *this );
202 0 : return NULL;
203 : }
204 :
205 :
206 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
207 : {
208 :
209 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
210 0 : ::osl::MutexGuard aGuard( m_aMutex );
211 :
212 0 : columnIndex = mapColumn(columnIndex);
213 :
214 0 : bool bRet = false;
215 0 : if(columnIndex <= m_nDriverColumnCount)
216 : {
217 0 : sal_Int32 nType = getMetaData()->getColumnType(columnIndex);
218 0 : switch(nType)
219 : {
220 : case DataType::BIT:
221 : {
222 0 : sal_Int8 nValue = 0;
223 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nValue,sizeof nValue);
224 0 : bRet = nValue != 0;
225 : }
226 0 : break;
227 : default:
228 0 : bRet = getInt(columnIndex) != 0;
229 : }
230 : }
231 0 : return bRet;
232 : }
233 :
234 :
235 0 : sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
236 : {
237 0 : return getInteger<sal_Int8, SQL_C_STINYINT>( columnIndex );
238 : }
239 :
240 :
241 0 : Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
242 : {
243 :
244 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
245 0 : ::osl::MutexGuard aGuard( m_aMutex );
246 :
247 :
248 0 : columnIndex = mapColumn(columnIndex);
249 0 : if(columnIndex <= m_nDriverColumnCount)
250 : {
251 0 : sal_Int32 nType = getMetaData()->getColumnType(columnIndex);
252 0 : switch(nType)
253 : {
254 : case DataType::CHAR:
255 : case DataType::VARCHAR:
256 : case DataType::LONGVARCHAR:
257 : {
258 0 : OUString aRet = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding);
259 0 : return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
260 : }
261 : }
262 0 : return OTools::getBytesValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this);
263 : }
264 : else
265 0 : m_bWasNull = true;
266 0 : return Sequence<sal_Int8>();
267 : }
268 :
269 :
270 0 : ::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
271 : {
272 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
273 0 : ::osl::MutexGuard aGuard( m_aMutex );
274 :
275 :
276 0 : columnIndex = mapColumn(columnIndex);
277 0 : if(columnIndex <= m_nDriverColumnCount)
278 : {
279 : DATE_STRUCT aDate;
280 0 : aDate.day = 0;
281 0 : aDate.month = 0;
282 0 : aDate.year = 0;
283 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate);
284 0 : return Date(aDate.day,aDate.month,aDate.year);
285 : }
286 : else
287 0 : m_bWasNull = true;
288 0 : return Date();
289 : }
290 :
291 :
292 0 : double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
293 : {
294 :
295 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
296 0 : ::osl::MutexGuard aGuard( m_aMutex );
297 :
298 :
299 0 : columnIndex = mapColumn(columnIndex);
300 0 : double nValue(0.0);
301 0 : if(columnIndex <= m_nDriverColumnCount)
302 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nValue,sizeof nValue);
303 : else
304 0 : m_bWasNull = true;
305 0 : return nValue;
306 : }
307 :
308 :
309 0 : float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
310 : {
311 :
312 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
313 0 : ::osl::MutexGuard aGuard( m_aMutex );
314 :
315 :
316 0 : columnIndex = mapColumn(columnIndex);
317 0 : float nVal(0);
318 0 : if(columnIndex <= m_nDriverColumnCount)
319 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal);
320 : else
321 0 : m_bWasNull = true;
322 0 : return nVal;
323 : }
324 :
325 :
326 0 : sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
327 : {
328 0 : return getInteger<sal_Int32, SQL_C_SLONG>( columnIndex );
329 : }
330 :
331 :
332 0 : sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException, std::exception)
333 : {
334 0 : return 0;
335 : }
336 :
337 :
338 0 : sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
339 : {
340 0 : return getInteger<sal_Int64, SQL_C_SBIGINT>( columnIndex );
341 : }
342 :
343 :
344 0 : Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException, std::exception)
345 : {
346 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
347 0 : ::osl::MutexGuard aGuard( m_aMutex );
348 0 : return m_xMetaData.is() ? m_xMetaData : (m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle));
349 : }
350 :
351 0 : Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
352 : {
353 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getArray", *this );
354 0 : return NULL;
355 : }
356 :
357 0 : Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
358 : {
359 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getClob", *this );
360 0 : return NULL;
361 : }
362 :
363 0 : Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
364 : {
365 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getBlob", *this );
366 0 : return NULL;
367 : }
368 :
369 :
370 0 : Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
371 : {
372 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getRef", *this );
373 0 : return NULL;
374 : }
375 :
376 :
377 0 : Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException, std::exception)
378 : {
379 0 : ::dbtools::throwFunctionNotSupportedSQLException( "XRow::getObject", *this );
380 0 : return Any();
381 : }
382 :
383 :
384 0 : sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
385 : {
386 0 : return getInteger<sal_Int16, SQL_C_SSHORT>( columnIndex );
387 : }
388 :
389 :
390 0 : OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
391 : {
392 :
393 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
394 0 : ::osl::MutexGuard aGuard( m_aMutex );
395 :
396 :
397 0 : columnIndex = mapColumn(columnIndex);
398 0 : OUString aVal;
399 0 : if(columnIndex <= m_nDriverColumnCount)
400 0 : aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding);
401 : else
402 0 : m_bWasNull = true;
403 :
404 0 : return aVal;
405 : }
406 :
407 :
408 :
409 :
410 0 : ::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
411 : {
412 :
413 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
414 0 : ::osl::MutexGuard aGuard( m_aMutex );
415 :
416 :
417 0 : columnIndex = mapColumn(columnIndex);
418 0 : TIME_STRUCT aTime={0,0,0};
419 0 : if(columnIndex <= m_nDriverColumnCount)
420 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime);
421 : else
422 0 : m_bWasNull = true;
423 0 : return Time(0, aTime.second,aTime.minute,aTime.hour, false);
424 : }
425 :
426 :
427 :
428 0 : ::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
429 : {
430 :
431 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
432 0 : ::osl::MutexGuard aGuard( m_aMutex );
433 :
434 :
435 0 : columnIndex = mapColumn(columnIndex);
436 0 : TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0};
437 0 : if(columnIndex <= m_nDriverColumnCount)
438 0 : OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP, m_bWasNull, **this, &aTime, sizeof aTime);
439 : else
440 0 : m_bWasNull = true;
441 : return DateTime(aTime.fraction, aTime.second, aTime.minute, aTime.hour,
442 0 : aTime.day, aTime.month, aTime.year, false);
443 : }
444 :
445 :
446 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException, std::exception)
447 : {
448 :
449 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
450 0 : ::osl::MutexGuard aGuard( m_aMutex );
451 :
452 :
453 0 : return m_nCurrentFetchState == SQL_NO_DATA;
454 : }
455 :
456 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException, std::exception)
457 : {
458 :
459 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
460 0 : ::osl::MutexGuard aGuard( m_aMutex );
461 :
462 :
463 0 : return m_nRowPos == 1;
464 : }
465 :
466 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException, std::exception)
467 : {
468 :
469 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
470 0 : ::osl::MutexGuard aGuard( m_aMutex );
471 :
472 :
473 0 : return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA;
474 : }
475 :
476 0 : void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException, std::exception)
477 : {
478 :
479 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
480 0 : ::osl::MutexGuard aGuard( m_aMutex );
481 :
482 :
483 0 : if(first())
484 0 : previous();
485 0 : m_nCurrentFetchState = SQL_SUCCESS;
486 0 : }
487 :
488 0 : void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException, std::exception)
489 : {
490 :
491 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
492 0 : ::osl::MutexGuard aGuard( m_aMutex );
493 :
494 :
495 0 : if(last())
496 0 : next();
497 0 : }
498 :
499 :
500 0 : void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException, std::exception)
501 : {
502 : {
503 :
504 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
505 0 : ::osl::MutexGuard aGuard( m_aMutex );
506 :
507 : }
508 0 : dispose();
509 0 : }
510 :
511 :
512 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException, std::exception)
513 : {
514 :
515 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
516 0 : ::osl::MutexGuard aGuard( m_aMutex );
517 :
518 0 : m_bEOF = false;
519 :
520 0 : m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0);
521 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
522 0 : bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
523 0 : if( bRet )
524 0 : m_nRowPos = 1;
525 0 : return bRet;
526 : }
527 :
528 :
529 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException, std::exception)
530 : {
531 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
532 0 : ::osl::MutexGuard aGuard( m_aMutex );
533 :
534 :
535 0 : m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0);
536 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
537 : // here I know definitely that I stand on the last record
538 0 : bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO );
539 0 : if( bRet )
540 0 : m_bEOF = true;
541 0 : return bRet;
542 : }
543 :
544 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
545 : {
546 :
547 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
548 0 : ::osl::MutexGuard aGuard( m_aMutex );
549 :
550 0 : m_bEOF = false;
551 :
552 0 : m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row);
553 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
554 0 : bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
555 0 : if(bRet)
556 0 : m_nRowPos = row;
557 0 : return bRet;
558 : }
559 :
560 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
561 : {
562 :
563 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
564 0 : ::osl::MutexGuard aGuard( m_aMutex );
565 :
566 0 : m_bEOF = false;
567 :
568 0 : m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row);
569 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
570 0 : bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
571 0 : if(bRet)
572 0 : m_nRowPos += row;
573 0 : return bRet;
574 : }
575 :
576 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException, std::exception)
577 : {
578 :
579 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
580 0 : ::osl::MutexGuard aGuard( m_aMutex );
581 :
582 0 : m_bEOF = false;
583 :
584 0 : m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0);
585 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
586 0 : bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
587 0 : if(bRet)
588 0 : --m_nRowPos;
589 0 : else if ( m_nCurrentFetchState == SQL_NO_DATA )
590 0 : m_nRowPos = 0;
591 0 : return bRet;
592 : }
593 :
594 0 : Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException, std::exception)
595 : {
596 0 : return NULL;
597 : }
598 :
599 :
600 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException, std::exception)
601 : {
602 :
603 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
604 0 : ::osl::MutexGuard aGuard( m_aMutex );
605 :
606 :
607 0 : return m_pRowStatusArray[0] == SQL_ROW_DELETED;
608 : }
609 :
610 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException, std::exception)
611 : {
612 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
613 0 : ::osl::MutexGuard aGuard( m_aMutex );
614 :
615 :
616 0 : return m_pRowStatusArray[0] == SQL_ROW_ADDED;
617 : }
618 :
619 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException, std::exception)
620 : {
621 :
622 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
623 0 : ::osl::MutexGuard aGuard( m_aMutex );
624 :
625 :
626 0 : return m_pRowStatusArray[0] == SQL_ROW_UPDATED;
627 : }
628 :
629 :
630 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException, std::exception)
631 : {
632 :
633 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
634 0 : ::osl::MutexGuard aGuard( m_aMutex );
635 :
636 :
637 0 : return m_nRowPos == 0;
638 : }
639 :
640 :
641 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException, std::exception)
642 : {
643 :
644 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
645 0 : ::osl::MutexGuard aGuard( m_aMutex );
646 :
647 0 : m_bEOF = false;
648 :
649 0 : SQLRETURN nOldFetchStatus = m_nCurrentFetchState;
650 : // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0);
651 0 : m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle);
652 0 : OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this);
653 0 : bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO;
654 0 : if(bRet || ( m_nCurrentFetchState == SQL_NO_DATA && nOldFetchStatus != SQL_NO_DATA ) )
655 0 : ++m_nRowPos;
656 0 : return bRet;
657 : }
658 :
659 :
660 0 : sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException, std::exception)
661 : {
662 :
663 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
664 0 : ::osl::MutexGuard aGuard( m_aMutex );
665 :
666 :
667 0 : return m_bWasNull;
668 : }
669 :
670 0 : void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException, std::exception)
671 : {
672 :
673 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
674 0 : ::osl::MutexGuard aGuard( m_aMutex );
675 :
676 0 : }
677 :
678 :
679 0 : void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException, std::exception)
680 : {
681 :
682 0 : checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
683 0 : ::osl::MutexGuard aGuard( m_aMutex );
684 :
685 :
686 0 : N3SQLCancel(m_aStatementHandle);
687 0 : }
688 :
689 0 : void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException, std::exception)
690 : {
691 0 : }
692 :
693 0 : Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException, std::exception)
694 : {
695 0 : return Any();
696 : }
697 :
698 0 : sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() throw(SQLException, RuntimeException)
699 : {
700 0 : sal_Int32 nValue=1;
701 0 : return nValue;
702 : }
703 :
704 0 : OUString ODatabaseMetaDataResultSet::getCursorName() throw(SQLException, RuntimeException)
705 : {
706 0 : return OUString();
707 : }
708 :
709 :
710 0 : ::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
711 : {
712 :
713 0 : Sequence< com::sun::star::beans::Property > aProps(5);
714 0 : com::sun::star::beans::Property* pProperties = aProps.getArray();
715 0 : sal_Int32 nPos = 0;
716 0 : pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
717 0 : PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
718 0 : pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
719 0 : PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
720 0 : pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
721 0 : PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
722 0 : pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
723 0 : PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
724 0 : pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
725 0 : PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
726 :
727 0 : return new ::cppu::OPropertyArrayHelper(aProps);
728 : }
729 :
730 0 : ::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
731 : {
732 0 : return *getArrayHelper();
733 : }
734 :
735 0 : sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue(
736 : Any & rConvertedValue,
737 : Any & rOldValue,
738 : sal_Int32 nHandle,
739 : const Any& rValue )
740 : throw (::com::sun::star::lang::IllegalArgumentException)
741 : {
742 0 : switch(nHandle)
743 : {
744 : case PROPERTY_ID_CURSORNAME:
745 : case PROPERTY_ID_RESULTSETCONCURRENCY:
746 : case PROPERTY_ID_RESULTSETTYPE:
747 0 : throw ::com::sun::star::lang::IllegalArgumentException();
748 : case PROPERTY_ID_FETCHDIRECTION:
749 0 : return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
750 : case PROPERTY_ID_FETCHSIZE:
751 0 : return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
752 : default:
753 : ;
754 : }
755 0 : return sal_False;
756 : }
757 :
758 0 : void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& /*rValue*/ ) throw (Exception, std::exception)
759 : {
760 0 : switch(nHandle)
761 : {
762 : case PROPERTY_ID_CURSORNAME:
763 : case PROPERTY_ID_RESULTSETCONCURRENCY:
764 : case PROPERTY_ID_RESULTSETTYPE:
765 : case PROPERTY_ID_FETCHDIRECTION:
766 : case PROPERTY_ID_FETCHSIZE:
767 0 : throw Exception();
768 : default:
769 : OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!");
770 : }
771 0 : }
772 :
773 0 : void ODatabaseMetaDataResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
774 : {
775 0 : switch(nHandle)
776 : {
777 : case PROPERTY_ID_CURSORNAME:
778 0 : rValue <<= getCursorName();
779 0 : break;
780 : case PROPERTY_ID_RESULTSETCONCURRENCY:
781 0 : rValue <<= getResultSetConcurrency();
782 0 : break;
783 : case PROPERTY_ID_RESULTSETTYPE:
784 0 : rValue <<= getResultSetType();
785 0 : break;
786 : case PROPERTY_ID_FETCHDIRECTION:
787 0 : rValue <<= getFetchDirection();
788 0 : break;
789 : case PROPERTY_ID_FETCHSIZE:
790 0 : rValue <<= getFetchSize();
791 0 : break;
792 : }
793 0 : }
794 :
795 0 : void ODatabaseMetaDataResultSet::openTypeInfo() throw(SQLException, RuntimeException)
796 : {
797 0 : TInt2IntMap aMap;
798 0 : aMap[SQL_BIT] = DataType::BIT;
799 0 : aMap[SQL_TINYINT] = DataType::TINYINT;
800 0 : aMap[SQL_SMALLINT] = DataType::SMALLINT;
801 0 : aMap[SQL_INTEGER] = DataType::INTEGER;
802 0 : aMap[SQL_FLOAT] = DataType::FLOAT;
803 0 : aMap[SQL_REAL] = DataType::REAL;
804 0 : aMap[SQL_DOUBLE] = DataType::DOUBLE;
805 0 : aMap[SQL_BIGINT] = DataType::BIGINT;
806 :
807 0 : aMap[SQL_CHAR] = DataType::CHAR;
808 0 : aMap[SQL_WCHAR] = DataType::CHAR;
809 0 : aMap[SQL_VARCHAR] = DataType::VARCHAR;
810 0 : aMap[SQL_WVARCHAR] = DataType::VARCHAR;
811 0 : aMap[SQL_LONGVARCHAR] = DataType::LONGVARCHAR;
812 0 : aMap[SQL_WLONGVARCHAR] = DataType::LONGVARCHAR;
813 :
814 0 : aMap[SQL_TYPE_DATE] = DataType::DATE;
815 0 : aMap[SQL_DATE] = DataType::DATE;
816 0 : aMap[SQL_TYPE_TIME] = DataType::TIME;
817 0 : aMap[SQL_TIME] = DataType::TIME;
818 0 : aMap[SQL_TYPE_TIMESTAMP] = DataType::TIMESTAMP;
819 0 : aMap[SQL_TIMESTAMP] = DataType::TIMESTAMP;
820 :
821 0 : aMap[SQL_DECIMAL] = DataType::DECIMAL;
822 0 : aMap[SQL_NUMERIC] = DataType::NUMERIC;
823 :
824 0 : aMap[SQL_BINARY] = DataType::BINARY;
825 0 : aMap[SQL_VARBINARY] = DataType::VARBINARY;
826 0 : aMap[SQL_LONGVARBINARY] = DataType::LONGVARBINARY;
827 :
828 0 : aMap[SQL_GUID] = DataType::VARBINARY;
829 :
830 :
831 0 : m_aValueRange[2] = aMap;
832 :
833 0 : OTools::ThrowException(m_pConnection,N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this);
834 0 : checkColumnCount();
835 0 : }
836 :
837 0 : void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString& schemaPattern,
838 : const OUString& tableNamePattern,
839 : const Sequence< OUString >& types ) throw(SQLException, RuntimeException)
840 : {
841 0 : OString aPKQ,aPKO,aPKN,aCOL;
842 0 : const OUString *pSchemaPat = NULL;
843 :
844 0 : if(schemaPattern != "%")
845 0 : pSchemaPat = &schemaPattern;
846 : else
847 0 : pSchemaPat = NULL;
848 :
849 0 : if ( catalog.hasValue() )
850 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
851 0 : aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
852 0 : aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
853 :
854 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
855 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
856 0 : *pPKN = aPKN.getStr();
857 :
858 :
859 0 : const char *pCOL = NULL;
860 0 : const char* pComma = ",";
861 0 : const OUString* pBegin = types.getConstArray();
862 0 : const OUString* pEnd = pBegin + types.getLength();
863 0 : for(;pBegin != pEnd;++pBegin)
864 : {
865 0 : aCOL += OUStringToOString(*pBegin,m_nTextEncoding);
866 0 : aCOL += pComma;
867 : }
868 0 : if ( !aCOL.isEmpty() )
869 : {
870 0 : aCOL = aCOL.replaceAt(aCOL.getLength()-1,1,pComma);
871 0 : pCOL = aCOL.getStr();
872 : }
873 : else
874 0 : pCOL = SQL_ALL_TABLE_TYPES;
875 :
876 0 : SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
877 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
878 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
879 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
880 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), pCOL ? SQL_NTS : 0);
881 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
882 0 : checkColumnCount();
883 :
884 0 : }
885 :
886 0 : void ODatabaseMetaDataResultSet::openTablesTypes( ) throw(SQLException, RuntimeException)
887 : {
888 0 : SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
889 : 0,0,
890 : 0,0,
891 : 0,0,
892 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_TABLE_TYPES)),SQL_NTS);
893 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
894 :
895 0 : m_aColMapping.clear();
896 0 : m_aColMapping.push_back(-1);
897 0 : m_aColMapping.push_back(4);
898 0 : m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
899 0 : checkColumnCount();
900 0 : }
901 :
902 0 : void ODatabaseMetaDataResultSet::openCatalogs() throw(SQLException, RuntimeException)
903 : {
904 0 : SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
905 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_CATALOGS)),SQL_NTS,
906 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
907 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
908 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS);
909 :
910 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
911 :
912 0 : m_aColMapping.clear();
913 0 : m_aColMapping.push_back(-1);
914 0 : m_aColMapping.push_back(1);
915 0 : m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
916 0 : checkColumnCount();
917 0 : }
918 :
919 0 : void ODatabaseMetaDataResultSet::openSchemas() throw(SQLException, RuntimeException)
920 : {
921 0 : SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
922 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
923 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_SCHEMAS)),SQL_NTS,
924 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS,
925 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS);
926 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
927 :
928 0 : m_aColMapping.clear();
929 0 : m_aColMapping.push_back(-1);
930 0 : m_aColMapping.push_back(2);
931 0 : m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping);
932 0 : checkColumnCount();
933 0 : }
934 :
935 0 : void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const OUString& schema,
936 : const OUString& table, const OUString& columnNamePattern )
937 : throw(SQLException, RuntimeException)
938 : {
939 0 : const OUString *pSchemaPat = NULL;
940 :
941 0 : if(schema != "%")
942 0 : pSchemaPat = &schema;
943 : else
944 0 : pSchemaPat = NULL;
945 :
946 0 : OString aPKQ,aPKO,aPKN,aCOL;
947 :
948 0 : if ( catalog.hasValue() )
949 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
950 0 : aPKO = OUStringToOString(schema,m_nTextEncoding);
951 0 : aPKN = OUStringToOString(table,m_nTextEncoding);
952 0 : aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
953 :
954 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
955 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
956 0 : *pPKN = aPKN.getStr(),
957 0 : *pCOL = aCOL.getStr();
958 :
959 :
960 0 : SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle,
961 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
962 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
963 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
964 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
965 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
966 :
967 0 : checkColumnCount();
968 0 : }
969 :
970 0 : void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const OUString& schemaPattern,
971 : const OUString& tableNamePattern, const OUString& columnNamePattern )
972 : throw(SQLException, RuntimeException)
973 : {
974 0 : const OUString *pSchemaPat = NULL;
975 :
976 0 : if(schemaPattern != "%")
977 0 : pSchemaPat = &schemaPattern;
978 : else
979 0 : pSchemaPat = NULL;
980 :
981 0 : OString aPKQ,aPKO,aPKN,aCOL;
982 0 : if ( catalog.hasValue() )
983 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
984 0 : aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
985 0 : aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding);
986 0 : aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
987 :
988 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
989 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
990 0 : *pPKN = aPKN.getStr(),
991 0 : *pCOL = aCOL.getStr();
992 :
993 :
994 0 : SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle,
995 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
996 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
997 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
998 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
999 :
1000 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1001 0 : TInt2IntMap aMap;
1002 0 : aMap[SQL_BIT] = DataType::BIT;
1003 0 : aMap[SQL_TINYINT] = DataType::TINYINT;
1004 0 : aMap[SQL_SMALLINT] = DataType::SMALLINT;
1005 0 : aMap[SQL_INTEGER] = DataType::INTEGER;
1006 0 : aMap[SQL_FLOAT] = DataType::FLOAT;
1007 0 : aMap[SQL_REAL] = DataType::REAL;
1008 0 : aMap[SQL_DOUBLE] = DataType::DOUBLE;
1009 0 : aMap[SQL_BIGINT] = DataType::BIGINT;
1010 :
1011 0 : aMap[SQL_CHAR] = DataType::CHAR;
1012 0 : aMap[SQL_WCHAR] = DataType::CHAR;
1013 0 : aMap[SQL_VARCHAR] = DataType::VARCHAR;
1014 0 : aMap[SQL_WVARCHAR] = DataType::VARCHAR;
1015 0 : aMap[SQL_LONGVARCHAR] = DataType::LONGVARCHAR;
1016 0 : aMap[SQL_WLONGVARCHAR] = DataType::LONGVARCHAR;
1017 :
1018 0 : aMap[SQL_TYPE_DATE] = DataType::DATE;
1019 0 : aMap[SQL_DATE] = DataType::DATE;
1020 0 : aMap[SQL_TYPE_TIME] = DataType::TIME;
1021 0 : aMap[SQL_TIME] = DataType::TIME;
1022 0 : aMap[SQL_TYPE_TIMESTAMP] = DataType::TIMESTAMP;
1023 0 : aMap[SQL_TIMESTAMP] = DataType::TIMESTAMP;
1024 :
1025 0 : aMap[SQL_DECIMAL] = DataType::DECIMAL;
1026 0 : aMap[SQL_NUMERIC] = DataType::NUMERIC;
1027 :
1028 0 : aMap[SQL_BINARY] = DataType::BINARY;
1029 0 : aMap[SQL_VARBINARY] = DataType::VARBINARY;
1030 0 : aMap[SQL_LONGVARBINARY] = DataType::LONGVARBINARY;
1031 :
1032 0 : aMap[SQL_GUID] = DataType::VARBINARY;
1033 :
1034 0 : m_aValueRange[5] = aMap;
1035 0 : checkColumnCount();
1036 0 : }
1037 :
1038 0 : void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const OUString& schemaPattern,
1039 : const OUString& procedureNamePattern,const OUString& columnNamePattern )
1040 : throw(SQLException, RuntimeException)
1041 : {
1042 0 : const OUString *pSchemaPat = NULL;
1043 :
1044 0 : if(schemaPattern != "%")
1045 0 : pSchemaPat = &schemaPattern;
1046 : else
1047 0 : pSchemaPat = NULL;
1048 :
1049 0 : OString aPKQ,aPKO,aPKN,aCOL;
1050 0 : if ( catalog.hasValue() )
1051 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1052 0 : aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
1053 0 : aPKN = OUStringToOString(procedureNamePattern,m_nTextEncoding);
1054 0 : aCOL = OUStringToOString(columnNamePattern,m_nTextEncoding);
1055 :
1056 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1057 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1058 0 : *pPKN = aPKN.getStr(),
1059 0 : *pCOL = aCOL.getStr();
1060 :
1061 :
1062 0 : SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle,
1063 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1064 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1065 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
1066 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS);
1067 :
1068 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1069 0 : checkColumnCount();
1070 0 : }
1071 :
1072 0 : void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUString& schemaPattern,
1073 : const OUString& procedureNamePattern)
1074 : throw(SQLException, RuntimeException)
1075 : {
1076 0 : const OUString *pSchemaPat = NULL;
1077 :
1078 0 : if(schemaPattern != "%")
1079 0 : pSchemaPat = &schemaPattern;
1080 : else
1081 0 : pSchemaPat = NULL;
1082 :
1083 0 : OString aPKQ,aPKO,aPKN;
1084 :
1085 0 : if ( catalog.hasValue() )
1086 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1087 0 : aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
1088 0 : aPKN = OUStringToOString(procedureNamePattern,m_nTextEncoding);
1089 :
1090 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1091 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1092 0 : *pPKN = aPKN.getStr();
1093 :
1094 :
1095 0 : SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle,
1096 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1097 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1098 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
1099 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1100 0 : checkColumnCount();
1101 0 : }
1102 :
1103 0 : void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& catalog, const OUString& schema,
1104 : const OUString& table,sal_Int32 scope, bool nullable )
1105 : throw(SQLException, RuntimeException)
1106 : {
1107 : // Some ODBC drivers really don't like getting an empty string as tableName
1108 : // E.g. psqlodbc up to at least version 09.01.0100 segfaults
1109 0 : if (table.isEmpty())
1110 : {
1111 0 : const char errMsg[] = "ODBC: Trying to get special columns of empty table name";
1112 0 : const char SQLState[] = "HY009";
1113 : throw SQLException( OUString(errMsg, sizeof(errMsg) - sizeof(errMsg[0]), RTL_TEXTENCODING_ASCII_US),
1114 : *this,
1115 : OUString(SQLState, sizeof(SQLState) - sizeof(SQLState[0]), RTL_TEXTENCODING_ASCII_US),
1116 : -1,
1117 0 : Any() );
1118 : }
1119 :
1120 0 : const OUString *pSchemaPat = NULL;
1121 :
1122 0 : if(schema != "%")
1123 0 : pSchemaPat = &schema;
1124 : else
1125 0 : pSchemaPat = NULL;
1126 :
1127 0 : OString aPKQ,aPKO,aPKN;
1128 0 : if ( catalog.hasValue() )
1129 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1130 0 : aPKO = OUStringToOString(schema,m_nTextEncoding);
1131 0 : aPKN = OUStringToOString(table,m_nTextEncoding);
1132 :
1133 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1134 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1135 0 : *pPKN = aPKN.getStr();
1136 :
1137 :
1138 0 : SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID,
1139 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1140 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1141 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
1142 : (SQLSMALLINT)scope,
1143 : nullable ? SQL_NULLABLE : SQL_NO_NULLS);
1144 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1145 0 : checkColumnCount();
1146 0 : }
1147 :
1148 0 : void ODatabaseMetaDataResultSet::openVersionColumns(const Any& catalog, const OUString& schema,
1149 : const OUString& table) throw(SQLException, RuntimeException)
1150 : {
1151 0 : openSpecialColumns(true,catalog,schema,table,SQL_SCOPE_TRANSACTION,false);
1152 0 : }
1153 :
1154 0 : void ODatabaseMetaDataResultSet::openBestRowIdentifier( const Any& catalog, const OUString& schema,
1155 : const OUString& table,sal_Int32 scope,bool nullable ) throw(SQLException, RuntimeException)
1156 : {
1157 0 : openSpecialColumns(false,catalog,schema,table,scope,nullable);
1158 0 : }
1159 :
1160 0 : void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const OUString* schema,
1161 : const OUString* table,
1162 : const Any& catalog2, const OUString* schema2,
1163 : const OUString* table2) throw(SQLException, RuntimeException)
1164 : {
1165 0 : OString aPKQ, aPKO, aPKN, aFKQ, aFKO, aFKN;
1166 0 : if ( catalog.hasValue() )
1167 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1168 0 : if ( catalog2.hasValue() )
1169 0 : aFKQ = OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding);
1170 :
1171 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1172 0 : *pPKO = schema && !schema->isEmpty() ? (aPKO = OUStringToOString(*schema,m_nTextEncoding)).getStr() : NULL,
1173 0 : *pPKN = table ? (aPKN = OUStringToOString(*table,m_nTextEncoding)).getStr(): NULL,
1174 0 : *pFKQ = catalog2.hasValue() && !aFKQ.isEmpty() ? aFKQ.getStr() : NULL,
1175 0 : *pFKO = schema2 && !schema2->isEmpty() ? (aFKO = OUStringToOString(*schema2,m_nTextEncoding)).getStr() : NULL,
1176 0 : *pFKN = table2 ? (aFKN = OUStringToOString(*table2,m_nTextEncoding)).getStr() : NULL;
1177 :
1178 :
1179 0 : SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle,
1180 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1181 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0,
1182 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), pPKN ? SQL_NTS : 0,
1183 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKQ)), (catalog2.hasValue() && !aFKQ.isEmpty()) ? SQL_NTS : 0,
1184 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKO)), pFKO ? SQL_NTS : 0,
1185 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKN)), SQL_NTS
1186 : );
1187 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1188 0 : checkColumnCount();
1189 0 : }
1190 :
1191 0 : void ODatabaseMetaDataResultSet::openImportedKeys(const Any& catalog, const OUString& schema,
1192 : const OUString& table) throw(SQLException, RuntimeException)
1193 : {
1194 :
1195 0 : openForeignKeys(Any(),NULL,NULL,catalog, schema == "%" ? &schema : NULL, &table);
1196 0 : }
1197 :
1198 0 : void ODatabaseMetaDataResultSet::openExportedKeys(const Any& catalog, const OUString& schema,
1199 : const OUString& table) throw(SQLException, RuntimeException)
1200 : {
1201 0 : openForeignKeys(catalog, schema == "%" ? &schema : NULL, &table,Any(),NULL,NULL);
1202 0 : }
1203 :
1204 0 : void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUString& schema,
1205 : const OUString& table) throw(SQLException, RuntimeException)
1206 : {
1207 0 : const OUString *pSchemaPat = NULL;
1208 :
1209 0 : if(schema != "%")
1210 0 : pSchemaPat = &schema;
1211 : else
1212 0 : pSchemaPat = NULL;
1213 :
1214 0 : OString aPKQ,aPKO,aPKN;
1215 :
1216 0 : if ( catalog.hasValue() )
1217 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1218 0 : aPKO = OUStringToOString(schema,m_nTextEncoding);
1219 :
1220 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1221 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1222 0 : *pPKN = (aPKN = OUStringToOString(table,m_nTextEncoding)).getStr();
1223 :
1224 :
1225 0 : SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle,
1226 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1227 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1228 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
1229 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1230 0 : checkColumnCount();
1231 0 : }
1232 :
1233 0 : void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const OUString& schemaPattern,
1234 : const OUString& tableNamePattern) throw(SQLException, RuntimeException)
1235 : {
1236 0 : const OUString *pSchemaPat = NULL;
1237 :
1238 0 : if(schemaPattern != "%")
1239 0 : pSchemaPat = &schemaPattern;
1240 : else
1241 0 : pSchemaPat = NULL;
1242 :
1243 0 : OString aPKQ,aPKO,aPKN;
1244 :
1245 0 : if ( catalog.hasValue() )
1246 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1247 0 : aPKO = OUStringToOString(schemaPattern,m_nTextEncoding);
1248 :
1249 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1250 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1251 0 : *pPKN = (aPKN = OUStringToOString(tableNamePattern,m_nTextEncoding)).getStr();
1252 :
1253 :
1254 0 : SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle,
1255 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1256 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1257 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS);
1258 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1259 0 : checkColumnCount();
1260 0 : }
1261 :
1262 0 : void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUString& schema,
1263 : const OUString& table, bool unique, bool approximate )
1264 : throw(SQLException, RuntimeException)
1265 : {
1266 0 : const OUString *pSchemaPat = NULL;
1267 :
1268 0 : if(schema != "%")
1269 0 : pSchemaPat = &schema;
1270 : else
1271 0 : pSchemaPat = NULL;
1272 :
1273 0 : OString aPKQ,aPKO,aPKN;
1274 :
1275 0 : if ( catalog.hasValue() )
1276 0 : aPKQ = OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
1277 0 : aPKO = OUStringToOString(schema,m_nTextEncoding);
1278 :
1279 0 : const char *pPKQ = catalog.hasValue() && !aPKQ.isEmpty() ? aPKQ.getStr() : NULL,
1280 0 : *pPKO = pSchemaPat && !pSchemaPat->isEmpty() && !aPKO.isEmpty() ? aPKO.getStr() : NULL,
1281 0 : *pPKN = (aPKN = OUStringToOString(table,m_nTextEncoding)).getStr();
1282 :
1283 :
1284 0 : SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle,
1285 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0,
1286 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 ,
1287 : reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS,
1288 : unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL,
1289 : approximate ? 1 : 0);
1290 0 : OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this);
1291 0 : checkColumnCount();
1292 0 : }
1293 :
1294 0 : void ODatabaseMetaDataResultSet::checkColumnCount()
1295 : {
1296 0 : sal_Int16 nNumResultCols=0;
1297 0 : OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this);
1298 0 : m_nDriverColumnCount = nNumResultCols;
1299 0 : }
1300 :
1301 :
1302 0 : SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
1303 : {
1304 0 : ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex);
1305 0 : if ( aFind == m_aODBCColumnTypes.end() )
1306 0 : aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first;
1307 0 : return aFind->second;
1308 : }
1309 :
1310 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|