Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / misc / UpdateHelperImpl.hxx
blobd41aec19e2845fe1d3d5144d11294157607080b4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
22 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
23 #include <com/sun/star/sdbc/XRowUpdate.hpp>
24 #include <com/sun/star/sdbc/XParameters.hpp>
25 #include <com/sun/star/sdbc/XPreparedStatement.hpp>
26 #include <com/sun/star/sdbc/XRowSet.hpp>
27 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
28 #include "IUpdateHelper.hxx"
30 namespace dbaui
32 class OParameterUpdateHelper : public IUpdateHelper
34 css::uno::Reference< css::sdbc::XPreparedStatement > m_xPrepared;
35 css::uno::Reference< css::sdbc::XParameters > m_xParameters;
37 public:
38 explicit OParameterUpdateHelper(const css::uno::Reference< css::sdbc::XPreparedStatement >& _xPrepared)
39 :m_xPrepared(_xPrepared)
40 ,m_xParameters(_xPrepared,css::uno::UNO_QUERY)
43 virtual ~OParameterUpdateHelper() {}
44 virtual void updateString(sal_Int32 _nPos, const OUString& _sValue) override
46 m_xParameters->setString(_nPos, _sValue);
48 virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) override
50 m_xParameters->setDouble(_nPos, _nValue);
52 virtual void updateDate(sal_Int32 _nPos,const css::util::Date& _nValue) override
54 m_xParameters->setDate(_nPos, _nValue);
56 virtual void updateTime(sal_Int32 _nPos,const css::util::Time& _nValue) override
58 m_xParameters->setTime(_nPos, _nValue);
60 virtual void updateTimestamp(sal_Int32 _nPos,const css::util::DateTime& _nValue) override
62 m_xParameters->setTimestamp(_nPos, _nValue);
64 virtual void updateInt(sal_Int32 _nPos, sal_Int32 _nValue) override
66 m_xParameters->setInt(_nPos, _nValue);
68 virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) override
70 m_xParameters->setNull(_nPos,sqlType);
72 virtual void moveToInsertRow() override
75 virtual void insertRow() override
77 m_xPrepared->executeUpdate();
82 #endif // INCLUDED_DBACCESS_SOURCE_UI_MISC_UPDATEHELPERIMPL_HXX
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */