xref: /aoo4110/main/offapi/com/sun/star/sdbc/XSQLData.idl (revision b1cdbd2c)
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_XSQLData_idl__
24*b1cdbd2cSJim Jagielski#define __com_sun_star_sdbc_XSQLData_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_sdbc_SQLException_idl__
31*b1cdbd2cSJim Jagielski#include <com/sun/star/sdbc/SQLException.idl>
32*b1cdbd2cSJim Jagielski#endif
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski module com {  module sun {  module star {  module sdbc {
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim Jagielski published interface XSQLInput;
37*b1cdbd2cSJim Jagielski published interface XSQLOutput;
38*b1cdbd2cSJim Jagielski
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski/** is used for the custom mapping of SQL user-defined types.
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski
43*b1cdbd2cSJim Jagielski	<p>
44*b1cdbd2cSJim Jagielski	This interface must be implemented by a service that is
45*b1cdbd2cSJim Jagielski	registered in a type mapping.  It is expected that this interface
46*b1cdbd2cSJim Jagielski	will normally be implemented by a tool. The methods in this interface
47*b1cdbd2cSJim Jagielski	are called by the driver and are never called by a programmer
48*b1cdbd2cSJim Jagielski	directly.
49*b1cdbd2cSJim Jagielski	</p>
50*b1cdbd2cSJim Jagielski */
51*b1cdbd2cSJim Jagielskipublished interface XSQLData: com::sun::star::uno::XInterface
52*b1cdbd2cSJim Jagielski{
53*b1cdbd2cSJim Jagielski
54*b1cdbd2cSJim Jagielski	/** returns the fully-qualified name of the SQL user-defined type
55*b1cdbd2cSJim Jagielski		that this object represents.
56*b1cdbd2cSJim Jagielski
57*b1cdbd2cSJim Jagielski
58*b1cdbd2cSJim Jagielski		<p>
59*b1cdbd2cSJim Jagielski		This method is called by the SDBC driver to get the name of the
60*b1cdbd2cSJim Jagielski		UDT instance that is being mapped to this instance of SQLData.
61*b1cdbd2cSJim Jagielski		</p>
62*b1cdbd2cSJim Jagielski		@returns
63*b1cdbd2cSJim Jagielski			the name of the SQL type.
64*b1cdbd2cSJim Jagielski		@throws SQLException
65*b1cdbd2cSJim Jagielski			if a database access error occurs.
66*b1cdbd2cSJim Jagielski	 */
67*b1cdbd2cSJim Jagielski	string getSQLTypeName() raises (SQLException);
68*b1cdbd2cSJim Jagielski
69*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------
70*b1cdbd2cSJim Jagielski
71*b1cdbd2cSJim Jagielski	/** populates this object with data read from the database.
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski
74*b1cdbd2cSJim Jagielski		<p>
75*b1cdbd2cSJim Jagielski		The implementation of the method must follow this protocol:
76*b1cdbd2cSJim Jagielski		<br/>
77*b1cdbd2cSJim Jagielski		It must read each of the attributes or elements of the SQL
78*b1cdbd2cSJim Jagielski		type from the given input stream. This is done
79*b1cdbd2cSJim Jagielski		by calling a method of the input stream to read each
80*b1cdbd2cSJim Jagielski		item, in the order that they appear in the SQL definition
81*b1cdbd2cSJim Jagielski		of the type. The method
82*b1cdbd2cSJim Jagielski		<code>readSQL</code>
83*b1cdbd2cSJim Jagielski		then assigns the data to appropriate fields or elements (of this
84*b1cdbd2cSJim Jagielski		or other objects).
85*b1cdbd2cSJim Jagielski		<br/>
86*b1cdbd2cSJim Jagielski		Specifically, it must call the appropriate
87*b1cdbd2cSJim Jagielski		<code>XSQLInput.readXXX</code>
88*b1cdbd2cSJim Jagielski		method(s) to do the following:
89*b1cdbd2cSJim Jagielski		for a Distinct Type, read its single data element;
90*b1cdbd2cSJim Jagielski		for a Structured Type, read a value for each attribute of the SQL type.
91*b1cdbd2cSJim Jagielski		</p>
92*b1cdbd2cSJim Jagielski		<p>
93*b1cdbd2cSJim Jagielski		The SDBC driver initializes the input stream with a type map
94*b1cdbd2cSJim Jagielski		before calling this method, which is used by the appropriate
95*b1cdbd2cSJim Jagielski		<code>SQLInput.readXXX</code>
96*b1cdbd2cSJim Jagielski		method on the stream.
97*b1cdbd2cSJim Jagielski		</p>
98*b1cdbd2cSJim Jagielski
99*b1cdbd2cSJim Jagielski		@param stream
100*b1cdbd2cSJim Jagielski			the input SQL data stream
101*b1cdbd2cSJim Jagielski		@param typeName
102*b1cdbd2cSJim Jagielski			the SQL type of the value on the data stream
103*b1cdbd2cSJim Jagielski		@throws SQLException
104*b1cdbd2cSJim Jagielski			if a database access error occurs.
105*b1cdbd2cSJim Jagielski
106*b1cdbd2cSJim Jagielski		@see com::sun::star::sdbc::XSQLInput
107*b1cdbd2cSJim Jagielski	 */
108*b1cdbd2cSJim Jagielski	void readSQL([in]XSQLInput stream, [in]string typeName)
109*b1cdbd2cSJim Jagielski		raises (SQLException);
110*b1cdbd2cSJim Jagielski	//-------------------------------------------------------------------------
111*b1cdbd2cSJim Jagielski
112*b1cdbd2cSJim Jagielski	/** writes this object to the given SQL data stream.
113*b1cdbd2cSJim Jagielski
114*b1cdbd2cSJim Jagielski
115*b1cdbd2cSJim Jagielski		<p>
116*b1cdbd2cSJim Jagielski		The implementation of the method must follow this protocol:
117*b1cdbd2cSJim Jagielski		<br/>
118*b1cdbd2cSJim Jagielski		It must write each of the attributes of the SQL type to the given output
119*b1cdbd2cSJim Jagielski		stream. This is done by calling a method of the output stream to write
120*b1cdbd2cSJim Jagielski		each item, in the order that they appear in the SQL definition of the type.
121*b1cdbd2cSJim Jagielski		Specifically, it must call the appropriate
122*b1cdbd2cSJim Jagielski		<code>XSQLOutput.writeXXX</code>
123*b1cdbd2cSJim Jagielski		method(s) to do the following:<br>
124*b1cdbd2cSJim Jagielski		for a Distinct Type, write its single data element;
125*b1cdbd2cSJim Jagielski		for a Structured Type, write a value for each attribute of the SQL type.
126*b1cdbd2cSJim Jagielski		</p>
127*b1cdbd2cSJim Jagielski		@param stream
128*b1cdbd2cSJim Jagielski			the output SQL data stream
129*b1cdbd2cSJim Jagielski		@throws SQLException
130*b1cdbd2cSJim Jagielski			if a database access error occurs.
131*b1cdbd2cSJim Jagielski		@see com::sun::star::sdbc::XSQLOutput
132*b1cdbd2cSJim Jagielski	 */
133*b1cdbd2cSJim Jagielski	void writeSQL([in]XSQLOutput stream) raises (SQLException);
134*b1cdbd2cSJim Jagielski};
135*b1cdbd2cSJim Jagielski
136*b1cdbd2cSJim Jagielski//=============================================================================
137*b1cdbd2cSJim Jagielski
138*b1cdbd2cSJim Jagielski}; }; }; };
139*b1cdbd2cSJim Jagielski
140*b1cdbd2cSJim Jagielski/*===========================================================================
141*b1cdbd2cSJim Jagielski===========================================================================*/
142*b1cdbd2cSJim Jagielski#endif
143