update dev300-m58
[ooovba.git] / connectivity / source / inc / odbc / OBoundParam.hxx
blob31d3dde82bed9c2bc08ea5140efa886386003fbe
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OBoundParam.hxx,v $
10 * $Revision: 1.5 $
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
38 namespace odbc
40 class OOO_DLLPUBLIC_ODBCBASE OBoundParam
43 public:
44 OBoundParam()
46 paramLength = NULL;
47 binaryData = NULL;
48 pA1=0;
49 pA2=0;
50 pB1=0;
51 pB2=0;
52 pC1=0;
53 pC2=0;
54 pS1=0;
55 pS2=0;
57 ~OBoundParam()
59 delete [] binaryData;
60 delete [] paramLength;
62 //--------------------------------------------------------------------
63 // initialize
64 // Perform an necessary initialization
65 //--------------------------------------------------------------------
66 void initialize ()
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
79 // length
80 //--------------------------------------------------------------------
81 sal_Int8* allocBindDataBuffer (sal_Int32 bufLen)
83 if ( binaryData )
84 delete [] binaryData;
85 binaryData = new sal_Int8[bufLen];
87 // Reset the input stream, we are doing a new bind
88 setInputStream (NULL, 0);
90 return binaryData;
93 //--------------------------------------------------------------------
94 // getBindDataBuffer
95 // Returns the data buffer to be used when binding to a parameter
96 //--------------------------------------------------------------------
97 sal_Int8* getBindDataBuffer ()
99 return binaryData;
102 //--------------------------------------------------------------------
103 // getBindLengthBuffer
104 // Returns the length buffer to be used when binding to a parameter
105 //--------------------------------------------------------------------
106 sal_Int8* getBindLengthBuffer ()
108 return paramLength;
111 //--------------------------------------------------------------------
112 // setInputStream
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,
116 sal_Int32 len)
118 paramInputStream = inputStream;
119 paramInputStreamLen = len;
122 //--------------------------------------------------------------------
123 // getInputStream
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 //--------------------------------------------------------------------
132 // getInputStreamLen
133 // Gets the input stream length for the bound parameter
134 //--------------------------------------------------------------------
135 sal_Int32 getInputStreamLen ()
137 return paramInputStreamLen;
140 //--------------------------------------------------------------------
141 // setSqlType
142 // Sets the Java sql type used to register an OUT parameter
143 //--------------------------------------------------------------------
145 void setSqlType(sal_Int32 type)
147 sqlType = type;
150 //--------------------------------------------------------------------
151 // getSqlType
152 // Gets the Java sql type used to register an OUT parameter
153 //--------------------------------------------------------------------
155 sal_Int32 getSqlType ()
157 return sqlType;
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 //--------------------------------------------------------------------
171 // isOutputParameter
172 // Gets the OUTPUT parameter flag
173 //--------------------------------------------------------------------
175 sal_Bool isOutputParameter ()
177 return outputParameter;
180 protected:
181 //====================================================================
182 // Data attributes
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
197 // until needed.
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
208 sal_Int32 pA2;
209 sal_Int32 pB1;
210 sal_Int32 pB2;
211 sal_Int32 pC1;
212 sal_Int32 pC2;
213 sal_Int32 pS1;
214 sal_Int32 pS2;// reserved for strings(UTFChars)
218 #endif // _CONNECTIVITY_OBOUNPARAM_HXX_