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 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
22 #include <com/sun/star/io/XInputStream.hpp>
23 #include <com/sun/star/sdbc/DataType.hpp>
24 #include "odbc/odbcbasedllapi.hxx"
26 namespace connectivity
30 class OOO_DLLPUBLIC_ODBCBASE OBoundParam
37 , paramInputStreamLen(0)
38 , sqlType(::com::sun::star::sdbc::DataType::SQLNULL
)
39 , outputParameter(false)
47 // allocBindDataBuffer
48 // Allocates and returns a new bind data buffer of the specified
51 void* allocBindDataBuffer (sal_Int32 bufLen
)
53 // Reset the input stream and sequence, we are doing a new bind
54 setInputStream (NULL
, 0);
58 binaryData
= (bufLen
> 0) ? malloc(bufLen
) : NULL
;
65 // Returns the data buffer to be used when binding to a parameter
67 void* getBindDataBuffer ()
73 // getBindLengthBuffer
74 // Returns the length buffer to be used when binding to a parameter
76 SQLLEN
& getBindLengthBuffer ()
83 // Sets the input stream for the bound parameter
85 void setInputStream(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& inputStream
,
88 paramInputStream
= inputStream
;
89 paramInputStreamLen
= len
;
92 void setSequence(const ::com::sun::star::uno::Sequence
< sal_Int8
>& _aSequence
)
94 aSequence
= _aSequence
;
99 // Gets the input stream for the bound parameter
101 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream ()
103 return paramInputStream
;
108 // Gets the input stream length for the bound parameter
110 sal_Int32
getInputStreamLen ()
112 return paramInputStreamLen
;
117 // Sets the Java sql type used to register an OUT parameter
120 void setSqlType(sal_Int32 type
)
127 // Gets the Java sql type used to register an OUT parameter
130 sal_Int32
getSqlType ()
136 // setOutputParameter
137 // Sets the flag indicating if this is an OUTPUT parameter
140 void setOutputParameter (bool output
)
142 outputParameter
= output
;
147 // Gets the OUTPUT parameter flag
150 bool isOutputParameter ()
152 return outputParameter
;
160 void *binaryData
; // Storage area to be used
161 // when binding the parameter
163 SQLLEN paramLength
; // Storage area to be used
164 // for the bound length of the
165 // parameter. Note that this
166 // data is in native format.
168 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> paramInputStream
;
169 ::com::sun::star::uno::Sequence
< sal_Int8
> aSequence
;
170 // When an input stream is
171 // bound to a parameter, a
172 // reference to the input stream is saved
173 // until not needed anymore.
175 sal_Int32 paramInputStreamLen
; // Length of input stream
177 sal_Int32 sqlType
; // Java SQL type used to
178 // register an OUT parameter
180 bool outputParameter
; // true for OUTPUT parameters
184 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OBOUNDPARAM_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */