Bump for 3.6-28
[LibreOffice.git] / connectivity / source / inc / odbc / OBoundParam.hxx
blob99a4901069ef99f32155213c5941c2949452d96a
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
36 namespace odbc
38 class OOO_DLLPUBLIC_ODBCBASE OBoundParam
41 public:
42 OBoundParam()
44 paramLength = NULL;
45 binaryData = NULL;
46 pA1=0;
47 pA2=0;
48 pB1=0;
49 pB2=0;
50 pC1=0;
51 pC2=0;
52 pS1=0;
53 pS2=0;
55 ~OBoundParam()
57 delete [] binaryData;
58 delete [] paramLength;
60 //--------------------------------------------------------------------
61 // initialize
62 // Perform an necessary initialization
63 //--------------------------------------------------------------------
64 void initialize ()
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
77 // length
78 //--------------------------------------------------------------------
79 sal_Int8* allocBindDataBuffer (sal_Int32 bufLen)
81 if ( binaryData )
82 delete [] binaryData;
83 binaryData = new sal_Int8[bufLen];
85 // Reset the input stream, we are doing a new bind
86 setInputStream (NULL, 0);
88 return binaryData;
91 //--------------------------------------------------------------------
92 // getBindDataBuffer
93 // Returns the data buffer to be used when binding to a parameter
94 //--------------------------------------------------------------------
95 sal_Int8* getBindDataBuffer ()
97 return binaryData;
100 //--------------------------------------------------------------------
101 // getBindLengthBuffer
102 // Returns the length buffer to be used when binding to a parameter
103 //--------------------------------------------------------------------
104 sal_Int8* getBindLengthBuffer ()
106 return paramLength;
109 //--------------------------------------------------------------------
110 // setInputStream
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,
114 sal_Int32 len)
116 paramInputStream = inputStream;
117 paramInputStreamLen = len;
120 void setSequence(const ::com::sun::star::uno::Sequence< sal_Int8 >& _aSequence)
122 aSequence = _aSequence;
125 //--------------------------------------------------------------------
126 // getInputStream
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 //--------------------------------------------------------------------
135 // getInputStreamLen
136 // Gets the input stream length for the bound parameter
137 //--------------------------------------------------------------------
138 sal_Int32 getInputStreamLen ()
140 return paramInputStreamLen;
143 //--------------------------------------------------------------------
144 // setSqlType
145 // Sets the Java sql type used to register an OUT parameter
146 //--------------------------------------------------------------------
148 void setSqlType(sal_Int32 type)
150 sqlType = type;
153 //--------------------------------------------------------------------
154 // getSqlType
155 // Gets the Java sql type used to register an OUT parameter
156 //--------------------------------------------------------------------
158 sal_Int32 getSqlType ()
160 return sqlType;
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 //--------------------------------------------------------------------
174 // isOutputParameter
175 // Gets the OUTPUT parameter flag
176 //--------------------------------------------------------------------
178 sal_Bool isOutputParameter ()
180 return outputParameter;
183 protected:
184 //====================================================================
185 // Data attributes
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
201 // until needed.
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
212 sal_Int32 pA2;
213 sal_Int32 pB1;
214 sal_Int32 pB2;
215 sal_Int32 pC1;
216 sal_Int32 pC2;
217 sal_Int32 pS1;
218 sal_Int32 pS2;// reserved for strings(UTFChars)
222 #endif // _CONNECTIVITY_OBOUNPARAM_HXX_
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */