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 : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
21 :
22 : #include <rtl/ref.hxx>
23 : #include <connectivity/CommonTools.hxx>
24 : #include "connectivity/FValue.hxx"
25 : #include <comphelper/types.hxx>
26 : #include <salhelper/simplereferenceobject.hxx>
27 :
28 : namespace dbaccess
29 : {
30 : typedef connectivity::ORowVector< connectivity::ORowSetValue > ORowSetValueVector;
31 : typedef ::rtl::Reference< ORowSetValueVector > ORowSetRow;
32 : typedef ::std::vector< ORowSetRow > ORowSetMatrix;
33 :
34 96 : class ORowSetOldRowHelper : public salhelper::SimpleReferenceObject
35 : {
36 : ORowSetRow m_aRow;
37 :
38 : ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH);
39 : ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh);
40 : public:
41 : ORowSetOldRowHelper(){}
42 48 : ORowSetOldRowHelper(const ORowSetRow& _rRow)
43 48 : : m_aRow(_rRow)
44 48 : {}
45 :
46 528 : inline ORowSetRow getRow() const { return m_aRow; }
47 106 : inline void clearRow() { m_aRow = NULL; }
48 266 : inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; }
49 : };
50 :
51 : typedef ::rtl::Reference< ORowSetOldRowHelper > TORowSetOldRowHelperRef;
52 :
53 : class ORowSetValueCompare
54 : {
55 : const ::com::sun::star::uno::Any& m_rAny;
56 : public:
57 : ORowSetValueCompare(const ::com::sun::star::uno::Any& _rAny) : m_rAny(_rAny){}
58 :
59 : bool operator ()(const ORowSetRow& _rRH)
60 : {
61 : switch((_rRH->get())[0].getTypeKind())
62 : {
63 : case ::com::sun::star::sdbc::DataType::TINYINT:
64 : case ::com::sun::star::sdbc::DataType::SMALLINT:
65 : case ::com::sun::star::sdbc::DataType::INTEGER:
66 : return comphelper::getINT32(m_rAny) == (sal_Int32)(_rRH->get())[0];
67 : default:
68 : {
69 : ::com::sun::star::uno::Sequence<sal_Int8> aSeq;
70 : m_rAny >>= aSeq;
71 : return aSeq == (_rRH->get())[0];
72 : }
73 : }
74 : }
75 : };
76 : }
77 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|