1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _CONNECTIVITY_OBOUNPARAM_HXX_
29 #define _CONNECTIVITY_OBOUNPARAM_HXX_
31 #include <com/sun/star/io/XInputStream.hpp>
32 #include "odbc/odbcbasedllapi.hxx"
34 namespace connectivity
38 class OOO_DLLPUBLIC_ODBCBASE OBoundParam
58 delete [] paramLength
;
60 //--------------------------------------------------------------------
62 // Perform an necessary initialization
63 //--------------------------------------------------------------------
66 // Allocate storage for the length. Note - the length is
67 // stored in native format, and will have to be converted
68 // to a Java sal_Int32. The jdbcodbc 'C' bridge provides an
69 // interface to do this.
71 paramLength
= new sal_Int8
[sizeof(SQLLEN
)];
74 //--------------------------------------------------------------------
75 // allocBindDataBuffer
76 // Allocates and returns a new bind data buffer of the specified
78 //--------------------------------------------------------------------
79 sal_Int8
* allocBindDataBuffer (sal_Int32 bufLen
)
83 binaryData
= new sal_Int8
[bufLen
];
85 // Reset the input stream, we are doing a new bind
86 setInputStream (NULL
, 0);
91 //--------------------------------------------------------------------
93 // Returns the data buffer to be used when binding to a parameter
94 //--------------------------------------------------------------------
95 sal_Int8
* getBindDataBuffer ()
100 //--------------------------------------------------------------------
101 // getBindLengthBuffer
102 // Returns the length buffer to be used when binding to a parameter
103 //--------------------------------------------------------------------
104 sal_Int8
* getBindLengthBuffer ()
109 //--------------------------------------------------------------------
111 // Sets the input stream for the bound parameter
112 //--------------------------------------------------------------------
113 void setInputStream(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& inputStream
,
116 paramInputStream
= inputStream
;
117 paramInputStreamLen
= len
;
120 void setSequence(const ::com::sun::star::uno::Sequence
< sal_Int8
>& _aSequence
)
122 aSequence
= _aSequence
;
125 //--------------------------------------------------------------------
127 // Gets the input stream for the bound parameter
128 //--------------------------------------------------------------------
129 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream ()
131 return paramInputStream
;
134 //--------------------------------------------------------------------
136 // Gets the input stream length for the bound parameter
137 //--------------------------------------------------------------------
138 sal_Int32
getInputStreamLen ()
140 return paramInputStreamLen
;
143 //--------------------------------------------------------------------
145 // Sets the Java sql type used to register an OUT parameter
146 //--------------------------------------------------------------------
148 void setSqlType(sal_Int32 type
)
153 //--------------------------------------------------------------------
155 // Gets the Java sql type used to register an OUT parameter
156 //--------------------------------------------------------------------
158 sal_Int32
getSqlType ()
163 //--------------------------------------------------------------------
164 // setOutputParameter
165 // Sets the flag indicating if this is an OUTPUT parameter
166 //--------------------------------------------------------------------
168 void setOutputParameter (sal_Bool output
)
170 outputParameter
= output
;
173 //--------------------------------------------------------------------
175 // Gets the OUTPUT parameter flag
176 //--------------------------------------------------------------------
178 sal_Bool
isOutputParameter ()
180 return outputParameter
;
184 //====================================================================
186 //====================================================================
188 sal_Int8
* binaryData
; // Storage area to be used
189 // when binding the parameter
191 sal_Int8
* paramLength
; // Storage area to be used
192 // for the bound length of the
193 // parameter. Note that this
194 // data is in native format.
196 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> paramInputStream
;
197 ::com::sun::star::uno::Sequence
< sal_Int8
> aSequence
;
198 // When an input stream is
199 // bound to a parameter, the
200 // input stream is saved
203 sal_Int32 paramInputStreamLen
; // Length of input stream
205 sal_Int32 sqlType
; // Java SQL type used to
206 // register an OUT parameter
208 sal_Bool outputParameter
; // true for OUTPUT parameters
211 sal_Int32 pA1
; //pointers
218 sal_Int32 pS2
;// reserved for strings(UTFChars)
222 #endif // _CONNECTIVITY_OBOUNPARAM_HXX_
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */