Update ooo320-m1
[ooovba.git] / dbaccess / source / core / api / RowSetRow.hxx
blob180fad4b732ee9b192f812761201f08bc4e340b6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: RowSetRow.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBACCESS_CORE_API_ROWSETROW_HXX
31 #define DBACCESS_CORE_API_ROWSETROW_HXX
33 #ifndef _VOS_REF_HXX_
34 #include <vos/ref.hxx>
35 #endif
36 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
37 #include <connectivity/CommonTools.hxx>
38 #endif
39 #ifndef _CONNECTIVITY_FILE_VALUE_HXX_
40 #include "connectivity/FValue.hxx"
41 #endif
42 #ifndef _COMPHELPER_TYPES_HXX_
43 #include <comphelper/types.hxx>
44 #endif
46 namespace dbaccess
48 typedef connectivity::ORowVector< connectivity::ORowSetValue > ORowSetValueVector;
49 typedef ::vos::ORef< ORowSetValueVector > ORowSetRow;
50 typedef ::std::vector< ORowSetRow > ORowSetMatrix;
52 class ORowSetOldRowHelper
54 oslInterlockedCount m_refCount;
55 ORowSetRow m_aRow;
57 ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH);
58 ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh);
59 public:
60 ORowSetOldRowHelper() : m_refCount(0){}
61 ORowSetOldRowHelper(const ORowSetRow& _rRow)
62 : m_refCount(0)
63 , m_aRow(_rRow)
65 // ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh)
66 // : m_refCount(0)
67 // , m_aRow(_rRh.m_aRow)
68 // {}
70 void acquire()
72 osl_incrementInterlockedCount( &m_refCount );
74 void release()
76 if (! osl_decrementInterlockedCount( &m_refCount ))
77 delete this;
79 inline ORowSetRow getRow() const { return m_aRow; }
80 inline void clearRow() { m_aRow = NULL; }
81 inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; }
84 typedef ::vos::ORef< ORowSetOldRowHelper > TORowSetOldRowHelperRef;
86 class ORowSetValueCompare
88 const ::com::sun::star::uno::Any& m_rAny;
89 public:
90 ORowSetValueCompare(const ::com::sun::star::uno::Any& _rAny) : m_rAny(_rAny){}
92 sal_Bool operator ()(const ORowSetRow& _rRH)
94 switch((_rRH->get())[0].getTypeKind())
96 case ::com::sun::star::sdbc::DataType::TINYINT:
97 case ::com::sun::star::sdbc::DataType::SMALLINT:
98 case ::com::sun::star::sdbc::DataType::INTEGER:
99 return comphelper::getINT32(m_rAny) == (sal_Int32)(_rRH->get())[0];
100 default:
102 ::com::sun::star::uno::Sequence<sal_Int8> aSeq;
103 m_rAny >>= aSeq;
104 return aSeq == (_rRH->get())[0];
110 #endif // DBACCESS_CORE_API_ROWSETROW_HXX