1*b1cdbd2cSJim Jagielski/**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_sdbc_XSQLOutput_idl__
24*b1cdbd2cSJim Jagielski#define __com_sun_star_sdbc_XSQLOutput_idl__
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_uno_XInterface_idl__
27*b1cdbd2cSJim Jagielski#include <com/sun/star/uno/XInterface.idl>
28*b1cdbd2cSJim Jagielski#endif
29*b1cdbd2cSJim Jagielski
30*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_util_Date_idl__
31*b1cdbd2cSJim Jagielski#include <com/sun/star/util/Date.idl>
32*b1cdbd2cSJim Jagielski#endif
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_util_DateTime_idl__
35*b1cdbd2cSJim Jagielski#include <com/sun/star/util/DateTime.idl>
36*b1cdbd2cSJim Jagielski#endif
37*b1cdbd2cSJim Jagielski
38*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_util_Time_idl__
39*b1cdbd2cSJim Jagielski#include <com/sun/star/util/Time.idl>
40*b1cdbd2cSJim Jagielski#endif
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski module com {  module sun {  module star {  module io {
43*b1cdbd2cSJim Jagielski published interface XInputStream;
44*b1cdbd2cSJim Jagielski};};};};
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_sdbc_SQLException_idl__
47*b1cdbd2cSJim Jagielski#include <com/sun/star/sdbc/SQLException.idl>
48*b1cdbd2cSJim Jagielski#endif
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielski module com {  module sun {  module star {  module sdbc {
51*b1cdbd2cSJim Jagielski
52*b1cdbd2cSJim Jagielski published interface XRef;
53*b1cdbd2cSJim Jagielski published interface XArray;
54*b1cdbd2cSJim Jagielski published interface XBlob;
55*b1cdbd2cSJim Jagielski published interface XClob;
56*b1cdbd2cSJim Jagielski published interface XStruct;
57*b1cdbd2cSJim Jagielski published interface XSQLData;
58*b1cdbd2cSJim Jagielski
59*b1cdbd2cSJim Jagielski
60*b1cdbd2cSJim Jagielski/** is used as an output stream for writing the attributes of a user-defined
61*b1cdbd2cSJim Jagielski	type back to the database.  This interface, used only for custom mapping,
62*b1cdbd2cSJim Jagielski	is used by the driver, and its methods are never directly invoked
63*b1cdbd2cSJim Jagielski	by a programmer.
64*b1cdbd2cSJim Jagielski
65*b1cdbd2cSJim Jagielski
66*b1cdbd2cSJim Jagielski	<p>
67*b1cdbd2cSJim Jagielski	When an object of a class implementing interface
68*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::sdbc">XSQLData</type>
69*b1cdbd2cSJim Jagielski	is passed as an argument to a SQL statement, the JDBC driver calls
70*b1cdbd2cSJim Jagielski	<method scope="com::sun::star::sdbc">SQLData::getSQLType</method>
71*b1cdbd2cSJim Jagielski	to determine the kind of SQL datum being passed to the database.
72*b1cdbd2cSJim Jagielski	<br/>
73*b1cdbd2cSJim Jagielski	The driver then creates an instance of
74*b1cdbd2cSJim Jagielski	<code>XSQLOutput</code>
75*b1cdbd2cSJim Jagielski	and passes it to the method
76*b1cdbd2cSJim Jagielski	<method scope="com::sun::star::sdbc">XSQLData::writeSQL</method>
77*b1cdbd2cSJim Jagielski	. The method
78*b1cdbd2cSJim Jagielski	<code>writeSQL</code>
79*b1cdbd2cSJim Jagielski	in turn calls the appropriate
80*b1cdbd2cSJim Jagielski	<code>XSQLOutput.writeXXX</code>
81*b1cdbd2cSJim Jagielski	methods to write data from the
82*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::sdbc">XSQLData</type>
83*b1cdbd2cSJim Jagielski	object to the
84*b1cdbd2cSJim Jagielski	<code>XSQLOutput</code>
85*b1cdbd2cSJim Jagielski	output stream as the representation of a SQL user-defined type.</p>
86*b1cdbd2cSJim Jagielski */
87*b1cdbd2cSJim Jagielskipublished interface XSQLOutput: com::sun::star::uno::XInterface
88*b1cdbd2cSJim Jagielski{
89*b1cdbd2cSJim Jagielski
90*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a string.
91*b1cdbd2cSJim Jagielski		@param x
92*b1cdbd2cSJim Jagielski			the value to pass to the database.
93*b1cdbd2cSJim Jagielski		@throws SQLException
94*b1cdbd2cSJim Jagielski			if a database access error occurs.
95*b1cdbd2cSJim Jagielski	 */
96*b1cdbd2cSJim Jagielski	void writeString([in]string x) raises (SQLException);
97*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
98*b1cdbd2cSJim Jagielski
99*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as boolean.
100*b1cdbd2cSJim Jagielski		@param x
101*b1cdbd2cSJim Jagielski			the value to pass to the database.
102*b1cdbd2cSJim Jagielski		@throws SQLException
103*b1cdbd2cSJim Jagielski			if a database access error occurs.
104*b1cdbd2cSJim Jagielski	 */
105*b1cdbd2cSJim Jagielski	void writeBoolean([in]boolean x) raises (SQLException);
106*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
107*b1cdbd2cSJim Jagielski
108*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as byte.
109*b1cdbd2cSJim Jagielski		@param x
110*b1cdbd2cSJim Jagielski			the value to pass to the database.
111*b1cdbd2cSJim Jagielski		@throws SQLException
112*b1cdbd2cSJim Jagielski			if a database access error occurs.
113*b1cdbd2cSJim Jagielski	 */
114*b1cdbd2cSJim Jagielski	void writeByte([in]byte x) raises (SQLException);
115*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
116*b1cdbd2cSJim Jagielski
117*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as short.
118*b1cdbd2cSJim Jagielski		@param x
119*b1cdbd2cSJim Jagielski			the value to pass to the database.
120*b1cdbd2cSJim Jagielski		@throws SQLException
121*b1cdbd2cSJim Jagielski			if a database access error occurs.
122*b1cdbd2cSJim Jagielski	 */
123*b1cdbd2cSJim Jagielski	void writeShort([in]short x) raises (SQLException);
124*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
125*b1cdbd2cSJim Jagielski
126*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as long.
127*b1cdbd2cSJim Jagielski		@param x
128*b1cdbd2cSJim Jagielski			the value to pass to the database.
129*b1cdbd2cSJim Jagielski		@throws SQLException
130*b1cdbd2cSJim Jagielski			if a database access error occurs.
131*b1cdbd2cSJim Jagielski	 */
132*b1cdbd2cSJim Jagielski	void writeInt([in]long x) raises (SQLException);
133*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
134*b1cdbd2cSJim Jagielski
135*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as hyper.
136*b1cdbd2cSJim Jagielski		@param x
137*b1cdbd2cSJim Jagielski			the value to pass to the database.
138*b1cdbd2cSJim Jagielski		@throws SQLException
139*b1cdbd2cSJim Jagielski			if a database access error occurs.
140*b1cdbd2cSJim Jagielski	 */
141*b1cdbd2cSJim Jagielski	void writeLong([in]hyper x) raises (SQLException);
142*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
143*b1cdbd2cSJim Jagielski
144*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as float.
145*b1cdbd2cSJim Jagielski		@param x
146*b1cdbd2cSJim Jagielski			the value to pass to the database.
147*b1cdbd2cSJim Jagielski		@throws SQLException
148*b1cdbd2cSJim Jagielski			if a database access error occurs.
149*b1cdbd2cSJim Jagielski	 */
150*b1cdbd2cSJim Jagielski	void writeFloat([in]float x) raises (SQLException);
151*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
152*b1cdbd2cSJim Jagielski
153*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as double.
154*b1cdbd2cSJim Jagielski		@param x
155*b1cdbd2cSJim Jagielski			the value to pass to the database.
156*b1cdbd2cSJim Jagielski		@throws SQLException
157*b1cdbd2cSJim Jagielski			if a database access error occurs.
158*b1cdbd2cSJim Jagielski	 */
159*b1cdbd2cSJim Jagielski	void writeDouble([in]double x) raises (SQLException);
160*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
161*b1cdbd2cSJim Jagielski
162*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as byte sequence.
163*b1cdbd2cSJim Jagielski		@param x
164*b1cdbd2cSJim Jagielski			the value to pass to the database.
165*b1cdbd2cSJim Jagielski		@throws SQLException
166*b1cdbd2cSJim Jagielski			if a database access error occurs.
167*b1cdbd2cSJim Jagielski	 */
168*b1cdbd2cSJim Jagielski	void writeBytes([in]sequence<byte> x) raises (SQLException);
169*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
170*b1cdbd2cSJim Jagielski
171*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a date.
172*b1cdbd2cSJim Jagielski		@param x
173*b1cdbd2cSJim Jagielski			the value to pass to the database.
174*b1cdbd2cSJim Jagielski		@throws SQLException
175*b1cdbd2cSJim Jagielski			if a database access error occurs.
176*b1cdbd2cSJim Jagielski	 */
177*b1cdbd2cSJim Jagielski	void writeDate([in]com::sun::star::util::Date x) raises (SQLException);
178*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
179*b1cdbd2cSJim Jagielski
180*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a time.
181*b1cdbd2cSJim Jagielski		@param x
182*b1cdbd2cSJim Jagielski			the value to pass to the database.
183*b1cdbd2cSJim Jagielski		@throws SQLException
184*b1cdbd2cSJim Jagielski			if a database access error occurs.
185*b1cdbd2cSJim Jagielski	 */
186*b1cdbd2cSJim Jagielski	void writeTime([in]com::sun::star::util::Time x) raises (SQLException);
187*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
188*b1cdbd2cSJim Jagielski
189*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a datetime.
190*b1cdbd2cSJim Jagielski		@param x
191*b1cdbd2cSJim Jagielski			the value to pass to the database.
192*b1cdbd2cSJim Jagielski		@throws SQLException
193*b1cdbd2cSJim Jagielski			if a database access error occurs.
194*b1cdbd2cSJim Jagielski	 */
195*b1cdbd2cSJim Jagielski	void writeTimestamp([in]com::sun::star::util::DateTime x)
196*b1cdbd2cSJim Jagielski		raises (SQLException);
197*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
198*b1cdbd2cSJim Jagielski
199*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a stream of uninterpreted
200*b1cdbd2cSJim Jagielski		bytes.
201*b1cdbd2cSJim Jagielski		@param x
202*b1cdbd2cSJim Jagielski			the value to pass to the database.
203*b1cdbd2cSJim Jagielski		@throws SQLException
204*b1cdbd2cSJim Jagielski			if a database access error occurs.
205*b1cdbd2cSJim Jagielski	 */
206*b1cdbd2cSJim Jagielski	void writeBinaryStream([in]com::sun::star::io::XInputStream x)
207*b1cdbd2cSJim Jagielski		raises (SQLException);
208*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
209*b1cdbd2cSJim Jagielski
210*b1cdbd2cSJim Jagielski	/** writes the next attribute to the stream as a stream of unicode string.
211*b1cdbd2cSJim Jagielski		@param x
212*b1cdbd2cSJim Jagielski			the value to pass to the database.
213*b1cdbd2cSJim Jagielski		@throws SQLException
214*b1cdbd2cSJim Jagielski			if a database access error occurs.
215*b1cdbd2cSJim Jagielski	 */
216*b1cdbd2cSJim Jagielski	void writeCharacterStream([in]com::sun::star::io::XInputStream x)
217*b1cdbd2cSJim Jagielski		raises (SQLException);
218*b1cdbd2cSJim Jagielski	//-------------------------------------------------------------------------
219*b1cdbd2cSJim Jagielski
220*b1cdbd2cSJim Jagielski	/** writes to the stream the data contained in the given
221*b1cdbd2cSJim Jagielski		<code>XSQLData</code> object.
222*b1cdbd2cSJim Jagielski
223*b1cdbd2cSJim Jagielski
224*b1cdbd2cSJim Jagielski		<p
225*b1cdbd2cSJim Jagielski		>When the
226*b1cdbd2cSJim Jagielski		<code>XSQLData</code>
227*b1cdbd2cSJim Jagielski		object is
228*b1cdbd2cSJim Jagielski		<NULL/>
229*b1cdbd2cSJim Jagielski		, this method writes an SQL NULL to the stream.
230*b1cdbd2cSJim Jagielski		Otherwise, it calls the
231*b1cdbd2cSJim Jagielski		<member scope="com::sun::star::sdbc">XSQLData::writeSQL()</member>
232*b1cdbd2cSJim Jagielski		method of the given object, which
233*b1cdbd2cSJim Jagielski		writes the object's attributes to the stream.
234*b1cdbd2cSJim Jagielski		The implementation of the method
235*b1cdbd2cSJim Jagielski		<code>XSQLData::writeSQL()</code>
236*b1cdbd2cSJim Jagielski		calls the appropriate
237*b1cdbd2cSJim Jagielski		<code>XSQLOutput.writeXXX</code>
238*b1cdbd2cSJim Jagielski		method(s) for writing each of the object's attributes in order.
239*b1cdbd2cSJim Jagielski		<br/>
240*b1cdbd2cSJim Jagielski		The attributes must be read from an
241*b1cdbd2cSJim Jagielski		<type scope="com::sun::star::sdbc">XSQLInput</type>
242*b1cdbd2cSJim Jagielski		input stream and written to an
243*b1cdbd2cSJim Jagielski		<code>XSQLOutput</code>
244*b1cdbd2cSJim Jagielski		output stream in the same order in which they were
245*b1cdbd2cSJim Jagielski		listed in the SQL definition of the user-defined type.
246*b1cdbd2cSJim Jagielski		</p>
247*b1cdbd2cSJim Jagielski		@param x
248*b1cdbd2cSJim Jagielski			the value to pass to the database.
249*b1cdbd2cSJim Jagielski		@throws SQLException
250*b1cdbd2cSJim Jagielski			if a database access error occurs.
251*b1cdbd2cSJim Jagielski	 */
252*b1cdbd2cSJim Jagielski	void writeObject([in]XSQLData x) raises (SQLException);
253*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
254*b1cdbd2cSJim Jagielski
255*b1cdbd2cSJim Jagielski	/** writes a REF(&amp;lt;structured-type&amp;gt;) to the stream.
256*b1cdbd2cSJim Jagielski		@param x
257*b1cdbd2cSJim Jagielski			the value to pass to the database.
258*b1cdbd2cSJim Jagielski		@throws SQLException
259*b1cdbd2cSJim Jagielski			if a database access error occurs.
260*b1cdbd2cSJim Jagielski	 */
261*b1cdbd2cSJim Jagielski	void writeRef([in]XRef x) raises (SQLException);
262*b1cdbd2cSJim Jagielski  	//-------------------------------------------------------------------------
263*b1cdbd2cSJim Jagielski
264*b1cdbd2cSJim Jagielski	/** writes a BLOB to the stream.
265*b1cdbd2cSJim Jagielski		@param x
266*b1cdbd2cSJim Jagielski			the value to pass to the database.
267*b1cdbd2cSJim Jagielski		@throws SQLException
268*b1cdbd2cSJim Jagielski			if a database access error occurs.
269*b1cdbd2cSJim Jagielski	 */
270*b1cdbd2cSJim Jagielski	void writeBlob([in]XBlob x) raises (SQLException);
271*b1cdbd2cSJim Jagielski	//-------------------------------------------------------------------------
272*b1cdbd2cSJim Jagielski
273*b1cdbd2cSJim Jagielski	/** writes a CLOB to the stream.
274*b1cdbd2cSJim Jagielski		@param x
275*b1cdbd2cSJim Jagielski			the value to pass to the database.
276*b1cdbd2cSJim Jagielski		@throws SQLException
277*b1cdbd2cSJim Jagielski			if a database access error occurs.
278*b1cdbd2cSJim Jagielski	 */
279*b1cdbd2cSJim Jagielski	void writeClob([in]XClob x) raises (SQLException);
280*b1cdbd2cSJim Jagielski	//-------------------------------------------------------------------------
281*b1cdbd2cSJim Jagielski
282*b1cdbd2cSJim Jagielski	/** writes a structured-type to the stream.
283*b1cdbd2cSJim Jagielski		@param x
284*b1cdbd2cSJim Jagielski			the value to pass to the database.
285*b1cdbd2cSJim Jagielski		@throws SQLException
286*b1cdbd2cSJim Jagielski			if a database access error occurs.
287*b1cdbd2cSJim Jagielski	 */
288*b1cdbd2cSJim Jagielski	void writeStruct([in]XStruct x) raises (SQLException);
289*b1cdbd2cSJim Jagielski	//-------------------------------------------------------------------------
290*b1cdbd2cSJim Jagielski
291*b1cdbd2cSJim Jagielski	/** writes an array to the stream.
292*b1cdbd2cSJim Jagielski		@param x
293*b1cdbd2cSJim Jagielski			the value to pass to the database.
294*b1cdbd2cSJim Jagielski		@throws SQLException
295*b1cdbd2cSJim Jagielski			if a database access error occurs.
296*b1cdbd2cSJim Jagielski	 */
297*b1cdbd2cSJim Jagielski	void writeArray([in]XArray x) raises (SQLException);
298*b1cdbd2cSJim Jagielski};
299*b1cdbd2cSJim Jagielski
300*b1cdbd2cSJim Jagielski//=============================================================================
301*b1cdbd2cSJim Jagielski
302*b1cdbd2cSJim Jagielski}; }; }; };
303*b1cdbd2cSJim Jagielski
304*b1cdbd2cSJim Jagielski/*===========================================================================
305*b1cdbd2cSJim Jagielski===========================================================================*/
306*b1cdbd2cSJim Jagielski#endif
307