1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OBoundParam.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CONNECTIVITY_OBOUNPARAM_HXX_
31 #define _CONNECTIVITY_OBOUNPARAM_HXX_
33 #include <com/sun/star/io/XInputStream.hpp>
34 #include "odbc/odbcbasedllapi.hxx"
36 namespace connectivity
40 class OOO_DLLPUBLIC_ODBCBASE OBoundParam
60 delete [] paramLength
;
62 //--------------------------------------------------------------------
64 // Perform an necessary initialization
65 //--------------------------------------------------------------------
68 // Allocate storage for the length. Note - the length is
69 // stored in native format, and will have to be converted
70 // to a Java sal_Int32. The jdbcodbc 'C' bridge provides an
71 // interface to do this.
73 paramLength
= new sal_Int8
[4];
76 //--------------------------------------------------------------------
77 // allocBindDataBuffer
78 // Allocates and returns a new bind data buffer of the specified
80 //--------------------------------------------------------------------
81 sal_Int8
* allocBindDataBuffer (sal_Int32 bufLen
)
85 binaryData
= new sal_Int8
[bufLen
];
87 // Reset the input stream, we are doing a new bind
88 setInputStream (NULL
, 0);
93 //--------------------------------------------------------------------
95 // Returns the data buffer to be used when binding to a parameter
96 //--------------------------------------------------------------------
97 sal_Int8
* getBindDataBuffer ()
102 //--------------------------------------------------------------------
103 // getBindLengthBuffer
104 // Returns the length buffer to be used when binding to a parameter
105 //--------------------------------------------------------------------
106 sal_Int8
* getBindLengthBuffer ()
111 //--------------------------------------------------------------------
113 // Sets the input stream for the bound parameter
114 //--------------------------------------------------------------------
115 void setInputStream(const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& inputStream
,
118 paramInputStream
= inputStream
;
119 paramInputStreamLen
= len
;
122 //--------------------------------------------------------------------
124 // Gets the input stream for the bound parameter
125 //--------------------------------------------------------------------
126 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream ()
128 return paramInputStream
;
131 //--------------------------------------------------------------------
133 // Gets the input stream length for the bound parameter
134 //--------------------------------------------------------------------
135 sal_Int32
getInputStreamLen ()
137 return paramInputStreamLen
;
140 //--------------------------------------------------------------------
142 // Sets the Java sql type used to register an OUT parameter
143 //--------------------------------------------------------------------
145 void setSqlType(sal_Int32 type
)
150 //--------------------------------------------------------------------
152 // Gets the Java sql type used to register an OUT parameter
153 //--------------------------------------------------------------------
155 sal_Int32
getSqlType ()
160 //--------------------------------------------------------------------
161 // setOutputParameter
162 // Sets the flag indicating if this is an OUTPUT parameter
163 //--------------------------------------------------------------------
165 void setOutputParameter (sal_Bool output
)
167 outputParameter
= output
;
170 //--------------------------------------------------------------------
172 // Gets the OUTPUT parameter flag
173 //--------------------------------------------------------------------
175 sal_Bool
isOutputParameter ()
177 return outputParameter
;
181 //====================================================================
183 //====================================================================
185 sal_Int8
* binaryData
; // Storage area to be used
186 // when binding the parameter
188 sal_Int8
* paramLength
; // Storage area to be used
189 // for the bound length of the
190 // parameter. Note that this
191 // data is in native format.
193 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> paramInputStream
;
194 // When an input stream is
195 // bound to a parameter, the
196 // input stream is saved
199 sal_Int32 paramInputStreamLen
; // Length of input stream
201 sal_Int32 sqlType
; // Java SQL type used to
202 // register an OUT parameter
204 sal_Bool outputParameter
; // true for OUTPUT parameters
207 sal_Int32 pA1
; //pointers
214 sal_Int32 pS2
;// reserved for strings(UTFChars)
218 #endif // _CONNECTIVITY_OBOUNPARAM_HXX_