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