LibreOffice Module dbaccess (master) 1
UpdateHelperImpl.hxx
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#pragma once
20
21#include <com/sun/star/sdbc/XParameters.hpp>
22#include <com/sun/star/sdbc/XPreparedStatement.hpp>
23#include <IUpdateHelper.hxx>
24
25namespace dbaui
26{
28 {
29 css::uno::Reference< css::sdbc::XPreparedStatement > m_xPrepared;
30 css::uno::Reference< css::sdbc::XParameters > m_xParameters;
31
32 public:
33 explicit OParameterUpdateHelper(const css::uno::Reference< css::sdbc::XPreparedStatement >& _xPrepared)
34 :m_xPrepared(_xPrepared)
35 ,m_xParameters(_xPrepared,css::uno::UNO_QUERY)
36 {
37 }
39 virtual void updateString(sal_Int32 _nPos, const OUString& _sValue) override
40 {
41 m_xParameters->setString(_nPos, _sValue);
42 }
43 virtual void updateDouble(sal_Int32 _nPos,const double& _nValue) override
44 {
45 m_xParameters->setDouble(_nPos, _nValue);
46 }
47 virtual void updateDate(sal_Int32 _nPos,const css::util::Date& _nValue) override
48 {
49 m_xParameters->setDate(_nPos, _nValue);
50 }
51 virtual void updateTime(sal_Int32 _nPos,const css::util::Time& _nValue) override
52 {
53 m_xParameters->setTime(_nPos, _nValue);
54 }
55 virtual void updateTimestamp(sal_Int32 _nPos,const css::util::DateTime& _nValue) override
56 {
57 m_xParameters->setTimestamp(_nPos, _nValue);
58 }
59 virtual void updateInt(sal_Int32 _nPos, sal_Int32 _nValue) override
60 {
61 m_xParameters->setInt(_nPos, _nValue);
62 }
63 virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) override
64 {
65 m_xParameters->setNull(_nPos,sqlType);
66 }
67 virtual void insertRow() override
68 {
69 m_xPrepared->executeUpdate();
70 }
71 };
72}
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void updateDate(sal_Int32 _nPos, const css::util::Date &_nValue) override
virtual void insertRow() override
virtual void updateTimestamp(sal_Int32 _nPos, const css::util::DateTime &_nValue) override
css::uno::Reference< css::sdbc::XParameters > m_xParameters
virtual void updateTime(sal_Int32 _nPos, const css::util::Time &_nValue) override
OParameterUpdateHelper(const css::uno::Reference< css::sdbc::XPreparedStatement > &_xPrepared)
virtual void updateDouble(sal_Int32 _nPos, const double &_nValue) override
virtual void updateString(sal_Int32 _nPos, const OUString &_sValue) override
virtual void updateNull(sal_Int32 _nPos, ::sal_Int32 sqlType) override
css::uno::Reference< css::sdbc::XPreparedStatement > m_xPrepared
virtual void updateInt(sal_Int32 _nPos, sal_Int32 _nValue) override
sal_Int32 _nValue
sal_Int32 _nPos