1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <connectivity/FValue.hxx>
23 #include <connectivity/CommonTools.hxx>
24 #include <connectivity/dbconversion.hxx>
25 #include <comphelper/extract.hxx>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <rtl/ustrbuf.hxx>
28 #include <boost/type_traits.hpp>
30 using namespace ::dbtools
;
31 using namespace ::com::sun::star::sdbc
;
32 using namespace ::com::sun::star::sdb
;
33 using namespace ::com::sun::star::uno
;
34 using namespace ::com::sun::star::util
;
35 using namespace ::com::sun::star::io
;
37 namespace connectivity
41 static bool isStorageCompatible(sal_Int32 _eType1
, sal_Int32 _eType2
)
43 bool bIsCompatible
= true;
45 if (_eType1
!= _eType2
)
47 SAL_INFO( "connectivity.commontools", "ORowSetValue::isStorageCompatible _eType1 != _eType2" );
51 case DataType::VARCHAR
:
52 case DataType::DECIMAL
:
53 case DataType::NUMERIC
:
54 case DataType::LONGVARCHAR
:
55 bIsCompatible
= (DataType::CHAR
== _eType2
)
56 || (DataType::VARCHAR
== _eType2
)
57 || (DataType::DECIMAL
== _eType2
)
58 || (DataType::NUMERIC
== _eType2
)
59 || (DataType::LONGVARCHAR
== _eType2
);
62 case DataType::DOUBLE
:
64 bIsCompatible
= (DataType::DOUBLE
== _eType2
)
65 || (DataType::REAL
== _eType2
);
68 case DataType::BINARY
:
69 case DataType::VARBINARY
:
70 case DataType::LONGVARBINARY
:
71 bIsCompatible
= (DataType::BINARY
== _eType2
)
72 || (DataType::VARBINARY
== _eType2
)
73 || (DataType::LONGVARBINARY
== _eType2
);
76 case DataType::INTEGER
:
77 bIsCompatible
= (DataType::SMALLINT
== _eType2
)
78 || (DataType::TINYINT
== _eType2
)
79 || (DataType::BIT
== _eType2
)
80 || (DataType::BOOLEAN
== _eType2
);
82 case DataType::SMALLINT
:
83 bIsCompatible
= (DataType::TINYINT
== _eType2
)
84 || (DataType::BIT
== _eType2
)
85 || (DataType::BOOLEAN
== _eType2
);
87 case DataType::TINYINT
:
88 bIsCompatible
= (DataType::BIT
== _eType2
)
89 || (DataType::BOOLEAN
== _eType2
);
94 case DataType::OBJECT
:
95 bIsCompatible
= (DataType::BLOB
== _eType2
)
96 || (DataType::CLOB
== _eType2
)
97 || (DataType::OBJECT
== _eType2
);
101 bIsCompatible
= false;
104 return bIsCompatible
;
107 static bool isStorageComparable(sal_Int32 _eType1
, sal_Int32 _eType2
)
109 bool bIsComparable
= true;
111 if (_eType1
!= _eType2
)
113 SAL_INFO( "connectivity.commontools", "ORowSetValue::isStorageCompatible _eType1 != _eType2" );
117 case DataType::VARCHAR
:
118 case DataType::LONGVARCHAR
:
119 bIsComparable
= (DataType::CHAR
== _eType2
)
120 || (DataType::VARCHAR
== _eType2
)
121 || (DataType::LONGVARCHAR
== _eType2
);
124 case DataType::DECIMAL
:
125 case DataType::NUMERIC
:
126 bIsComparable
= (DataType::DECIMAL
== _eType2
)
127 || (DataType::NUMERIC
== _eType2
);
130 case DataType::DOUBLE
:
132 bIsComparable
= (DataType::DOUBLE
== _eType2
)
133 || (DataType::REAL
== _eType2
);
136 case DataType::BINARY
:
137 case DataType::VARBINARY
:
138 case DataType::LONGVARBINARY
:
139 bIsComparable
= (DataType::BINARY
== _eType2
)
140 || (DataType::VARBINARY
== _eType2
)
141 || (DataType::LONGVARBINARY
== _eType2
);
144 case DataType::INTEGER
:
145 bIsComparable
= (DataType::SMALLINT
== _eType2
)
146 || (DataType::TINYINT
== _eType2
)
147 || (DataType::BIT
== _eType2
)
148 || (DataType::BOOLEAN
== _eType2
);
150 case DataType::SMALLINT
:
151 bIsComparable
= (DataType::TINYINT
== _eType2
)
152 || (DataType::BIT
== _eType2
)
153 || (DataType::BOOLEAN
== _eType2
);
155 case DataType::TINYINT
:
156 bIsComparable
= (DataType::BIT
== _eType2
)
157 || (DataType::BOOLEAN
== _eType2
);
162 case DataType::OBJECT
:
163 bIsComparable
= (DataType::BLOB
== _eType2
)
164 || (DataType::CLOB
== _eType2
)
165 || (DataType::OBJECT
== _eType2
);
169 bIsComparable
= false;
172 return bIsComparable
;
180 #include <rtl/string.h>
184 struct AllocationType
186 const sal_Char
* pName
;
187 sal_Int32 nAllocatedUnits
;
189 AllocationType( ) : pName( NULL
), nAllocatedUnits( 0 ) { }
193 class AllocationTracer
196 typedef ::std::vector
< AllocationType
> AllocationState
;
197 static AllocationState s_aAllocated
;
198 static ::osl::Mutex s_aMutex
;
201 static void registerUnit( const sal_Char
* _pName
);
202 static void revokeUnit( const sal_Char
* _pName
);
205 static AllocationState::iterator
getLocation( const sal_Char
* _pName
);
209 AllocationTracer::AllocationState::iterator
AllocationTracer::getLocation( const sal_Char
* _pName
)
211 AllocationState::iterator aLookFor
= s_aAllocated
.begin();
213 aLookFor
!= s_aAllocated
.end();
217 if ( 0 == rtl_str_compare( aLookFor
->pName
, _pName
) )
222 s_aAllocated
.push_back( AllocationType() );
223 aLookFor
= s_aAllocated
.end(); --aLookFor
;
224 aLookFor
->pName
= _pName
; // note that this assumes that _pName is a constant string ....
229 AllocationTracer::AllocationState
AllocationTracer::s_aAllocated
;
230 ::osl::Mutex
AllocationTracer::s_aMutex
;
233 void AllocationTracer::registerUnit( const sal_Char
* _pName
)
235 ::osl::MutexGuard
aGuard( s_aMutex
);
237 AllocationState::iterator aPos
= getLocation( _pName
);
238 ++aPos
->nAllocatedUnits
;
242 void AllocationTracer::revokeUnit( const sal_Char
* _pName
)
244 ::osl::MutexGuard
aGuard( s_aMutex
);
246 AllocationState::iterator aPos
= getLocation( _pName
);
247 --aPos
->nAllocatedUnits
;
250 #define TRACE_ALLOC( type ) tracing::AllocationTracer::registerUnit( #type );
251 #define TRACE_FREE( type ) tracing::AllocationTracer::revokeUnit( #type );
254 #define TRACE_ALLOC( type )
255 #define TRACE_FREE( type )
259 void ORowSetValue::setTypeKind(sal_Int32 _eType
)
261 if ( !m_bNull
&& !isStorageCompatible(_eType
, m_eTypeKind
) )
265 case DataType::VARCHAR
:
267 case DataType::DECIMAL
:
268 case DataType::NUMERIC
:
269 case DataType::LONGVARCHAR
:
270 (*this) = getString();
272 case DataType::BIGINT
:
274 sal_Int64
nVal(getLong());
275 sal_uInt64
nuVal(getULong());
276 if (nVal
== 0 && nuVal
!= 0)
283 case DataType::FLOAT
:
284 (*this) = getFloat();
286 case DataType::DOUBLE
:
288 (*this) = getDouble();
290 case DataType::TINYINT
:
293 case DataType::SMALLINT
:
294 (*this) = getInt16();
296 case DataType::INTEGER
:
298 sal_Int32
nVal(getInt32());
299 sal_uInt32
nuVal(getUInt32());
300 if (nVal
== 0 && nuVal
!= 0)
307 case DataType::BOOLEAN
:
316 case DataType::TIMESTAMP
:
317 (*this) = getDateTime();
319 case DataType::BINARY
:
320 case DataType::VARBINARY
:
321 case DataType::LONGVARBINARY
:
322 (*this) = getSequence();
326 case DataType::OBJECT
:
327 case DataType::OTHER
:
332 SAL_WARN( "connectivity.commontools","ORowSetValue::setTypeKind(): UNSUPPORTED TYPE!");
336 m_eTypeKind
= _eType
;
340 void ORowSetValue::free()
347 case DataType::VARCHAR
:
348 case DataType::DECIMAL
:
349 case DataType::NUMERIC
:
350 case DataType::LONGVARCHAR
:
351 OSL_ENSURE(m_aValue
.m_pString
,"String pointer is null!");
352 rtl_uString_release(m_aValue
.m_pString
);
353 m_aValue
.m_pString
= NULL
;
356 delete static_cast<css::util::Date
*>(m_aValue
.m_pValue
);
358 m_aValue
.m_pValue
= NULL
;
361 delete static_cast<css::util::Time
*>(m_aValue
.m_pValue
);
362 TRACE_FREE( tools::Time
)
363 m_aValue
.m_pValue
= NULL
;
365 case DataType::TIMESTAMP
:
366 delete static_cast<css::util::DateTime
*>(m_aValue
.m_pValue
);
367 TRACE_FREE( DateTime
)
368 m_aValue
.m_pValue
= NULL
;
370 case DataType::BINARY
:
371 case DataType::VARBINARY
:
372 case DataType::LONGVARBINARY
:
373 delete static_cast<Sequence
<sal_Int8
>*>(m_aValue
.m_pValue
);
374 TRACE_FREE( Sequence_sal_Int8
)
375 m_aValue
.m_pValue
= NULL
;
379 case DataType::OBJECT
:
380 delete static_cast<Any
*>(m_aValue
.m_pValue
);
382 m_aValue
.m_pValue
= NULL
;
385 case DataType::TINYINT
:
386 case DataType::SMALLINT
:
387 case DataType::INTEGER
:
388 case DataType::BIGINT
:
389 case DataType::BOOLEAN
:
390 case DataType::FLOAT
:
391 case DataType::DOUBLE
:
395 if ( m_aValue
.m_pValue
)
397 delete static_cast<Any
*>(m_aValue
.m_pValue
);
399 m_aValue
.m_pValue
= NULL
;
408 ORowSetValue
& ORowSetValue::operator=(const ORowSetValue
& _rRH
)
413 if ( m_eTypeKind
!= _rRH
.m_eTypeKind
|| (_rRH
.m_bNull
&& !m_bNull
) || m_bSigned
!= _rRH
.m_bSigned
)
416 m_bBound
= _rRH
.m_bBound
;
417 m_eTypeKind
= _rRH
.m_eTypeKind
;
418 m_bSigned
= _rRH
.m_bSigned
;
420 if(m_bNull
&& !_rRH
.m_bNull
)
422 switch(_rRH
.m_eTypeKind
)
425 case DataType::VARCHAR
:
426 case DataType::DECIMAL
:
427 case DataType::NUMERIC
:
428 case DataType::LONGVARCHAR
:
429 rtl_uString_acquire(_rRH
.m_aValue
.m_pString
);
430 m_aValue
.m_pString
= _rRH
.m_aValue
.m_pString
;
433 m_aValue
.m_pValue
= new Date(*static_cast<Date
*>(_rRH
.m_aValue
.m_pValue
));
437 m_aValue
.m_pValue
= new Time(*static_cast<Time
*>(_rRH
.m_aValue
.m_pValue
));
438 TRACE_ALLOC( tools::Time
)
440 case DataType::TIMESTAMP
:
441 m_aValue
.m_pValue
= new DateTime(*static_cast<DateTime
*>(_rRH
.m_aValue
.m_pValue
));
442 TRACE_ALLOC( DateTime
)
444 case DataType::BINARY
:
445 case DataType::VARBINARY
:
446 case DataType::LONGVARBINARY
:
447 m_aValue
.m_pValue
= new Sequence
<sal_Int8
>(*static_cast<Sequence
<sal_Int8
>*>(_rRH
.m_aValue
.m_pValue
));
448 TRACE_ALLOC( Sequence_sal_Int8
)
451 case DataType::BOOLEAN
:
452 m_aValue
.m_bBool
= _rRH
.m_aValue
.m_bBool
;
454 case DataType::TINYINT
:
455 if ( _rRH
.m_bSigned
)
456 m_aValue
.m_nInt8
= _rRH
.m_aValue
.m_nInt8
;
458 m_aValue
.m_uInt8
= _rRH
.m_aValue
.m_uInt8
;
460 case DataType::SMALLINT
:
461 if ( _rRH
.m_bSigned
)
462 m_aValue
.m_nInt16
= _rRH
.m_aValue
.m_nInt16
;
464 m_aValue
.m_uInt16
= _rRH
.m_aValue
.m_uInt16
;
466 case DataType::INTEGER
:
467 if ( _rRH
.m_bSigned
)
468 m_aValue
.m_nInt32
= _rRH
.m_aValue
.m_nInt32
;
470 m_aValue
.m_uInt32
= _rRH
.m_aValue
.m_uInt32
;
472 case DataType::BIGINT
:
473 if ( _rRH
.m_bSigned
)
474 m_aValue
.m_nInt64
= _rRH
.m_aValue
.m_nInt64
;
476 m_aValue
.m_uInt64
= _rRH
.m_aValue
.m_uInt64
;
478 case DataType::FLOAT
:
479 m_aValue
.m_nFloat
= _rRH
.m_aValue
.m_nFloat
;
481 case DataType::DOUBLE
:
483 m_aValue
.m_nDouble
= _rRH
.m_aValue
.m_nDouble
;
486 m_aValue
.m_pValue
= new Any(*static_cast<Any
*>(_rRH
.m_aValue
.m_pValue
));
490 else if(!_rRH
.m_bNull
)
492 switch(_rRH
.m_eTypeKind
)
495 case DataType::VARCHAR
:
496 case DataType::DECIMAL
:
497 case DataType::NUMERIC
:
498 case DataType::LONGVARCHAR
:
499 (*this) = OUString(_rRH
.m_aValue
.m_pString
);
502 (*this) = *static_cast<Date
*>(_rRH
.m_aValue
.m_pValue
);
505 (*this) = *static_cast<Time
*>(_rRH
.m_aValue
.m_pValue
);
507 case DataType::TIMESTAMP
:
508 (*this) = *static_cast<DateTime
*>(_rRH
.m_aValue
.m_pValue
);
510 case DataType::BINARY
:
511 case DataType::VARBINARY
:
512 case DataType::LONGVARBINARY
:
513 (*this) = *static_cast<Sequence
<sal_Int8
>*>(_rRH
.m_aValue
.m_pValue
);
516 case DataType::BOOLEAN
:
517 m_aValue
.m_bBool
= _rRH
.m_aValue
.m_bBool
;
519 case DataType::TINYINT
:
520 if ( _rRH
.m_bSigned
)
521 m_aValue
.m_nInt8
= _rRH
.m_aValue
.m_nInt8
;
523 m_aValue
.m_uInt8
= _rRH
.m_aValue
.m_uInt8
;
525 case DataType::SMALLINT
:
526 if ( _rRH
.m_bSigned
)
527 m_aValue
.m_nInt16
= _rRH
.m_aValue
.m_nInt16
;
529 m_aValue
.m_uInt16
= _rRH
.m_aValue
.m_uInt16
;
531 case DataType::INTEGER
:
532 if ( _rRH
.m_bSigned
)
533 m_aValue
.m_nInt32
= _rRH
.m_aValue
.m_nInt32
;
535 m_aValue
.m_uInt32
= _rRH
.m_aValue
.m_uInt32
;
537 case DataType::BIGINT
:
538 if ( _rRH
.m_bSigned
)
539 m_aValue
.m_nInt64
= _rRH
.m_aValue
.m_nInt64
;
541 m_aValue
.m_uInt64
= _rRH
.m_aValue
.m_uInt64
;
543 case DataType::FLOAT
:
544 m_aValue
.m_nFloat
= _rRH
.m_aValue
.m_nFloat
;
546 case DataType::DOUBLE
:
548 m_aValue
.m_nDouble
= _rRH
.m_aValue
.m_nDouble
;
551 *static_cast<Any
*>(m_aValue
.m_pValue
) = *static_cast<Any
*>(_rRH
.m_aValue
.m_pValue
);
555 m_bNull
= _rRH
.m_bNull
;
557 m_eTypeKind
= _rRH
.m_eTypeKind
;
563 ORowSetValue
& ORowSetValue::operator=(const Date
& _rRH
)
565 if(m_eTypeKind
!= DataType::DATE
)
570 m_aValue
.m_pValue
= new Date(_rRH
);
572 m_eTypeKind
= DataType::DATE
;
576 *static_cast<Date
*>(m_aValue
.m_pValue
) = _rRH
;
581 ORowSetValue
& ORowSetValue::operator=(const css::util::Time
& _rRH
)
583 if(m_eTypeKind
!= DataType::TIME
)
588 m_aValue
.m_pValue
= new Time(_rRH
);
589 TRACE_ALLOC( tools::Time
)
590 m_eTypeKind
= DataType::TIME
;
594 *static_cast<Time
*>(m_aValue
.m_pValue
) = _rRH
;
599 ORowSetValue
& ORowSetValue::operator=(const DateTime
& _rRH
)
601 if(m_eTypeKind
!= DataType::TIMESTAMP
)
605 m_aValue
.m_pValue
= new DateTime(_rRH
);
606 TRACE_ALLOC( DateTime
)
607 m_eTypeKind
= DataType::TIMESTAMP
;
611 *static_cast<DateTime
*>(m_aValue
.m_pValue
) = _rRH
;
617 ORowSetValue
& ORowSetValue::operator=(const OUString
& _rRH
)
619 if(m_eTypeKind
!= DataType::VARCHAR
|| m_aValue
.m_pString
!= _rRH
.pData
)
624 m_aValue
.m_pString
= _rRH
.pData
;
625 rtl_uString_acquire(m_aValue
.m_pString
);
626 m_eTypeKind
= DataType::VARCHAR
;
633 ORowSetValue
& ORowSetValue::operator=(const double& _rRH
)
635 if(m_eTypeKind
!= DataType::DOUBLE
)
638 m_aValue
.m_nDouble
= _rRH
;
639 m_eTypeKind
= DataType::DOUBLE
;
645 ORowSetValue
& ORowSetValue::operator=(const float& _rRH
)
647 if(m_eTypeKind
!= DataType::FLOAT
)
650 m_aValue
.m_nFloat
= _rRH
;
651 m_eTypeKind
= DataType::FLOAT
;
658 ORowSetValue
& ORowSetValue::operator=(const sal_Int8
& _rRH
)
660 if(m_eTypeKind
!= DataType::TINYINT
)
663 m_aValue
.m_nInt8
= _rRH
;
664 m_eTypeKind
= DataType::TINYINT
;
671 ORowSetValue
& ORowSetValue::operator=(const sal_uInt8
& _rRH
)
673 if(m_eTypeKind
!= DataType::TINYINT
)
676 m_aValue
.m_uInt8
= _rRH
;
677 m_eTypeKind
= DataType::TINYINT
;
684 ORowSetValue
& ORowSetValue::operator=(const sal_Int16
& _rRH
)
686 if(m_eTypeKind
!= DataType::SMALLINT
)
689 m_aValue
.m_nInt16
= _rRH
;
690 m_eTypeKind
= DataType::SMALLINT
;
698 ORowSetValue
& ORowSetValue::operator=(const sal_uInt16
& _rRH
)
700 if(m_eTypeKind
!= DataType::SMALLINT
)
703 m_aValue
.m_uInt16
= _rRH
;
704 m_eTypeKind
= DataType::SMALLINT
;
712 ORowSetValue
& ORowSetValue::operator=(const sal_Int32
& _rRH
)
714 if(m_eTypeKind
!= DataType::INTEGER
)
717 m_aValue
.m_nInt32
= _rRH
;
719 m_eTypeKind
= DataType::INTEGER
;
727 ORowSetValue
& ORowSetValue::operator=(const sal_uInt32
& _rRH
)
729 if(m_eTypeKind
!= DataType::INTEGER
)
732 m_aValue
.m_uInt32
= _rRH
;
734 m_eTypeKind
= DataType::INTEGER
;
742 ORowSetValue
& ORowSetValue::operator=(const bool _rRH
)
744 if(m_eTypeKind
!= DataType::BIT
&& DataType::BOOLEAN
!= m_eTypeKind
)
747 m_aValue
.m_bBool
= _rRH
;
748 m_eTypeKind
= DataType::BOOLEAN
;
754 ORowSetValue
& ORowSetValue::operator=(const sal_Int64
& _rRH
)
756 if ( DataType::BIGINT
!= m_eTypeKind
)
759 m_aValue
.m_nInt64
= _rRH
;
760 m_eTypeKind
= DataType::BIGINT
;
767 ORowSetValue
& ORowSetValue::operator=(const sal_uInt64
& _rRH
)
769 if ( DataType::BIGINT
!= m_eTypeKind
)
772 m_aValue
.m_uInt64
= _rRH
;
773 m_eTypeKind
= DataType::BIGINT
;
780 ORowSetValue
& ORowSetValue::operator=(const Sequence
<sal_Int8
>& _rRH
)
782 if (!isStorageCompatible(DataType::LONGVARBINARY
,m_eTypeKind
))
787 m_aValue
.m_pValue
= new Sequence
<sal_Int8
>(_rRH
);
788 TRACE_ALLOC( Sequence_sal_Int8
)
791 *static_cast< Sequence
< sal_Int8
>* >(m_aValue
.m_pValue
) = _rRH
;
793 m_eTypeKind
= DataType::LONGVARBINARY
;
799 ORowSetValue
& ORowSetValue::operator=(const Any
& _rAny
)
801 if (!isStorageCompatible(DataType::OBJECT
,m_eTypeKind
))
806 m_aValue
.m_pValue
= new Any(_rAny
);
810 *static_cast<Any
*>(m_aValue
.m_pValue
) = _rAny
;
812 m_eTypeKind
= DataType::OBJECT
;
819 bool operator==(const Date
& _rLH
, const Date
& _rRH
)
821 return _rLH
.Day
== _rRH
.Day
&& _rLH
.Month
== _rRH
.Month
&& _rLH
.Year
== _rRH
.Year
;
825 bool operator==(const css::util::Time
& _rLH
, const css::util::Time
& _rRH
)
827 return _rLH
.Minutes
== _rRH
.Minutes
&& _rLH
.Hours
== _rRH
.Hours
&& _rLH
.Seconds
== _rRH
.Seconds
&& _rLH
.NanoSeconds
== _rRH
.NanoSeconds
;
831 bool operator==(const DateTime
& _rLH
, const DateTime
& _rRH
)
833 return _rLH
.Day
== _rRH
.Day
&& _rLH
.Month
== _rRH
.Month
&& _rLH
.Year
== _rRH
.Year
&&
834 _rLH
.Minutes
== _rRH
.Minutes
&& _rLH
.Hours
== _rRH
.Hours
&& _rLH
.Seconds
== _rRH
.Seconds
&& _rLH
.NanoSeconds
== _rRH
.NanoSeconds
;
838 bool ORowSetValue::operator==(const ORowSetValue
& _rRH
) const
840 if ( m_bNull
!= _rRH
.isNull() )
843 if(m_bNull
&& _rRH
.isNull())
846 if ( !isStorageComparable(m_eTypeKind
, _rRH
.m_eTypeKind
))
850 case DataType::FLOAT
:
851 case DataType::DOUBLE
:
853 return getDouble() == _rRH
.getDouble();
855 switch(_rRH
.m_eTypeKind
)
857 case DataType::FLOAT
:
858 case DataType::DOUBLE
:
860 return getDouble() == _rRH
.getDouble();
870 OSL_ENSURE(!m_bNull
,"SHould not be null!");
873 case DataType::VARCHAR
:
875 case DataType::LONGVARCHAR
:
877 OUString
aVal1(m_aValue
.m_pString
);
878 OUString
aVal2(_rRH
.m_aValue
.m_pString
);
879 return aVal1
== aVal2
;
882 if ( m_bSigned
!= _rRH
.m_bSigned
)
889 case DataType::DECIMAL
:
890 case DataType::NUMERIC
:
892 OUString
aVal1(m_aValue
.m_pString
);
893 OUString
aVal2(_rRH
.m_aValue
.m_pString
);
894 bRet
= aVal1
== aVal2
;
897 case DataType::FLOAT
:
898 bRet
= m_aValue
.m_nFloat
== _rRH
.m_aValue
.m_nFloat
;
900 case DataType::DOUBLE
:
902 bRet
= m_aValue
.m_nDouble
== _rRH
.m_aValue
.m_nDouble
;
904 case DataType::TINYINT
:
905 bRet
= m_bSigned
? ( m_aValue
.m_nInt8
== _rRH
.m_aValue
.m_nInt8
) : (m_aValue
.m_uInt8
== _rRH
.m_aValue
.m_uInt8
);
907 case DataType::SMALLINT
:
908 bRet
= m_bSigned
? ( m_aValue
.m_nInt16
== _rRH
.m_aValue
.m_nInt16
) : (m_aValue
.m_uInt16
== _rRH
.m_aValue
.m_uInt16
);
910 case DataType::INTEGER
:
911 bRet
= m_bSigned
? ( m_aValue
.m_nInt32
== _rRH
.m_aValue
.m_nInt32
) : (m_aValue
.m_uInt32
== _rRH
.m_aValue
.m_uInt32
);
913 case DataType::BIGINT
:
914 bRet
= m_bSigned
? ( m_aValue
.m_nInt64
== _rRH
.m_aValue
.m_nInt64
) : (m_aValue
.m_uInt64
== _rRH
.m_aValue
.m_uInt64
);
917 case DataType::BOOLEAN
:
918 bRet
= m_aValue
.m_bBool
== _rRH
.m_aValue
.m_bBool
;
921 bRet
= *static_cast<Date
*>(m_aValue
.m_pValue
) == *static_cast<Date
*>(_rRH
.m_aValue
.m_pValue
);
924 bRet
= *static_cast<Time
*>(m_aValue
.m_pValue
) == *static_cast<Time
*>(_rRH
.m_aValue
.m_pValue
);
926 case DataType::TIMESTAMP
:
927 bRet
= *static_cast<DateTime
*>(m_aValue
.m_pValue
) == *static_cast<DateTime
*>(_rRH
.m_aValue
.m_pValue
);
929 case DataType::BINARY
:
930 case DataType::VARBINARY
:
931 case DataType::LONGVARBINARY
:
936 case DataType::OBJECT
:
937 case DataType::OTHER
:
942 SAL_WARN( "connectivity.commontools","ORowSetValue::operator==(): UNSUPPORTED TYPE!");
948 Any
ORowSetValue::makeAny() const
951 if(isBound() && !isNull())
953 switch(getTypeKind())
955 case DataType::SQLNULL
:
956 assert(rValue
== Any());
959 case DataType::VARCHAR
:
960 case DataType::DECIMAL
:
961 case DataType::NUMERIC
:
962 case DataType::LONGVARCHAR
:
963 OSL_ENSURE(m_aValue
.m_pString
,"Value is null!");
964 rValue
<<= OUString(m_aValue
.m_pString
);
966 case DataType::FLOAT
:
967 rValue
<<= m_aValue
.m_nFloat
;
969 case DataType::DOUBLE
:
971 rValue
<<= m_aValue
.m_nDouble
;
974 OSL_ENSURE(m_aValue
.m_pValue
,"Value is null!");
975 rValue
<<= *static_cast<Date
*>(m_aValue
.m_pValue
);
978 OSL_ENSURE(m_aValue
.m_pValue
,"Value is null!");
979 rValue
<<= *static_cast<Time
*>(m_aValue
.m_pValue
);
981 case DataType::TIMESTAMP
:
982 OSL_ENSURE(m_aValue
.m_pValue
,"Value is null!");
983 rValue
<<= *static_cast<DateTime
*>(m_aValue
.m_pValue
);
985 case DataType::BINARY
:
986 case DataType::VARBINARY
:
987 case DataType::LONGVARBINARY
:
988 OSL_ENSURE(m_aValue
.m_pValue
,"Value is null!");
989 rValue
<<= *static_cast<Sequence
<sal_Int8
>*>(m_aValue
.m_pValue
);
993 case DataType::OBJECT
:
994 case DataType::OTHER
:
998 case DataType::BOOLEAN
:
999 rValue
<<= m_aValue
.m_bBool
;
1001 case DataType::TINYINT
:
1004 rValue
<<= m_aValue
.m_nInt8
;
1006 // There is no TypeClass_UNSIGNED_BYTE,
1007 // so silently promote it to a 16-bit integer,
1008 // that is TypeClass_UNSIGNED_SHORT
1009 rValue
<<= static_cast<sal_uInt16
>(m_aValue
.m_uInt8
);
1011 case DataType::SMALLINT
:
1014 rValue
<<= m_aValue
.m_nInt16
;
1016 // TypeClass_UNSIGNED_SHORT
1017 rValue
<<= m_aValue
.m_uInt16
;
1019 case DataType::INTEGER
:
1022 rValue
<<= m_aValue
.m_nInt32
;
1024 // TypeClass_UNSIGNED_LONG
1025 rValue
<<= m_aValue
.m_uInt32
;
1027 case DataType::BIGINT
:
1030 rValue
<<= m_aValue
.m_nInt64
;
1032 // TypeClass_UNSIGNED_HYPER
1033 rValue
<<= m_aValue
.m_uInt64
;
1036 SAL_WARN( "connectivity.commontools","ORowSetValue::makeAny(): UNSUPPORTED TYPE!");
1044 OUString
ORowSetValue::getString( ) const
1049 switch(getTypeKind())
1051 case DataType::CHAR
:
1052 case DataType::VARCHAR
:
1053 case DataType::DECIMAL
:
1054 case DataType::NUMERIC
:
1055 case DataType::LONGVARCHAR
:
1056 aRet
= m_aValue
.m_pString
;
1058 case DataType::FLOAT
:
1059 aRet
= OUString::number(static_cast<float>(*this));
1061 case DataType::DOUBLE
:
1062 case DataType::REAL
:
1063 aRet
= OUString::number(static_cast<double>(*this));
1065 case DataType::DATE
:
1066 aRet
= DBTypeConversion::toDateString(*this);
1068 case DataType::TIME
:
1069 aRet
= DBTypeConversion::toTimeString(*this);
1071 case DataType::TIMESTAMP
:
1072 aRet
= DBTypeConversion::toDateTimeString(*this);
1074 case DataType::BINARY
:
1075 case DataType::VARBINARY
:
1076 case DataType::LONGVARBINARY
:
1078 OUStringBuffer
sVal("0x");
1079 Sequence
<sal_Int8
> aSeq(getSequence());
1080 const sal_Int8
* pBegin
= aSeq
.getConstArray();
1081 const sal_Int8
* pEnd
= pBegin
+ aSeq
.getLength();
1082 for(;pBegin
!= pEnd
;++pBegin
)
1083 sVal
.append((sal_Int32
)*pBegin
,16);
1084 aRet
= sVal
.makeStringAndClear();
1088 aRet
= OUString::number(int(static_cast<bool>(*this)));
1090 case DataType::BOOLEAN
:
1091 aRet
= OUString::boolean(static_cast<bool>(*this));
1093 case DataType::TINYINT
:
1094 case DataType::SMALLINT
:
1095 case DataType::INTEGER
:
1097 aRet
= OUString::number(static_cast<sal_Int32
>(*this));
1099 aRet
= OUString::number(static_cast<sal_uInt32
>(*this));
1101 case DataType::BIGINT
:
1103 aRet
= OUString::number(static_cast<sal_Int64
>(*this));
1105 aRet
= OUString::number(static_cast<sal_uInt64
>(*this));
1107 case DataType::CLOB
:
1109 Any
aValue( getAny() );
1110 Reference
< XClob
> xClob
;
1111 if ( aValue
>>= xClob
)
1115 aRet
= xClob
->getSubString(1,(sal_Int32
)xClob
->length() );
1122 Any aValue
= makeAny();
1131 bool ORowSetValue::getBool() const
1136 switch(getTypeKind())
1138 case DataType::CHAR
:
1139 case DataType::VARCHAR
:
1140 case DataType::LONGVARCHAR
:
1142 const OUString
sValue(m_aValue
.m_pString
);
1143 if ( sValue
.equalsIgnoreAsciiCase("true") || (sValue
== "1") )
1148 else if ( sValue
.equalsIgnoreAsciiCase("false") || (sValue
== "0") )
1155 case DataType::DECIMAL
:
1156 case DataType::NUMERIC
:
1158 bRet
= OUString(m_aValue
.m_pString
).toInt32() != 0;
1160 case DataType::FLOAT
:
1161 bRet
= m_aValue
.m_nFloat
!= 0.0;
1163 case DataType::DOUBLE
:
1164 case DataType::REAL
:
1165 bRet
= m_aValue
.m_nDouble
!= 0.0;
1167 case DataType::DATE
:
1168 case DataType::TIME
:
1169 case DataType::TIMESTAMP
:
1170 case DataType::BINARY
:
1171 case DataType::VARBINARY
:
1172 case DataType::LONGVARBINARY
:
1173 OSL_FAIL("getBool() for this type is not allowed!");
1176 case DataType::BOOLEAN
:
1177 bRet
= m_aValue
.m_bBool
;
1179 case DataType::TINYINT
:
1180 bRet
= m_bSigned
? (m_aValue
.m_nInt8
!= 0) : (m_aValue
.m_uInt8
!= 0);
1182 case DataType::SMALLINT
:
1183 bRet
= m_bSigned
? (m_aValue
.m_nInt16
!= 0) : (m_aValue
.m_uInt16
!= 0);
1185 case DataType::INTEGER
:
1186 bRet
= m_bSigned
? (m_aValue
.m_nInt32
!= 0) : (m_aValue
.m_uInt32
!= 0);
1188 case DataType::BIGINT
:
1189 bRet
= m_bSigned
? (m_aValue
.m_nInt64
!= 0) : (m_aValue
.m_uInt64
!= 0);
1193 Any aValue
= makeAny();
1203 sal_Int8
ORowSetValue::getInt8() const
1208 switch(getTypeKind())
1210 case DataType::CHAR
:
1211 case DataType::VARCHAR
:
1212 case DataType::DECIMAL
:
1213 case DataType::NUMERIC
:
1214 case DataType::LONGVARCHAR
:
1215 nRet
= sal_Int8(OUString(m_aValue
.m_pString
).toInt32());
1217 case DataType::FLOAT
:
1218 nRet
= sal_Int8(m_aValue
.m_nFloat
);
1220 case DataType::DOUBLE
:
1221 case DataType::REAL
:
1222 nRet
= sal_Int8(m_aValue
.m_nDouble
);
1224 case DataType::DATE
:
1225 case DataType::TIME
:
1226 case DataType::TIMESTAMP
:
1227 case DataType::BINARY
:
1228 case DataType::VARBINARY
:
1229 case DataType::LONGVARBINARY
:
1230 case DataType::BLOB
:
1231 case DataType::CLOB
:
1232 OSL_FAIL("getInt8() for this type is not allowed!");
1235 case DataType::BOOLEAN
:
1236 nRet
= sal_Int8(m_aValue
.m_bBool
);
1238 case DataType::TINYINT
:
1240 nRet
= m_aValue
.m_nInt8
;
1242 nRet
= static_cast<sal_Int8
>(m_aValue
.m_uInt8
);
1244 case DataType::SMALLINT
:
1246 nRet
= static_cast<sal_Int8
>(m_aValue
.m_nInt16
);
1248 nRet
= static_cast<sal_Int8
>(m_aValue
.m_uInt16
);
1250 case DataType::INTEGER
:
1252 nRet
= static_cast<sal_Int8
>(m_aValue
.m_nInt32
);
1254 nRet
= static_cast<sal_Int8
>(m_aValue
.m_uInt32
);
1256 case DataType::BIGINT
:
1258 nRet
= static_cast<sal_Int8
>(m_aValue
.m_nInt64
);
1260 nRet
= static_cast<sal_Int8
>(m_aValue
.m_uInt64
);
1264 Any aValue
= makeAny();
1274 sal_uInt8
ORowSetValue::getUInt8() const
1279 switch(getTypeKind())
1281 case DataType::CHAR
:
1282 case DataType::VARCHAR
:
1283 case DataType::DECIMAL
:
1284 case DataType::NUMERIC
:
1285 case DataType::LONGVARCHAR
:
1286 nRet
= sal_uInt8(OUString(m_aValue
.m_pString
).toInt32());
1288 case DataType::FLOAT
:
1289 nRet
= sal_uInt8(m_aValue
.m_nFloat
);
1291 case DataType::DOUBLE
:
1292 case DataType::REAL
:
1293 nRet
= sal_uInt8(m_aValue
.m_nDouble
);
1295 case DataType::DATE
:
1296 case DataType::TIME
:
1297 case DataType::TIMESTAMP
:
1298 case DataType::BINARY
:
1299 case DataType::VARBINARY
:
1300 case DataType::LONGVARBINARY
:
1301 case DataType::BLOB
:
1302 case DataType::CLOB
:
1303 OSL_FAIL("getuInt8() for this type is not allowed!");
1306 case DataType::BOOLEAN
:
1307 nRet
= int(m_aValue
.m_bBool
);
1309 case DataType::TINYINT
:
1311 nRet
= m_aValue
.m_nInt8
;
1313 nRet
= m_aValue
.m_uInt8
;
1315 case DataType::SMALLINT
:
1317 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_nInt16
);
1319 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_uInt16
);
1321 case DataType::INTEGER
:
1323 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_nInt32
);
1325 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_uInt32
);
1327 case DataType::BIGINT
:
1329 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_nInt64
);
1331 nRet
= static_cast<sal_uInt8
>(m_aValue
.m_uInt64
);
1335 Any aValue
= makeAny();
1346 sal_Int16
ORowSetValue::getInt16() const
1351 switch(getTypeKind())
1353 case DataType::CHAR
:
1354 case DataType::VARCHAR
:
1355 case DataType::DECIMAL
:
1356 case DataType::NUMERIC
:
1357 case DataType::LONGVARCHAR
:
1358 nRet
= sal_Int16(OUString(m_aValue
.m_pString
).toInt32());
1360 case DataType::FLOAT
:
1361 nRet
= sal_Int16(m_aValue
.m_nFloat
);
1363 case DataType::DOUBLE
:
1364 case DataType::REAL
:
1365 nRet
= sal_Int16(m_aValue
.m_nDouble
);
1367 case DataType::DATE
:
1368 case DataType::TIME
:
1369 case DataType::TIMESTAMP
:
1370 case DataType::BINARY
:
1371 case DataType::VARBINARY
:
1372 case DataType::LONGVARBINARY
:
1373 case DataType::BLOB
:
1374 case DataType::CLOB
:
1375 OSL_FAIL("getInt16() for this type is not allowed!");
1378 case DataType::BOOLEAN
:
1379 nRet
= sal_Int16(m_aValue
.m_bBool
);
1381 case DataType::TINYINT
:
1383 nRet
= m_aValue
.m_nInt8
;
1385 nRet
= m_aValue
.m_uInt8
;
1387 case DataType::SMALLINT
:
1389 nRet
= m_aValue
.m_nInt16
;
1391 nRet
= static_cast<sal_Int16
>(m_aValue
.m_uInt16
);
1393 case DataType::INTEGER
:
1395 nRet
= static_cast<sal_Int16
>(m_aValue
.m_nInt32
);
1397 nRet
= static_cast<sal_Int16
>(m_aValue
.m_uInt32
);
1399 case DataType::BIGINT
:
1401 nRet
= static_cast<sal_Int16
>(m_aValue
.m_nInt64
);
1403 nRet
= static_cast<sal_Int16
>(m_aValue
.m_uInt64
);
1407 Any aValue
= makeAny();
1417 sal_uInt16
ORowSetValue::getUInt16() const
1419 sal_uInt16 nRet
= 0;
1422 switch(getTypeKind())
1424 case DataType::CHAR
:
1425 case DataType::VARCHAR
:
1426 case DataType::DECIMAL
:
1427 case DataType::NUMERIC
:
1428 case DataType::LONGVARCHAR
:
1429 nRet
= sal_uInt16(OUString(m_aValue
.m_pString
).toInt32());
1431 case DataType::FLOAT
:
1432 nRet
= sal_uInt16(m_aValue
.m_nFloat
);
1434 case DataType::DOUBLE
:
1435 case DataType::REAL
:
1436 nRet
= sal_uInt16(m_aValue
.m_nDouble
);
1438 case DataType::DATE
:
1439 case DataType::TIME
:
1440 case DataType::TIMESTAMP
:
1441 case DataType::BINARY
:
1442 case DataType::VARBINARY
:
1443 case DataType::LONGVARBINARY
:
1444 case DataType::BLOB
:
1445 case DataType::CLOB
:
1446 OSL_FAIL("getuInt16() for this type is not allowed!");
1449 case DataType::BOOLEAN
:
1450 nRet
= sal_uInt16(m_aValue
.m_bBool
);
1452 case DataType::TINYINT
:
1454 nRet
= m_aValue
.m_nInt8
;
1456 nRet
= m_aValue
.m_uInt8
;
1458 case DataType::SMALLINT
:
1460 nRet
= m_aValue
.m_nInt16
;
1462 nRet
= m_aValue
.m_uInt16
;
1464 case DataType::INTEGER
:
1466 nRet
= static_cast<sal_uInt16
>(m_aValue
.m_nInt32
);
1468 nRet
= static_cast<sal_uInt16
>(m_aValue
.m_uInt32
);
1470 case DataType::BIGINT
:
1472 nRet
= static_cast<sal_uInt16
>(m_aValue
.m_nInt64
);
1474 nRet
= static_cast<sal_uInt16
>(m_aValue
.m_uInt64
);
1478 Any aValue
= makeAny();
1488 sal_Int32
ORowSetValue::getInt32() const
1493 switch(getTypeKind())
1495 case DataType::CHAR
:
1496 case DataType::VARCHAR
:
1497 case DataType::DECIMAL
:
1498 case DataType::NUMERIC
:
1499 case DataType::LONGVARCHAR
:
1500 nRet
= OUString(m_aValue
.m_pString
).toInt32();
1502 case DataType::FLOAT
:
1503 nRet
= sal_Int32(m_aValue
.m_nFloat
);
1505 case DataType::DOUBLE
:
1506 case DataType::REAL
:
1507 nRet
= sal_Int32(m_aValue
.m_nDouble
);
1509 case DataType::DATE
:
1510 nRet
= dbtools::DBTypeConversion::toDays(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1512 case DataType::TIME
:
1513 case DataType::TIMESTAMP
:
1514 case DataType::BINARY
:
1515 case DataType::VARBINARY
:
1516 case DataType::LONGVARBINARY
:
1517 case DataType::BLOB
:
1518 case DataType::CLOB
:
1519 OSL_FAIL("getInt32() for this type is not allowed!");
1522 case DataType::BOOLEAN
:
1523 nRet
= sal_Int32(m_aValue
.m_bBool
);
1525 case DataType::TINYINT
:
1527 nRet
= m_aValue
.m_nInt8
;
1529 nRet
= m_aValue
.m_uInt8
;
1531 case DataType::SMALLINT
:
1533 nRet
= m_aValue
.m_nInt16
;
1535 nRet
= m_aValue
.m_uInt16
;
1537 case DataType::INTEGER
:
1539 nRet
= m_aValue
.m_nInt32
;
1541 nRet
= static_cast<sal_Int32
>(m_aValue
.m_uInt32
);
1543 case DataType::BIGINT
:
1545 nRet
= static_cast<sal_Int32
>(m_aValue
.m_nInt64
);
1547 nRet
= static_cast<sal_Int32
>(m_aValue
.m_uInt64
);
1551 Any aValue
= makeAny();
1561 sal_uInt32
ORowSetValue::getUInt32() const
1563 sal_uInt32 nRet
= 0;
1566 switch(getTypeKind())
1568 case DataType::CHAR
:
1569 case DataType::VARCHAR
:
1570 case DataType::DECIMAL
:
1571 case DataType::NUMERIC
:
1572 case DataType::LONGVARCHAR
:
1573 nRet
= OUString(m_aValue
.m_pString
).toUInt32();
1575 case DataType::FLOAT
:
1576 nRet
= sal_uInt32(m_aValue
.m_nFloat
);
1578 case DataType::DOUBLE
:
1579 case DataType::REAL
:
1580 nRet
= sal_uInt32(m_aValue
.m_nDouble
);
1582 case DataType::DATE
:
1583 nRet
= dbtools::DBTypeConversion::toDays(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1585 case DataType::TIME
:
1586 case DataType::TIMESTAMP
:
1587 case DataType::BINARY
:
1588 case DataType::VARBINARY
:
1589 case DataType::LONGVARBINARY
:
1590 case DataType::BLOB
:
1591 case DataType::CLOB
:
1592 OSL_FAIL("getuInt32() for this type is not allowed!");
1595 case DataType::BOOLEAN
:
1596 nRet
= sal_uInt32(m_aValue
.m_bBool
);
1598 case DataType::TINYINT
:
1600 nRet
= m_aValue
.m_nInt8
;
1602 nRet
= m_aValue
.m_uInt8
;
1604 case DataType::SMALLINT
:
1606 nRet
= m_aValue
.m_nInt16
;
1608 nRet
= m_aValue
.m_uInt16
;
1610 case DataType::INTEGER
:
1612 nRet
= m_aValue
.m_nInt32
;
1614 nRet
= m_aValue
.m_uInt32
;
1616 case DataType::BIGINT
:
1618 nRet
= static_cast<sal_uInt32
>(m_aValue
.m_nInt64
);
1620 nRet
= static_cast<sal_uInt32
>(m_aValue
.m_uInt64
);
1624 Any aValue
= makeAny();
1634 sal_Int64
ORowSetValue::getLong() const
1639 switch(getTypeKind())
1641 case DataType::CHAR
:
1642 case DataType::VARCHAR
:
1643 case DataType::DECIMAL
:
1644 case DataType::NUMERIC
:
1645 case DataType::LONGVARCHAR
:
1646 nRet
= OUString(m_aValue
.m_pString
).toInt64();
1648 case DataType::FLOAT
:
1649 nRet
= sal_Int64(m_aValue
.m_nFloat
);
1651 case DataType::DOUBLE
:
1652 case DataType::REAL
:
1653 nRet
= sal_Int64(m_aValue
.m_nDouble
);
1655 case DataType::DATE
:
1656 nRet
= dbtools::DBTypeConversion::toDays(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1658 case DataType::TIME
:
1659 case DataType::TIMESTAMP
:
1660 case DataType::BINARY
:
1661 case DataType::VARBINARY
:
1662 case DataType::LONGVARBINARY
:
1663 case DataType::BLOB
:
1664 case DataType::CLOB
:
1665 OSL_FAIL("getLong() for this type is not allowed!");
1668 case DataType::BOOLEAN
:
1669 nRet
= sal_Int64(m_aValue
.m_bBool
);
1671 case DataType::TINYINT
:
1673 nRet
= m_aValue
.m_nInt8
;
1675 nRet
= m_aValue
.m_uInt8
;
1677 case DataType::SMALLINT
:
1679 nRet
= m_aValue
.m_nInt16
;
1681 nRet
= m_aValue
.m_uInt16
;
1683 case DataType::INTEGER
:
1685 nRet
= m_aValue
.m_nInt32
;
1687 nRet
= m_aValue
.m_uInt32
;
1689 case DataType::BIGINT
:
1691 nRet
= m_aValue
.m_nInt64
;
1693 nRet
= static_cast<sal_Int64
>(m_aValue
.m_uInt64
);
1697 Any aValue
= makeAny();
1707 sal_uInt64
ORowSetValue::getULong() const
1709 sal_uInt64 nRet
= 0;
1712 switch(getTypeKind())
1714 case DataType::CHAR
:
1715 case DataType::VARCHAR
:
1716 case DataType::DECIMAL
:
1717 case DataType::NUMERIC
:
1718 case DataType::LONGVARCHAR
:
1719 nRet
= static_cast<sal_uInt64
>(OUString(m_aValue
.m_pString
).toUInt64());
1721 case DataType::FLOAT
:
1722 nRet
= sal_uInt64(m_aValue
.m_nFloat
);
1724 case DataType::DOUBLE
:
1725 case DataType::REAL
:
1726 nRet
= sal_uInt64(m_aValue
.m_nDouble
);
1728 case DataType::DATE
:
1729 nRet
= dbtools::DBTypeConversion::toDays(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1731 case DataType::TIME
:
1732 case DataType::TIMESTAMP
:
1733 case DataType::BINARY
:
1734 case DataType::VARBINARY
:
1735 case DataType::LONGVARBINARY
:
1736 case DataType::BLOB
:
1737 case DataType::CLOB
:
1738 OSL_FAIL("getULong() for this type is not allowed!");
1741 case DataType::BOOLEAN
:
1742 nRet
= sal_uInt64(m_aValue
.m_bBool
);
1744 case DataType::TINYINT
:
1746 nRet
= m_aValue
.m_nInt8
;
1748 nRet
= m_aValue
.m_uInt8
;
1750 case DataType::SMALLINT
:
1752 nRet
= m_aValue
.m_nInt16
;
1754 nRet
= m_aValue
.m_uInt16
;
1756 case DataType::INTEGER
:
1758 nRet
= m_aValue
.m_nInt32
;
1760 nRet
= m_aValue
.m_uInt32
;
1762 case DataType::BIGINT
:
1764 nRet
= m_aValue
.m_nInt64
;
1766 nRet
= m_aValue
.m_uInt64
;
1770 Any aValue
= makeAny();
1780 float ORowSetValue::getFloat() const
1785 switch(getTypeKind())
1787 case DataType::CHAR
:
1788 case DataType::VARCHAR
:
1789 case DataType::DECIMAL
:
1790 case DataType::NUMERIC
:
1791 case DataType::LONGVARCHAR
:
1792 nRet
= OUString(m_aValue
.m_pString
).toFloat();
1794 case DataType::FLOAT
:
1795 nRet
= m_aValue
.m_nFloat
;
1797 case DataType::DOUBLE
:
1798 case DataType::REAL
:
1799 nRet
= (float)m_aValue
.m_nDouble
;
1801 case DataType::DATE
:
1802 nRet
= (float)dbtools::DBTypeConversion::toDouble(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1804 case DataType::TIME
:
1805 nRet
= (float)dbtools::DBTypeConversion::toDouble(*static_cast<css::util::Time
*>(m_aValue
.m_pValue
));
1807 case DataType::TIMESTAMP
:
1808 nRet
= (float)dbtools::DBTypeConversion::toDouble(*static_cast<css::util::DateTime
*>(m_aValue
.m_pValue
));
1810 case DataType::BINARY
:
1811 case DataType::VARBINARY
:
1812 case DataType::LONGVARBINARY
:
1813 case DataType::BLOB
:
1814 case DataType::CLOB
:
1815 OSL_FAIL("getDouble() for this type is not allowed!");
1818 case DataType::BOOLEAN
:
1819 nRet
= float(m_aValue
.m_bBool
);
1821 case DataType::TINYINT
:
1823 nRet
= m_aValue
.m_nInt8
;
1825 nRet
= m_aValue
.m_uInt8
;
1827 case DataType::SMALLINT
:
1829 nRet
= m_aValue
.m_nInt16
;
1831 nRet
= (float)m_aValue
.m_uInt16
;
1833 case DataType::INTEGER
:
1835 nRet
= (float)m_aValue
.m_nInt32
;
1837 nRet
= (float)m_aValue
.m_uInt32
;
1839 case DataType::BIGINT
:
1841 nRet
= (float)m_aValue
.m_nInt64
;
1843 nRet
= (float)m_aValue
.m_uInt64
;
1847 Any aValue
= makeAny();
1856 double ORowSetValue::getDouble() const
1861 switch(getTypeKind())
1863 case DataType::CHAR
:
1864 case DataType::VARCHAR
:
1865 case DataType::DECIMAL
:
1866 case DataType::NUMERIC
:
1867 case DataType::LONGVARCHAR
:
1868 nRet
= OUString(m_aValue
.m_pString
).toDouble();
1870 case DataType::FLOAT
:
1871 nRet
= m_aValue
.m_nFloat
;
1873 case DataType::DOUBLE
:
1874 case DataType::REAL
:
1875 nRet
= m_aValue
.m_nDouble
;
1877 case DataType::DATE
:
1878 nRet
= dbtools::DBTypeConversion::toDouble(*static_cast<css::util::Date
*>(m_aValue
.m_pValue
));
1880 case DataType::TIME
:
1881 nRet
= dbtools::DBTypeConversion::toDouble(*static_cast<css::util::Time
*>(m_aValue
.m_pValue
));
1883 case DataType::TIMESTAMP
:
1884 nRet
= dbtools::DBTypeConversion::toDouble(*static_cast<css::util::DateTime
*>(m_aValue
.m_pValue
));
1886 case DataType::BINARY
:
1887 case DataType::VARBINARY
:
1888 case DataType::LONGVARBINARY
:
1889 case DataType::BLOB
:
1890 case DataType::CLOB
:
1891 OSL_FAIL("getDouble() for this type is not allowed!");
1894 case DataType::BOOLEAN
:
1895 nRet
= double(m_aValue
.m_bBool
);
1897 case DataType::TINYINT
:
1899 nRet
= m_aValue
.m_nInt8
;
1901 nRet
= m_aValue
.m_uInt8
;
1903 case DataType::SMALLINT
:
1905 nRet
= m_aValue
.m_nInt16
;
1907 nRet
= m_aValue
.m_uInt16
;
1909 case DataType::INTEGER
:
1911 nRet
= m_aValue
.m_nInt32
;
1913 nRet
= m_aValue
.m_uInt32
;
1915 case DataType::BIGINT
:
1917 nRet
= m_aValue
.m_nInt64
;
1919 nRet
= m_aValue
.m_uInt64
;
1923 Any aValue
= makeAny();
1932 Sequence
<sal_Int8
> ORowSetValue::getSequence() const
1934 Sequence
<sal_Int8
> aSeq
;
1939 case DataType::OBJECT
:
1940 case DataType::CLOB
:
1941 case DataType::BLOB
:
1943 Reference
<XInputStream
> xStream
;
1944 const Any aValue
= makeAny();
1945 if(aValue
.hasValue())
1947 Reference
<XBlob
> xBlob(aValue
,UNO_QUERY
);
1949 xStream
= xBlob
->getBinaryStream();
1952 Reference
<XClob
> xClob(aValue
,UNO_QUERY
);
1954 xStream
= xClob
->getCharacterStream();
1958 const sal_uInt32 nBytesToRead
= 65535;
1963 ::com::sun::star::uno::Sequence
< sal_Int8
> aReadSeq
;
1965 nRead
= xStream
->readSomeBytes( aReadSeq
, nBytesToRead
);
1969 const sal_uInt32 nOldLength
= aSeq
.getLength();
1970 aSeq
.realloc( nOldLength
+ nRead
);
1971 memcpy( aSeq
.getArray() + nOldLength
, aReadSeq
.getConstArray(), aReadSeq
.getLength() );
1974 while( nBytesToRead
== nRead
);
1975 xStream
->closeInput();
1980 case DataType::VARCHAR
:
1981 case DataType::LONGVARCHAR
:
1983 OUString
sVal(m_aValue
.m_pString
);
1984 aSeq
= Sequence
<sal_Int8
>(reinterpret_cast<const sal_Int8
*>(sVal
.getStr()),sizeof(sal_Unicode
)*sVal
.getLength());
1987 case DataType::BINARY
:
1988 case DataType::VARBINARY
:
1989 case DataType::LONGVARBINARY
:
1990 aSeq
= *static_cast< Sequence
<sal_Int8
>*>(m_aValue
.m_pValue
);
1994 Any aValue
= makeAny();
2004 ::com::sun::star::util::Date
ORowSetValue::getDate() const
2006 ::com::sun::star::util::Date aValue
;
2011 case DataType::CHAR
:
2012 case DataType::VARCHAR
:
2013 case DataType::LONGVARCHAR
:
2014 aValue
= DBTypeConversion::toDate(getString());
2016 case DataType::DECIMAL
:
2017 case DataType::NUMERIC
:
2018 case DataType::FLOAT
:
2019 case DataType::DOUBLE
:
2020 case DataType::REAL
:
2021 aValue
= DBTypeConversion::toDate((double)*this);
2024 case DataType::DATE
:
2025 aValue
= *static_cast< ::com::sun::star::util::Date
*>(m_aValue
.m_pValue
);
2027 case DataType::TIMESTAMP
:
2029 ::com::sun::star::util::DateTime
* pDateTime
= static_cast< ::com::sun::star::util::DateTime
*>(m_aValue
.m_pValue
);
2030 aValue
.Day
= pDateTime
->Day
;
2031 aValue
.Month
= pDateTime
->Month
;
2032 aValue
.Year
= pDateTime
->Year
;
2036 case DataType::BOOLEAN
:
2037 case DataType::TINYINT
:
2038 case DataType::SMALLINT
:
2039 case DataType::INTEGER
:
2040 case DataType::BIGINT
:
2041 aValue
= DBTypeConversion::toDate( double( sal_Int64( *this ) ) );
2044 case DataType::BLOB
:
2045 case DataType::CLOB
:
2046 case DataType::OBJECT
:
2048 OSL_ENSURE( false, "ORowSetValue::getDate: cannot retrieve the data!" );
2051 case DataType::BINARY
:
2052 case DataType::VARBINARY
:
2053 case DataType::LONGVARBINARY
:
2054 case DataType::TIME
:
2055 aValue
= DBTypeConversion::toDate( (double)0 );
2062 ::com::sun::star::util::Time
ORowSetValue::getTime() const
2064 ::com::sun::star::util::Time aValue
;
2069 case DataType::CHAR
:
2070 case DataType::VARCHAR
:
2071 case DataType::LONGVARCHAR
:
2072 aValue
= DBTypeConversion::toTime(getString());
2074 case DataType::DECIMAL
:
2075 case DataType::NUMERIC
:
2076 aValue
= DBTypeConversion::toTime((double)*this);
2078 case DataType::FLOAT
:
2079 case DataType::DOUBLE
:
2080 case DataType::REAL
:
2081 aValue
= DBTypeConversion::toTime((double)*this);
2083 case DataType::TIMESTAMP
:
2085 ::com::sun::star::util::DateTime
* pDateTime
= static_cast< ::com::sun::star::util::DateTime
*>(m_aValue
.m_pValue
);
2086 aValue
.NanoSeconds
= pDateTime
->NanoSeconds
;
2087 aValue
.Seconds
= pDateTime
->Seconds
;
2088 aValue
.Minutes
= pDateTime
->Minutes
;
2089 aValue
.Hours
= pDateTime
->Hours
;
2092 case DataType::TIME
:
2093 aValue
= *static_cast< ::com::sun::star::util::Time
*>(m_aValue
.m_pValue
);
2097 Any aAnyValue
= makeAny();
2098 aAnyValue
>>= aValue
;
2106 ::com::sun::star::util::DateTime
ORowSetValue::getDateTime() const
2108 ::com::sun::star::util::DateTime aValue
;
2113 case DataType::CHAR
:
2114 case DataType::VARCHAR
:
2115 case DataType::LONGVARCHAR
:
2116 aValue
= DBTypeConversion::toDateTime(getString());
2118 case DataType::DECIMAL
:
2119 case DataType::NUMERIC
:
2120 aValue
= DBTypeConversion::toDateTime((double)*this);
2122 case DataType::FLOAT
:
2123 case DataType::DOUBLE
:
2124 case DataType::REAL
:
2125 aValue
= DBTypeConversion::toDateTime((double)*this);
2127 case DataType::DATE
:
2129 ::com::sun::star::util::Date
* pDate
= static_cast< ::com::sun::star::util::Date
*>(m_aValue
.m_pValue
);
2130 aValue
.Day
= pDate
->Day
;
2131 aValue
.Month
= pDate
->Month
;
2132 aValue
.Year
= pDate
->Year
;
2135 case DataType::TIME
:
2137 ::com::sun::star::util::Time
* pTime
= static_cast< ::com::sun::star::util::Time
*>(m_aValue
.m_pValue
);
2138 aValue
.NanoSeconds
= pTime
->NanoSeconds
;
2139 aValue
.Seconds
= pTime
->Seconds
;
2140 aValue
.Minutes
= pTime
->Minutes
;
2141 aValue
.Hours
= pTime
->Hours
;
2144 case DataType::TIMESTAMP
:
2145 aValue
= *static_cast< ::com::sun::star::util::DateTime
*>(m_aValue
.m_pValue
);
2149 Any aAnyValue
= makeAny();
2150 aAnyValue
>>= aValue
;
2158 void ORowSetValue::setSigned(bool _bMod
)
2160 if ( m_bSigned
!= _bMod
)
2165 sal_Int32 nType
= m_eTypeKind
;
2168 case DataType::TINYINT
:
2170 (*this) = getInt8();
2173 m_bSigned
= !m_bSigned
;
2174 (*this) = getInt16();
2175 m_bSigned
= !m_bSigned
;
2178 case DataType::SMALLINT
:
2180 (*this) = getInt16();
2183 m_bSigned
= !m_bSigned
;
2184 (*this) = getInt32();
2185 m_bSigned
= !m_bSigned
;
2188 case DataType::INTEGER
:
2190 (*this) = getInt32();
2193 m_bSigned
= !m_bSigned
;
2194 (*this) = getLong();
2195 m_bSigned
= !m_bSigned
;
2198 case DataType::BIGINT
:
2200 m_aValue
.m_nInt64
= static_cast<sal_Int64
>(m_aValue
.m_uInt64
);
2202 m_aValue
.m_uInt64
= static_cast<sal_uInt64
>(m_aValue
.m_nInt64
);
2205 m_eTypeKind
= nType
;
2213 class SAL_NO_VTABLE IValueSource
2216 virtual OUString
getString() const = 0;
2217 virtual bool getBoolean() const = 0;
2218 virtual sal_Int8
getByte() const = 0;
2219 virtual sal_Int16
getShort() const = 0;
2220 virtual sal_Int32
getInt() const = 0;
2221 virtual sal_Int64
getLong() const = 0;
2222 virtual float getFloat() const = 0;
2223 virtual double getDouble() const = 0;
2224 virtual Date
getDate() const = 0;
2225 virtual css::util::Time
getTime() const = 0;
2226 virtual DateTime
getTimestamp() const = 0;
2227 virtual Sequence
< sal_Int8
> getBytes() const = 0;
2228 virtual Reference
< XBlob
> getBlob() const = 0;
2229 virtual Reference
< XClob
> getClob() const = 0;
2230 virtual Any
getObject() const = 0;
2231 virtual bool wasNull() const = 0;
2233 virtual ~IValueSource() { }
2236 class RowValue
: public IValueSource
2239 RowValue( const Reference
< XRow
>& _xRow
, const sal_Int32 _nPos
)
2246 virtual OUString
getString() const SAL_OVERRIDE
{ return m_xRow
->getString( m_nPos
); };
2247 virtual bool getBoolean() const SAL_OVERRIDE
{ return m_xRow
->getBoolean( m_nPos
); };
2248 virtual sal_Int8
getByte() const SAL_OVERRIDE
{ return m_xRow
->getByte( m_nPos
); };
2249 virtual sal_Int16
getShort() const SAL_OVERRIDE
{ return m_xRow
->getShort( m_nPos
); }
2250 virtual sal_Int32
getInt() const SAL_OVERRIDE
{ return m_xRow
->getInt( m_nPos
); }
2251 virtual sal_Int64
getLong() const SAL_OVERRIDE
{ return m_xRow
->getLong( m_nPos
); }
2252 virtual float getFloat() const SAL_OVERRIDE
{ return m_xRow
->getFloat( m_nPos
); };
2253 virtual double getDouble() const SAL_OVERRIDE
{ return m_xRow
->getDouble( m_nPos
); };
2254 virtual Date
getDate() const SAL_OVERRIDE
{ return m_xRow
->getDate( m_nPos
); };
2255 virtual css::util::Time
getTime() const SAL_OVERRIDE
{ return m_xRow
->getTime( m_nPos
); };
2256 virtual DateTime
getTimestamp() const SAL_OVERRIDE
{ return m_xRow
->getTimestamp( m_nPos
); };
2257 virtual Sequence
< sal_Int8
> getBytes() const SAL_OVERRIDE
{ return m_xRow
->getBytes( m_nPos
); };
2258 virtual Reference
< XBlob
> getBlob() const SAL_OVERRIDE
{ return m_xRow
->getBlob( m_nPos
); };
2259 virtual Reference
< XClob
> getClob() const SAL_OVERRIDE
{ return m_xRow
->getClob( m_nPos
); };
2260 virtual Any
getObject() const SAL_OVERRIDE
{ return m_xRow
->getObject( m_nPos
,NULL
); };
2261 virtual bool wasNull() const SAL_OVERRIDE
{ return m_xRow
->wasNull( ); };
2264 const Reference
< XRow
> m_xRow
;
2265 const sal_Int32 m_nPos
;
2268 class ColumnValue
: public IValueSource
2271 ColumnValue( const Reference
< XColumn
>& _rxColumn
)
2272 :m_xColumn( _rxColumn
)
2277 virtual OUString
getString() const SAL_OVERRIDE
{ return m_xColumn
->getString(); };
2278 virtual bool getBoolean() const SAL_OVERRIDE
{ return m_xColumn
->getBoolean(); };
2279 virtual sal_Int8
getByte() const SAL_OVERRIDE
{ return m_xColumn
->getByte(); };
2280 virtual sal_Int16
getShort() const SAL_OVERRIDE
{ return m_xColumn
->getShort(); }
2281 virtual sal_Int32
getInt() const SAL_OVERRIDE
{ return m_xColumn
->getInt(); }
2282 virtual sal_Int64
getLong() const SAL_OVERRIDE
{ return m_xColumn
->getLong(); }
2283 virtual float getFloat() const SAL_OVERRIDE
{ return m_xColumn
->getFloat(); };
2284 virtual double getDouble() const SAL_OVERRIDE
{ return m_xColumn
->getDouble(); };
2285 virtual Date
getDate() const SAL_OVERRIDE
{ return m_xColumn
->getDate(); };
2286 virtual css::util::Time
getTime() const SAL_OVERRIDE
{ return m_xColumn
->getTime(); };
2287 virtual DateTime
getTimestamp() const SAL_OVERRIDE
{ return m_xColumn
->getTimestamp(); };
2288 virtual Sequence
< sal_Int8
> getBytes() const SAL_OVERRIDE
{ return m_xColumn
->getBytes(); };
2289 virtual Reference
< XBlob
> getBlob() const SAL_OVERRIDE
{ return m_xColumn
->getBlob(); };
2290 virtual Reference
< XClob
> getClob() const SAL_OVERRIDE
{ return m_xColumn
->getClob(); };
2291 virtual Any
getObject() const SAL_OVERRIDE
{ return m_xColumn
->getObject( NULL
); };
2292 virtual bool wasNull() const SAL_OVERRIDE
{ return m_xColumn
->wasNull( ); };
2295 const Reference
< XColumn
> m_xColumn
;
2300 void ORowSetValue::fill( const sal_Int32 _nType
, const Reference
< XColumn
>& _rxColumn
)
2302 detail::ColumnValue
aColumnValue( _rxColumn
);
2303 impl_fill( _nType
, true, aColumnValue
);
2307 void ORowSetValue::fill( sal_Int32 _nPos
, sal_Int32 _nType
, bool _bNullable
, const Reference
< XRow
>& _xRow
)
2309 detail::RowValue
aRowValue( _xRow
, _nPos
);
2310 impl_fill( _nType
, _bNullable
, aRowValue
);
2314 void ORowSetValue::fill(sal_Int32 _nPos
,
2316 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRow
>& _xRow
)
2318 fill(_nPos
,_nType
,true,_xRow
);
2322 void ORowSetValue::impl_fill( const sal_Int32 _nType
, bool _bNullable
, const detail::IValueSource
& _rValueSource
)
2324 bool bReadData
= true;
2327 case DataType::CHAR
:
2328 case DataType::VARCHAR
:
2329 case DataType::DECIMAL
:
2330 case DataType::NUMERIC
:
2331 case DataType::LONGVARCHAR
:
2332 (*this) = _rValueSource
.getString();
2334 case DataType::BIGINT
:
2336 (*this) = _rValueSource
.getLong();
2338 // TODO: this is rather horrible performance-wise
2339 // but fixing it needs extending the ::com::sun::star::sdbc::XRow API
2340 // to have a getULong(), and needs updating all drivers :-|
2341 // When doing that, add getUByte, getUShort, getUInt for symmetry/completeness
2342 (*this) = _rValueSource
.getString().toUInt64();
2344 case DataType::FLOAT
:
2345 (*this) = _rValueSource
.getFloat();
2347 case DataType::DOUBLE
:
2348 case DataType::REAL
:
2349 (*this) = _rValueSource
.getDouble();
2351 case DataType::DATE
:
2352 (*this) = _rValueSource
.getDate();
2354 case DataType::TIME
:
2355 (*this) = _rValueSource
.getTime();
2357 case DataType::TIMESTAMP
:
2358 (*this) = _rValueSource
.getTimestamp();
2360 case DataType::BINARY
:
2361 case DataType::VARBINARY
:
2362 case DataType::LONGVARBINARY
:
2363 (*this) = _rValueSource
.getBytes();
2366 case DataType::BOOLEAN
:
2367 (*this) = _rValueSource
.getBoolean();
2369 case DataType::TINYINT
:
2371 (*this) = _rValueSource
.getByte();
2373 (*this) = _rValueSource
.getShort();
2375 case DataType::SMALLINT
:
2377 (*this) = _rValueSource
.getShort();
2379 (*this) = _rValueSource
.getInt();
2381 case DataType::INTEGER
:
2383 (*this) = _rValueSource
.getInt();
2385 (*this) = _rValueSource
.getLong();
2387 case DataType::CLOB
:
2388 (*this) = ::com::sun::star::uno::makeAny(_rValueSource
.getClob());
2389 setTypeKind(DataType::CLOB
);
2391 case DataType::BLOB
:
2392 (*this) = ::com::sun::star::uno::makeAny(_rValueSource
.getBlob());
2393 setTypeKind(DataType::BLOB
);
2395 case DataType::OTHER
:
2396 (*this) = _rValueSource
.getObject();
2397 setTypeKind(DataType::OTHER
);
2400 SAL_WARN( "connectivity.commontools", "ORowSetValue::fill: unsupported type!" );
2401 (*this) = _rValueSource
.getObject();
2404 if ( bReadData
&& _bNullable
&& _rValueSource
.wasNull() )
2406 setTypeKind(_nType
);
2409 void ORowSetValue::fill(const Any
& _rValue
)
2411 switch (_rValue
.getValueType().getTypeClass())
2413 case TypeClass_VOID
:
2415 case TypeClass_BOOLEAN
:
2417 bool bValue( false );
2422 case TypeClass_CHAR
:
2424 sal_Unicode
aDummy(0);
2426 (*this) = OUString(aDummy
);
2429 case TypeClass_STRING
:
2436 case TypeClass_FLOAT
:
2443 case TypeClass_DOUBLE
:
2450 case TypeClass_BYTE
:
2457 case TypeClass_SHORT
:
2459 sal_Int16
aDummy(0);
2464 case TypeClass_UNSIGNED_SHORT
:
2466 sal_uInt16
nValue(0);
2471 case TypeClass_LONG
:
2473 sal_Int32
aDummy(0);
2478 case TypeClass_UNSIGNED_LONG
:
2480 sal_uInt32
nValue(0);
2482 (*this) = static_cast<sal_Int64
>(nValue
);
2486 case TypeClass_HYPER
:
2488 sal_Int64
nValue(0);
2493 case TypeClass_UNSIGNED_HYPER
:
2495 sal_uInt64
nValue(0);
2501 case TypeClass_ENUM
:
2503 sal_Int32
enumValue( 0 );
2504 ::cppu::enum2int( enumValue
, _rValue
);
2505 (*this) = enumValue
;
2509 case TypeClass_SEQUENCE
:
2511 Sequence
<sal_Int8
> aDummy
;
2512 if ( _rValue
>>= aDummy
)
2515 SAL_WARN( "connectivity.commontools", "ORowSetValue::fill: unsupported sequence type!" );
2519 case TypeClass_STRUCT
:
2521 ::com::sun::star::util::Date aDate
;
2522 ::com::sun::star::util::Time aTime
;
2523 ::com::sun::star::util::DateTime aDateTime
;
2524 if ( _rValue
>>= aDate
)
2528 else if ( _rValue
>>= aTime
)
2532 else if ( _rValue
>>= aDateTime
)
2534 (*this) = aDateTime
;
2537 SAL_WARN( "connectivity.commontools", "ORowSetValue::fill: unsupported structure!" );
2541 case TypeClass_INTERFACE
:
2543 Reference
< XClob
> xClob
;
2544 if ( _rValue
>>= xClob
)
2547 setTypeKind(DataType::CLOB
);
2551 Reference
< XBlob
> xBlob
;
2552 if ( _rValue
>>= xBlob
)
2555 setTypeKind(DataType::BLOB
);
2566 SAL_WARN( "connectivity.commontools","Unknown type");
2571 } // namespace connectivity
2573 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */