LibreOffice Module connectivity (master) 1
ADatabaseMetaDataResultSet.cxx
Go to the documentation of this file.
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
23#include <com/sun/star/sdbc/ColumnSearch.hpp>
24#include <com/sun/star/sdbc/DataType.hpp>
25#include <com/sun/star/sdbc/ColumnValue.hpp>
26#include <com/sun/star/sdbc/KeyRule.hpp>
27#include <com/sun/star/sdbc/ProcedureResult.hpp>
28#include <com/sun/star/sdbc/IndexType.hpp>
30#include <com/sun/star/lang/DisposedException.hpp>
31#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
32#include <com/sun/star/sdbc/ResultSetType.hpp>
33#include <com/sun/star/sdbc/FetchDirection.hpp>
37#include <rtl/ref.hxx>
38
39#include <oledb.h>
40
41using namespace dbtools;
42using namespace connectivity::ado;
43using namespace cppu;
44using namespace ::comphelper;
45
46using namespace com::sun::star::uno;
47using namespace com::sun::star::lang;
48using namespace com::sun::star::beans;
49using namespace com::sun::star::sdbc;
50
51
52ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet)
55 ,m_pRecordSet(_pRecordSet)
56 ,m_nRowPos(0)
57 ,m_bWasNull(false)
58 ,m_bEOF(false)
59 ,m_bOnFirstAfterOpen(false)
60{
61 osl_atomic_increment( &m_refCount );
62 m_aColMapping.push_back(-1);
63 if(_pRecordSet)
64 {
65 m_pRecordSet->AddRef();
66 VARIANT_BOOL bIsAtBOF;
67 m_pRecordSet->get_BOF(&bIsAtBOF);
68 m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
69 }
70 else
71 m_bOnFirstAfterOpen = false;
72 osl_atomic_decrement( &m_refCount );
73 // allocBuffer();
74}
75
76
78{
79 if(m_pRecordSet)
80 m_pRecordSet->Release();
81}
82
84{
86
87 ::osl::MutexGuard aGuard(m_aMutex);
88 if(m_pRecordSet)
89 m_pRecordSet->Close();
90 m_aStatement.clear();
91 m_xMetaData.clear();
92}
93
95{
97 return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType);
98}
99
100css::uno::Sequence< css::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( )
101{
105
106 return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
107}
108
110{
111 if(!m_pRecordSet)
113}
114
115
116sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const OUString& columnName )
117{
118 ::osl::MutexGuard aGuard( m_aMutex );
119 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
120
121
123 sal_Int32 nLen = xMeta->getColumnCount();
124 sal_Int32 i = 1;
125 for(;i<=nLen;++i)
126 {
127 if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
128 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
129 return i;
130 }
131
133 assert(false);
134 return 0; // Never reached
135}
136#define BLOCK_SIZE 256
137
139{
140 ::osl::MutexGuard aGuard( m_aMutex );
141 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
142
144
145
146 columnIndex = mapColumn(columnIndex);
147 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
148 if((aField.GetAttributes() & adFldLong) == adFldLong)
149 {
150 //Copy the data only up to the Actual Size of Field.
151 sal_Int32 nSize = aField.GetActualSize();
153 sal_Int32 index = 0;
154 while(index < nSize)
155 {
156 m_aValue = aField.GetChunk(BLOCK_SIZE);
157 if(m_aValue.isNull())
158 break;
159 UCHAR chData;
160 for(LONG index2 = 0;index2 < BLOCK_SIZE;++index2)
161 {
162 HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
163 if(SUCCEEDED(hr))
164 {
165 //Take BYTE by BYTE and advance Memory Location
166 aData.getArray()[index++] = chData;
167 }
168 else
169 break;
170 }
171 }
173 }
174 // else we ask for a bytesequence
175 aField.get_Value(m_aValue);
176 if(m_aValue.isNull())
177 return nullptr;
179}
180
182{
183 ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
184 return nullptr;
185}
186
187
188sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex )
189{
190 ::osl::MutexGuard aGuard( m_aMutex );
191
192 if ( !m_aValueRange.empty() && columnIndex == 11 && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end() )
193 {
194 getValue(2);
195 if ( m_aValue.getInt16() != adCurrency )
196 return false;
197 }
198 return getValue(columnIndex).getBool();
199}
200
201
202sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex )
203{
204 ::osl::MutexGuard aGuard( m_aMutex );
205
206 getValue(columnIndex);
207
208 columnIndex = mapColumn(columnIndex);
209
210 if(m_aValue.isNull())
211 return 0;
212 if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
213 return static_cast<sal_Int8>((*m_aValueRangeIter).second[m_aValue.getInt32()]);
214 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
215 return static_cast<sal_Int8>((*m_aStrValueRangeIter).second[m_aValue.getString()]);
216
217 return m_aValue.getInt8();
218}
219
220
222{
223 return getValue(columnIndex).getByteSequence();
224}
225
226
227css::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex )
228{
229 return getValue(columnIndex).getDate();
230}
231
232
233double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex )
234{
235 return getValue(columnIndex).getDouble();
236}
237
238
239float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex )
240{
241 return getValue(columnIndex).getFloat();
242}
243
244
245sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex )
246{
247 ::osl::MutexGuard aGuard( m_aMutex );
248
249
250 getValue(columnIndex);
251
252 columnIndex = mapColumn(columnIndex);
253 if(m_aValue.isNull())
254 return 0;
255
256 if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
257 return (*m_aValueRangeIter).second[m_aValue.getInt32()];
258 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
259 return (*m_aStrValueRangeIter).second[m_aValue.getString()];
260
261 return m_aValue.getInt32();
262}
263
264
266{
267 ::dbtools::throwFeatureNotImplementedSQLException( "XResultSet::getRow", *this );
268 return 0;
269}
270
271
272sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ )
273{
275 return sal_Int64(0);
276}
277
278
280{
281 ::osl::MutexGuard aGuard( m_aMutex );
282 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
283
285
286
287 if(!m_xMetaData.is())
289
290 return m_xMetaData;
291}
292
294{
296 return nullptr;
297}
298
299
300Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ )
301{
303 return nullptr;
304}
305
306Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ )
307{
309 return nullptr;
310}
311
312
313Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ )
314{
316 return nullptr;
317}
318
319
320Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& /*typeMap*/ )
321{
322 ::osl::MutexGuard aGuard( m_aMutex );
323 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
324
326
327
328 columnIndex = mapColumn(columnIndex);
329 return Any();
330}
331
332
333sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
334{
335 ::osl::MutexGuard aGuard( m_aMutex );
336
337 getValue(columnIndex);
338
339 columnIndex = mapColumn(columnIndex);
340 if(m_aValue.isNull())
341 return 0;
342
343 if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
344 return static_cast<sal_Int16>((*m_aValueRangeIter).second[m_aValue.getInt32()]);
345 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
346 return static_cast<sal_Int16>((*m_aStrValueRangeIter).second[m_aValue.getString()]);
347
348 return m_aValue.getInt16();
349}
350
351
352OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
353{
354 ::osl::MutexGuard aGuard( m_aMutex );
355
356 getValue(columnIndex);
357
358
359 columnIndex = mapColumn(columnIndex);
360 if(m_aValue.isNull())
361 return OUString();
362 if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end())
363 return (*m_aIntValueRangeIter).second[m_aValue.getInt32()];
364
365 return m_aValue.getString();
366}
367
368
369css::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex )
370{
371 return getValue(columnIndex).getTime();
372}
373
374
375css::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex )
376{
377 return getValue(columnIndex).getDateTime();
378}
379
380
382{
383 ::osl::MutexGuard aGuard( m_aMutex );
384 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
385
387
388
389 VARIANT_BOOL bIsAtEOF;
390 m_pRecordSet->get_EOF(&bIsAtEOF);
391 return bIsAtEOF == VARIANT_TRUE;
392}
393
395{
396 ::osl::MutexGuard aGuard( m_aMutex );
397 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
398
400
401
402 return m_nRowPos == 1;
403}
404
406{
407 ::osl::MutexGuard aGuard( m_aMutex );
408 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
409
411
412
413 return true;
414}
415
417{
418 ::osl::MutexGuard aGuard( m_aMutex );
419 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
420
422
423
424 if(first())
425 previous();
426}
427
429{
430 ::osl::MutexGuard aGuard( m_aMutex );
431 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
432
434
435
436 if(last())
437 next();
438 m_bEOF = true;
439}
440
441
443{
444 {
445 ::osl::MutexGuard aGuard( m_aMutex );
446 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
447
448 }
449 dispose();
450}
451
452
454{
455 ::osl::MutexGuard aGuard( m_aMutex );
456 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
457
458
459 if(!m_pRecordSet)
460 return false;
461
462 bool bRet = SUCCEEDED(m_pRecordSet->MoveFirst());
463 if ( bRet )
464 m_nRowPos = 1;
465 return bRet;
466}
467
468
470{
471 ::osl::MutexGuard aGuard( m_aMutex );
472 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
473
474
475 return m_pRecordSet && SUCCEEDED(m_pRecordSet->MoveLast());
476}
477
479{
480 ::osl::MutexGuard aGuard( m_aMutex );
481 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
482
483
484 if(first())
485 {
486 OLEVariant aEmpty;
487 aEmpty.setNoArg();
488 bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
489 if(bRet)
490 m_nRowPos = row;
491 return bRet;
492 }
493 return false;
494}
495
497{
498 ::osl::MutexGuard aGuard( m_aMutex );
499 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
500
501
502 if(!m_pRecordSet)
503 return false;
504
505 OLEVariant aEmpty;
506 aEmpty.setNoArg();
507 bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
508 if(bRet)
509 m_nRowPos += row;
510 return bRet;
511}
512
514{
515 ::osl::MutexGuard aGuard( m_aMutex );
516 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
517
518
519 if(!m_pRecordSet)
520 return false;
521
522 bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious());
523 if(bRet)
524 --m_nRowPos;
525 return bRet;
526}
527
529{
530 return m_aStatement.get();
531}
532
533
535{
536 ::osl::MutexGuard aGuard( m_aMutex );
537 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
538
540
541
542 sal_Int32 eRec;
543 m_pRecordSet->get_Status(&eRec);
544 return (RecordStatusEnum(eRec) & adRecDeleted) == adRecDeleted;
545}
546
548{ ::osl::MutexGuard aGuard( m_aMutex );
549 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
550
552
553
554 sal_Int32 eRec;
555 m_pRecordSet->get_Status(&eRec);
556 return (RecordStatusEnum(eRec) & adRecNew) == adRecNew;
557}
558
560{
561 ::osl::MutexGuard aGuard( m_aMutex );
562 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
563
565
566
567 sal_Int32 eRec;
568 m_pRecordSet->get_Status(&eRec);
569 return (RecordStatusEnum(eRec) & adRecModified) == adRecModified;
570}
571
572
574{
575 ::osl::MutexGuard aGuard( m_aMutex );
576 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
577
578
579 if(!m_pRecordSet)
580 return true;
581
582 VARIANT_BOOL bIsAtBOF;
583 m_pRecordSet->get_BOF(&bIsAtBOF);
584 return bIsAtBOF == VARIANT_TRUE;
585}
586
587
589{
590 ::osl::MutexGuard aGuard( m_aMutex );
591 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
592
593
594 if(!m_pRecordSet)
595 return false;
596
598 {
599 m_bOnFirstAfterOpen = false;
600 return true;
601 }
602 else
603 return SUCCEEDED(m_pRecordSet->MoveNext());
604}
605
606
608{
609 ::osl::MutexGuard aGuard( m_aMutex );
610 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
611
613
614
615 return m_aValue.isNull();
616}
617
619{
620 ::osl::MutexGuard aGuard( m_aMutex );
621 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
622
624
625
626 m_pRecordSet->Resync(adAffectCurrent);
627}
628
629
631{
632 ::osl::MutexGuard aGuard( m_aMutex );
633 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
634
636
637
638 m_pRecordSet->Cancel();
639}
640
642{
643}
644
646{
647 return Any();
648}
649
651{
652 return ResultSetConcurrency::READ_ONLY;
653}
654
656{
657 return ResultSetType::FORWARD_ONLY;
658}
659
661{
662 return FetchDirection::FORWARD;
663}
664
666{
667 sal_Int32 nValue=-1;
668 if(m_pRecordSet)
669 m_pRecordSet->get_CacheSize(&nValue);
670 return nValue;
671}
672
674{
675 return OUString();
676}
677
678
680{
681 ::dbtools::throwFeatureNotImplementedSQLException( "ResultSet::FetchDirection", *this );
682}
683
685{
686 if(m_pRecordSet)
687 m_pRecordSet->put_CacheSize(_par0);
688}
689
691{
692
693 return new ::cppu::OPropertyArrayHelper
694 {
695 {
696 {
700 0
701 },
702 {
706 0
707 },
708 {
712 0
713 },
714 {
718 0
719 },
720 {
724 0
725 }
726 }
727 };
728}
729
731{
732 return *getArrayHelper();
733}
734
736 Any & rConvertedValue,
737 Any & rOldValue,
738 sal_Int32 nHandle,
739 const Any& rValue )
740{
741 switch(nHandle)
742 {
746 throw css::lang::IllegalArgumentException();
748 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
750 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
751 default:
752 ;
753 }
754 return false;
755}
756
758 sal_Int32 nHandle,
759 const Any& /*rValue*/
760 )
761{
762 switch(nHandle)
763 {
769 throw Exception("cannot set prop " + OUString::number(nHandle), nullptr);
770 default:
771 OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!");
772 }
773}
774
776 Any& rValue,
777 sal_Int32 nHandle
778 ) const
779{
780 switch(nHandle)
781 {
783 rValue <<= getCursorName();
784 break;
786 rValue <<= getResultSetConcurrency();
787 break;
789 rValue <<= getResultSetType();
790 break;
792 rValue <<= getFetchDirection();
793 break;
795 rValue <<= getFetchSize();
796 break;
797 }
798}
799
801{
802 for(sal_Int32 i=1;i<4;i++)
803 m_aColMapping.push_back(i);
804 m_aColMapping.push_back(5);
805 m_aColMapping.push_back(7);
806 m_aColMapping.push_back(8);
807 m_aColMapping.push_back(6);
808 m_aColMapping.push_back(4);
809
810 ::std::map<sal_Int32,sal_Int32> aMap
811 {
812 {DB_PT_UNKNOWN, ProcedureResult::UNKNOWN},
813 {DB_PT_PROCEDURE, ProcedureResult::NONE},
814 {DB_PT_FUNCTION, ProcedureResult::RETURN}
815 };
816 m_aValueRange[4] = aMap;
817
819 pMetaData->setProceduresMap();
820 m_xMetaData = pMetaData;
821}
822
824{
825 m_aColMapping.push_back(1);
826
828}
829
831{
832 m_aColMapping.push_back(2);
833
835}
836
838{
839
840 m_aColMapping.push_back(3);
841 m_aColMapping.push_back(4);
842 m_aColMapping.push_back(5);
843 m_aColMapping.push_back(6);
844 m_aColMapping.push_back(2);
845 m_aColMapping.push_back(9);
846 m_aColMapping.push_back(10);
847
849 pMetaData->setColumnPrivilegesMap();
850 m_xMetaData = pMetaData;
851}
852
854{
855
856 for(sal_Int32 i=1;i<5;++i)
857 m_aColMapping.push_back(i);
858
859 m_aColMapping.push_back(12);
860 m_aColMapping.push_back(12); // is used as TYPE_NAME
861
862 m_aColMapping.push_back(14);
863 m_aColMapping.push_back(6);
864 m_aColMapping.push_back(17);
865 m_aColMapping.push_back(18);
866
867 m_aColMapping.push_back(11);
868 m_aColMapping.push_back(29);
869 m_aColMapping.push_back(9);
870 m_aColMapping.push_back(18);
871 m_aColMapping.push_back(18);
872
873 m_aColMapping.push_back(15);
874 m_aColMapping.push_back(7);
875 m_aColMapping.push_back(11);
876
877 ::std::map<sal_Int32,sal_Int32> aMap {
878 {adEmpty, ADOS::MapADOType2Jdbc(adEmpty)},
879 {adTinyInt, ADOS::MapADOType2Jdbc(adTinyInt)},
880 {adSmallInt, ADOS::MapADOType2Jdbc(adSmallInt)},
881 {adInteger, ADOS::MapADOType2Jdbc(adInteger)},
882 {adBigInt, ADOS::MapADOType2Jdbc(adBigInt)},
883 {adUnsignedTinyInt, ADOS::MapADOType2Jdbc(adUnsignedTinyInt)},
884 {adUnsignedSmallInt, ADOS::MapADOType2Jdbc(adUnsignedSmallInt)},
885 {adUnsignedInt, ADOS::MapADOType2Jdbc(adUnsignedInt)},
886 {adUnsignedBigInt, ADOS::MapADOType2Jdbc(adUnsignedBigInt)},
887 {adSingle, ADOS::MapADOType2Jdbc(adSingle)},
888 {adDouble, ADOS::MapADOType2Jdbc(adDouble)},
889 {adCurrency, ADOS::MapADOType2Jdbc(adCurrency)},
890 {adDecimal, ADOS::MapADOType2Jdbc(adDecimal)},
891 {adNumeric, ADOS::MapADOType2Jdbc(adNumeric)},
892 {adBoolean, ADOS::MapADOType2Jdbc(adBoolean)},
893 {adError, ADOS::MapADOType2Jdbc(adError)},
894 {adUserDefined, ADOS::MapADOType2Jdbc(adUserDefined)},
895 {adVariant, ADOS::MapADOType2Jdbc(adVariant)},
896 {adIDispatch, ADOS::MapADOType2Jdbc(adIDispatch)},
897 {adIUnknown, ADOS::MapADOType2Jdbc(adIUnknown)},
898 {adGUID, ADOS::MapADOType2Jdbc(adGUID)},
899 {adDate, ADOS::MapADOType2Jdbc(adDate)},
900 {adDBDate, ADOS::MapADOType2Jdbc(adDBDate)},
901 {adDBTime, ADOS::MapADOType2Jdbc(adDBTime)},
902 {adDBTimeStamp, ADOS::MapADOType2Jdbc(adDBTimeStamp)},
903 {adBSTR, ADOS::MapADOType2Jdbc(adBSTR)},
904 {adChar, ADOS::MapADOType2Jdbc(adChar)},
905 {adVarChar, ADOS::MapADOType2Jdbc(adVarChar)},
906 {adLongVarChar, ADOS::MapADOType2Jdbc(adLongVarChar)},
907 {adWChar, ADOS::MapADOType2Jdbc(adWChar)},
908 {adVarWChar, ADOS::MapADOType2Jdbc(adVarWChar)},
909 {adLongVarWChar, ADOS::MapADOType2Jdbc(adLongVarWChar)},
910 {adBinary, ADOS::MapADOType2Jdbc(adBinary)},
911 {adVarBinary, ADOS::MapADOType2Jdbc(adVarBinary)},
912 {adLongVarBinary, ADOS::MapADOType2Jdbc(adLongVarBinary)},
913 {adChapter, ADOS::MapADOType2Jdbc(adChapter)},
914 {adFileTime, ADOS::MapADOType2Jdbc(adFileTime)},
915 {adPropVariant, ADOS::MapADOType2Jdbc(adPropVariant)},
916 {adVarNumeric, ADOS::MapADOType2Jdbc(adVarNumeric)}
917 };
918 m_aValueRange[12] = aMap;
919
920 std::map< sal_Int32,OUString> aMap2 {
921 {0, "YES"},
922 {1, "NO"}
923 };
924 m_aIntValueRange[18] = aMap2;
925
927 pMetaData->setColumnsMap();
928 m_xMetaData = pMetaData;
929}
930
932{
933
934 for(sal_Int32 i=1;i<5;i++)
935 m_aColMapping.push_back(i);
936 m_aColMapping.push_back(6);
937
939 pMetaData->setTablesMap();
940 m_xMetaData = pMetaData;
941}
942
944{
945
946 for(sal_Int32 i=1;i<5;i++)
947 m_aColMapping.push_back(i);
948 m_aColMapping.push_back(6);
949 m_aColMapping.push_back(10);
950 m_aColMapping.push_back(16);
951 m_aColMapping.push_back(13);
952 m_aColMapping.push_back(11);
953 m_aColMapping.push_back(12);
954
955 m_aColMapping.push_back(9);
956 m_aColMapping.push_back(14);
957
958 ::std::map<sal_Int32,sal_Int32> aMap
959 {
960 {DBTYPE_EMPTY, DataType::SQLNULL},
961 {DBTYPE_NULL, DataType::SQLNULL},
962 {DBTYPE_I2, DataType::SMALLINT},
963 {DBTYPE_I4, DataType::INTEGER},
964 {DBTYPE_R4, DataType::FLOAT},
965 {DBTYPE_R8, DataType::DOUBLE},
966 {DBTYPE_CY, DataType::BIGINT},
967 {DBTYPE_DATE, DataType::DATE},
968 {DBTYPE_BSTR, DataType::VARCHAR},
969 {DBTYPE_IDISPATCH, DataType::OBJECT},
970 {DBTYPE_ERROR, DataType::OTHER},
971 {DBTYPE_BOOL, DataType::BIT},
972 {DBTYPE_VARIANT, DataType::STRUCT},
973 {DBTYPE_IUNKNOWN, DataType::OTHER},
974 {DBTYPE_DECIMAL, DataType::DECIMAL},
975 {DBTYPE_UI1, DataType::TINYINT},
976 {DBTYPE_ARRAY, DataType::ARRAY},
977 {DBTYPE_BYREF, DataType::REF},
978 {DBTYPE_I1, DataType::CHAR},
979 {DBTYPE_UI2, DataType::SMALLINT},
980 {DBTYPE_UI4, DataType::INTEGER},
981
982 // aMap[The] = ;
983 // aMap[in] = ;
984 {DBTYPE_I8, DataType::BIGINT},
985 {DBTYPE_UI8, DataType::BIGINT},
986 {DBTYPE_GUID, DataType::OTHER},
987 {DBTYPE_VECTOR, DataType::OTHER},
988 {DBTYPE_FILETIME, DataType::OTHER},
989 {DBTYPE_RESERVED, DataType::OTHER},
990
991 // aMap[The] = ;
992 {DBTYPE_BYTES, DataType::VARBINARY},
993 {DBTYPE_STR, DataType::LONGVARCHAR},
994 {DBTYPE_WSTR, DataType::LONGVARCHAR},
995 {DBTYPE_NUMERIC, DataType::NUMERIC},
996 {DBTYPE_UDT, DataType::OTHER},
997 {DBTYPE_DBDATE, DataType::DATE},
998 {DBTYPE_DBTIME, DataType::TIME},
999 {DBTYPE_DBTIMESTAMP, DataType::TIMESTAMP},
1000 {DBTYPE_HCHAPTER, DataType::OTHER},
1001 {DBTYPE_PROPVARIANT, DataType::OTHER},
1002 {DBTYPE_VARNUMERIC, DataType::NUMERIC}
1003 };
1004
1005 m_aValueRange[10] = aMap;
1006
1008 pMetaData->setProcedureColumnsMap();
1009 m_xMetaData = pMetaData;
1010}
1011
1013{
1014
1015 sal_Int32 i=1;
1016 for(;i<5;i++)
1017 m_aColMapping.push_back(i);
1018 m_aColMapping.push_back(7);
1019 m_aColMapping.push_back(8);
1020
1022 pMetaData->setProcedureColumnsMap();
1023 m_xMetaData = pMetaData;
1024}
1025
1027{
1028
1029 sal_Int32 i=1;
1030 for(;i<4;i++)
1031 m_aColMapping.push_back(i);
1032 m_aColMapping.push_back(8);
1033 m_aColMapping.push_back(4);
1034 m_aColMapping.push_back(6);
1035 m_aColMapping.push_back(10);
1036 m_aColMapping.push_back(17);
1037 m_aColMapping.push_back(18);
1038 m_aColMapping.push_back(21);
1039 m_aColMapping.push_back(22);
1040 m_aColMapping.push_back(23);
1041 m_aColMapping.push_back(24);
1042
1043 ::std::map<sal_Int32,sal_Int32> aMap
1044 {
1045 { DBPROPVAL_IT_HASH, IndexType::HASHED },
1046 { DBPROPVAL_IT_CONTENT, IndexType::OTHER },
1047 { DBPROPVAL_IT_OTHER, IndexType::OTHER },
1048 { DBPROPVAL_IT_BTREE, IndexType::OTHER }
1049 };
1050
1051 m_aValueRange[10] = aMap;
1052
1053 ::std::map<sal_Int32,sal_Int32> aMap2
1054 {
1055 { 0, 1 },
1056 { 1, 0 }
1057 };
1058 m_aValueRange[8] = aMap2;
1059
1060 std::map< sal_Int32,OUString> aMap3
1061 {
1062 { 0, "" },
1063 { DB_COLLATION_ASC, "A" },
1064 { DB_COLLATION_DESC, "D" }
1065 };
1066
1067 m_aIntValueRange[21] = aMap3;
1068
1070 pMetaData->setIndexInfoMap();
1071 m_xMetaData = pMetaData;
1072}
1073
1075{
1076
1077 sal_Int32 i=3;
1078 for(;i<6;i++)
1079 m_aColMapping.push_back(i);
1080 m_aColMapping.push_back(1);
1081 m_aColMapping.push_back(2);
1082 m_aColMapping.push_back(6);
1083 m_aColMapping.push_back(7);
1084
1085 std::map< sal_Int32,OUString> aMap
1086 {
1087 { 0, "YES" },
1088 { 1, "NO" }
1089 };
1091
1092
1094 pMetaData->setTablePrivilegesMap();
1095 m_xMetaData = pMetaData;
1096}
1097
1099{
1100
1101 sal_Int32 i=1;
1102 for(;i<5;i++)
1103 m_aColMapping.push_back(i);
1104 for(i=7;i<11;i++)
1105 m_aColMapping.push_back(i);
1106
1107 m_aColMapping.push_back(13);
1108 m_aColMapping.push_back(14);
1109 m_aColMapping.push_back(15);
1110 m_aColMapping.push_back(17);
1111 m_aColMapping.push_back(16);
1112 m_aColMapping.push_back(18);
1113
1114 std::map< OUString,sal_Int32> aMap
1115 {
1116 { "CASCADE", KeyRule::CASCADE },
1117 { "RESTRICT", KeyRule::RESTRICT },
1118 { "SET NULL", KeyRule::SET_NULL },
1119 { "SET DEFAULT", KeyRule::SET_DEFAULT },
1120 { "NO ACTION", KeyRule::NO_ACTION }
1121 };
1122
1123 m_aStrValueRange[14] = aMap;
1124 m_aStrValueRange[15] = aMap;
1125
1127 pMetaData->setCrossReferenceMap();
1128 m_xMetaData = pMetaData;
1129}
1130
1132{
1133 sal_Int32 i=1;
1134 for(;i<19;i++)
1135 m_aColMapping.push_back(i);
1136
1137 std::map< OUString,sal_Int32> aMap1 { { OUString(), 10 } };
1138
1139 m_aStrValueRange[18] = aMap1;
1140
1141 ::std::map<sal_Int32,sal_Int32> aMap
1142 {
1143 {adEmpty, ADOS::MapADOType2Jdbc(adEmpty)},
1144 {adTinyInt, ADOS::MapADOType2Jdbc(adTinyInt)},
1145 {adSmallInt, ADOS::MapADOType2Jdbc(adSmallInt)},
1146 {adInteger, ADOS::MapADOType2Jdbc(adInteger)},
1147 {adBigInt, ADOS::MapADOType2Jdbc(adBigInt)},
1148 {adUnsignedTinyInt, ADOS::MapADOType2Jdbc(adUnsignedTinyInt)},
1149 {adUnsignedSmallInt, ADOS::MapADOType2Jdbc(adUnsignedSmallInt)},
1150 {adUnsignedInt, ADOS::MapADOType2Jdbc(adUnsignedInt)},
1151 {adUnsignedBigInt, ADOS::MapADOType2Jdbc(adUnsignedBigInt)},
1152 {adSingle, ADOS::MapADOType2Jdbc(adSingle)},
1153 {adDouble, ADOS::MapADOType2Jdbc(adDouble)},
1154 {adCurrency, ADOS::MapADOType2Jdbc(adCurrency)},
1155 {adDecimal, ADOS::MapADOType2Jdbc(adDecimal)},
1156 {adNumeric, ADOS::MapADOType2Jdbc(adNumeric)},
1157 {adBoolean, ADOS::MapADOType2Jdbc(adBoolean)},
1158 {adError, ADOS::MapADOType2Jdbc(adError)},
1159 {adUserDefined, ADOS::MapADOType2Jdbc(adUserDefined)},
1160 {adVariant, ADOS::MapADOType2Jdbc(adVariant)},
1161 {adIDispatch, ADOS::MapADOType2Jdbc(adIDispatch)},
1162 {adIUnknown, ADOS::MapADOType2Jdbc(adIUnknown)},
1163 {adGUID, ADOS::MapADOType2Jdbc(adGUID)},
1164 {adDate, ADOS::MapADOType2Jdbc(_bJetEngine?adDBTimeStamp:adDate)},
1165 {adDBDate, ADOS::MapADOType2Jdbc(adDBDate)},
1166 {adDBTime, ADOS::MapADOType2Jdbc(adDBTime)},
1167 {adDBTimeStamp, ADOS::MapADOType2Jdbc(adDBTimeStamp)},
1168 {adBSTR, ADOS::MapADOType2Jdbc(adBSTR)},
1169 {adChar, ADOS::MapADOType2Jdbc(adChar)},
1170 {adVarChar, ADOS::MapADOType2Jdbc(adVarChar)},
1171 {adLongVarChar, ADOS::MapADOType2Jdbc(adLongVarChar)},
1172 {adWChar, ADOS::MapADOType2Jdbc(adWChar)},
1173 {adVarWChar, ADOS::MapADOType2Jdbc(adVarWChar)},
1174 {adLongVarWChar, ADOS::MapADOType2Jdbc(adLongVarWChar)},
1175 {adBinary, ADOS::MapADOType2Jdbc(adBinary)},
1176 {adVarBinary, ADOS::MapADOType2Jdbc(adVarBinary)},
1177 {adLongVarBinary, ADOS::MapADOType2Jdbc(adLongVarBinary)},
1178 {adChapter, ADOS::MapADOType2Jdbc(adChapter)},
1179 {adFileTime, ADOS::MapADOType2Jdbc(adFileTime)},
1180 {adPropVariant, ADOS::MapADOType2Jdbc(adPropVariant)},
1181 {adVarNumeric, ADOS::MapADOType2Jdbc(adVarNumeric)}
1182// {adArray, ADOS::MapADOType2Jdbc(adArray)}
1183 };
1184
1185 m_aValueRange[2] = aMap;
1186
1187 ::std::map<sal_Int32,sal_Int32> aColumnValueMapping
1188 {
1189 { VARIANT_FALSE, ColumnValue::NO_NULLS },
1190 { VARIANT_TRUE, ColumnValue::NULLABLE }
1191 };
1192 m_aValueRange[7] = aColumnValueMapping;
1193
1194 // now adjust the column mapping
1195 // OJ 24.01.2002 96860
1196 ::std::map<sal_Int32,sal_Int32> aSearchMapping
1197 {
1198 { DB_UNSEARCHABLE, ColumnSearch::NONE },
1199 { DB_LIKE_ONLY, ColumnSearch::CHAR },
1200 { DB_ALL_EXCEPT_LIKE, ColumnSearch::BASIC },
1201 { DB_SEARCHABLE, ColumnSearch::FULL }
1202 };
1203
1204 m_aValueRange[9] = aSearchMapping;
1205
1206 ::std::map<sal_Int32,sal_Int32> aCurrencyMapping;
1207 m_aValueRange[11] = aCurrencyMapping;
1208
1210 pMetaData->setTypeInfoMap();
1211 m_xMetaData = pMetaData;
1212}
1213
1215{
1216 ODatabaseMetaDataResultSet_BASE::acquire();
1217}
1218
1220{
1221 ODatabaseMetaDataResultSet_BASE::release();
1222}
1223
1224css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( )
1225{
1226 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
1227}
1228
1230{
1231 ::osl::MutexGuard aGuard( m_aMutex );
1232 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
1233
1235
1236 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
1237 aField.get_Value(m_aValue);
1238 return m_aValue;
1239}
1240
1241
1242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BLOCK_SIZE
void disposing(std::unique_lock< std::mutex > &rGuard)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
::dbtools::OPropertyMap & getPropMap()
Definition: TConnection.cxx:68
static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType)
Definition: adoimp.cxx:78
static WpADOField getField(ADORecordset *_pRecordSet, sal_Int32 _nColumnIndex)
Definition: adoimp.cxx:309
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
std::map< sal_Int32,::std::map< sal_Int32, sal_Int32 > >::iterator m_aValueRangeIter
virtual sal_Int32 SAL_CALL findColumn(const OUString &columnName) override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
std::map< sal_Int32, ::std::map< sal_Int32, sal_Int32 > > m_aValueRange
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< OUString, sal_Int32 > >::iterator m_aStrValueRangeIter
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< OUString, sal_Int32 > > m_aStrValueRange
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< sal_Int32, OUString > >::iterator m_aIntValueRangeIter
virtual void SAL_CALL release() noexcept override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getWarnings() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< sal_Int32, OUString > > m_aIntValueRange
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
css::util::Date getDate() const
css::util::DateTime getDateTime() const
css::util::Time getTime() const
css::uno::Sequence< sal_Int8 > getByteSequence() const
OLEVariant GetChunk(long Length) const
Definition: Awrapado.cxx:529
void get_Value(OLEVariant &aValVar) const
Definition: Awrapado.cxx:486
sal_Int32 GetActualSize() const
Definition: Awrapado.cxx:438
sal_Int32 GetAttributes() const
Definition: Awrapado.cxx:446
mutable::osl::Mutex m_aMutex
css::uno::Type const & get()
const OUString & getNameByIndex(sal_Int32 _nIndex) const
Definition: propertyids.cxx:95
ULONG m_refCount
sal_Int16 nValue
std::mutex m_aMutex
constexpr OUStringLiteral aData
@ Exception
Type
::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, css::sdbc::XRow, css::sdbc::XResultSetMetaDataSupplier, css::util::XCancellable, css::sdbc::XWarningsSupplier, css::sdbc::XCloseable, css::sdbc::XColumnLocate > ODatabaseMetaDataResultSet_BASE
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
void throwFunctionSequenceException(const Reference< XInterface > &Context, const Any &Next)
void throwFeatureNotImplementedSQLException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext, const Any &_rNextException)
void throwInvalidColumnException(const OUString &_rColumnName, const Reference< XInterface > &_rxContext)
int i
index
void dispose()
HashMap_OWString_Interface aMap
const char * columnName
Definition: pq_statics.cxx:56
#define PROPERTY_ID_RESULTSETTYPE
Definition: propertyids.hxx:44
#define PROPERTY_ID_CURSORNAME
Definition: propertyids.hxx:42
#define PROPERTY_ID_RESULTSETCONCURRENCY
Definition: propertyids.hxx:43
#define PROPERTY_ID_FETCHSIZE
Definition: propertyids.hxx:46
#define PROPERTY_ID_FETCHDIRECTION
Definition: propertyids.hxx:45
LONG
return hr
unsigned char sal_Bool
signed char sal_Int8
const SvXMLTokenMapEntry aTypes[]