xref: /trunk/main/offapi/com/sun/star/sdbc/XSQLData.idl (revision d1766043)
1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_XSQLData_idl__
24cdf0e10cSrcweir#define __com_sun_star_sdbc_XSQLData_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_SQLException_idl__
31cdf0e10cSrcweir#include <com/sun/star/sdbc/SQLException.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir module com {  module sun {  module star {  module sdbc {
35cdf0e10cSrcweir
36cdf0e10cSrcweir published interface XSQLInput;
37cdf0e10cSrcweir published interface XSQLOutput;
38cdf0e10cSrcweir
39cdf0e10cSrcweir
40cdf0e10cSrcweir/** is used for the custom mapping of SQL user-defined types.
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir	<p>
44cdf0e10cSrcweir	This interface must be implemented by a service that is
45cdf0e10cSrcweir	registered in a type mapping.  It is expected that this interface
46cdf0e10cSrcweir	will normally be implemented by a tool. The methods in this interface
47cdf0e10cSrcweir	are called by the driver and are never called by a programmer
48cdf0e10cSrcweir	directly.
49cdf0e10cSrcweir	</p>
50cdf0e10cSrcweir */
51cdf0e10cSrcweirpublished interface XSQLData: com::sun::star::uno::XInterface
52cdf0e10cSrcweir{
53cdf0e10cSrcweir
54cdf0e10cSrcweir	/** returns the fully-qualified name of the SQL user-defined type
55cdf0e10cSrcweir		that this object represents.
56cdf0e10cSrcweir
57cdf0e10cSrcweir
58cdf0e10cSrcweir		<p>
59cdf0e10cSrcweir		This method is called by the SDBC driver to get the name of the
60cdf0e10cSrcweir		UDT instance that is being mapped to this instance of SQLData.
61cdf0e10cSrcweir		</p>
62cdf0e10cSrcweir		@returns
63cdf0e10cSrcweir			the name of the SQL type.
64cdf0e10cSrcweir		@throws SQLException
65cdf0e10cSrcweir			if a database access error occurs.
66cdf0e10cSrcweir	 */
67cdf0e10cSrcweir	string getSQLTypeName() raises (SQLException);
68cdf0e10cSrcweir
69cdf0e10cSrcweir 	//-------------------------------------------------------------------------
70cdf0e10cSrcweir
71cdf0e10cSrcweir	/** populates this object with data read from the database.
72cdf0e10cSrcweir
73cdf0e10cSrcweir
74cdf0e10cSrcweir		<p>
75cdf0e10cSrcweir		The implementation of the method must follow this protocol:
76cdf0e10cSrcweir		<br/>
77cdf0e10cSrcweir		It must read each of the attributes or elements of the SQL
78cdf0e10cSrcweir		type from the given input stream. This is done
79cdf0e10cSrcweir		by calling a method of the input stream to read each
80cdf0e10cSrcweir		item, in the order that they appear in the SQL definition
81cdf0e10cSrcweir		of the type. The method
82cdf0e10cSrcweir		<code>readSQL</code>
83cdf0e10cSrcweir		then assigns the data to appropriate fields or elements (of this
84cdf0e10cSrcweir		or other objects).
85cdf0e10cSrcweir		<br/>
86cdf0e10cSrcweir		Specifically, it must call the appropriate
87cdf0e10cSrcweir		<code>XSQLInput.readXXX</code>
88cdf0e10cSrcweir		method(s) to do the following:
89cdf0e10cSrcweir		for a Distinct Type, read its single data element;
90cdf0e10cSrcweir		for a Structured Type, read a value for each attribute of the SQL type.
91cdf0e10cSrcweir		</p>
92cdf0e10cSrcweir		<p>
93cdf0e10cSrcweir		The SDBC driver initializes the input stream with a type map
94cdf0e10cSrcweir		before calling this method, which is used by the appropriate
95cdf0e10cSrcweir		<code>SQLInput.readXXX</code>
96cdf0e10cSrcweir		method on the stream.
97cdf0e10cSrcweir		</p>
98cdf0e10cSrcweir
99cdf0e10cSrcweir		@param stream
100cdf0e10cSrcweir			the input SQL data stream
101cdf0e10cSrcweir		@param typeName
102cdf0e10cSrcweir			the SQL type of the value on the data stream
103cdf0e10cSrcweir		@throws SQLException
104cdf0e10cSrcweir			if a database access error occurs.
105cdf0e10cSrcweir
106cdf0e10cSrcweir		@see com::sun::star::sdbc::XSQLInput
107cdf0e10cSrcweir	 */
108cdf0e10cSrcweir	void readSQL([in]XSQLInput stream, [in]string typeName)
109cdf0e10cSrcweir		raises (SQLException);
110cdf0e10cSrcweir	//-------------------------------------------------------------------------
111cdf0e10cSrcweir
112cdf0e10cSrcweir	/** writes this object to the given SQL data stream.
113cdf0e10cSrcweir
114cdf0e10cSrcweir
115cdf0e10cSrcweir		<p>
116cdf0e10cSrcweir		The implementation of the method must follow this protocol:
117cdf0e10cSrcweir		<br/>
118cdf0e10cSrcweir		It must write each of the attributes of the SQL type to the given output
119cdf0e10cSrcweir		stream. This is done by calling a method of the output stream to write
120cdf0e10cSrcweir		each item, in the order that they appear in the SQL definition of the type.
121cdf0e10cSrcweir		Specifically, it must call the appropriate
122cdf0e10cSrcweir		<code>XSQLOutput.writeXXX</code>
123cdf0e10cSrcweir		method(s) to do the following:<br>
124cdf0e10cSrcweir		for a Distinct Type, write its single data element;
125cdf0e10cSrcweir		for a Structured Type, write a value for each attribute of the SQL type.
126cdf0e10cSrcweir		</p>
127cdf0e10cSrcweir		@param stream
128cdf0e10cSrcweir			the output SQL data stream
129cdf0e10cSrcweir		@throws SQLException
130cdf0e10cSrcweir			if a database access error occurs.
131cdf0e10cSrcweir		@see com::sun::star::sdbc::XSQLOutput
132cdf0e10cSrcweir	 */
133cdf0e10cSrcweir	void writeSQL([in]XSQLOutput stream) raises (SQLException);
134cdf0e10cSrcweir};
135cdf0e10cSrcweir
136cdf0e10cSrcweir//=============================================================================
137cdf0e10cSrcweir
138cdf0e10cSrcweir}; }; }; };
139cdf0e10cSrcweir
140cdf0e10cSrcweir/*===========================================================================
141cdf0e10cSrcweir===========================================================================*/
142cdf0e10cSrcweir#endif
143