xref: /AOO41X/main/offapi/com/sun/star/sdbc/XSQLData.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_sdbc_XSQLData_idl__
28#define __com_sun_star_sdbc_XSQLData_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_sdbc_SQLException_idl__
35#include <com/sun/star/sdbc/SQLException.idl>
36#endif
37
38 module com {  module sun {  module star {  module sdbc {
39
40 published interface XSQLInput;
41 published interface XSQLOutput;
42
43
44/** is used for the custom mapping of SQL user-defined types.
45
46
47	<p>
48	This interface must be implemented by a service that is
49	registered in a type mapping.  It is expected that this interface
50	will normally be implemented by a tool. The methods in this interface
51	are called by the driver and are never called by a programmer
52	directly.
53	</p>
54 */
55published interface XSQLData: com::sun::star::uno::XInterface
56{
57
58	/** returns the fully-qualified name of the SQL user-defined type
59		that this object represents.
60
61
62		<p>
63		This method is called by the SDBC driver to get the name of the
64		UDT instance that is being mapped to this instance of SQLData.
65		</p>
66		@returns
67			the name of the SQL type.
68		@throws SQLException
69			if a database access error occurs.
70	 */
71	string getSQLTypeName() raises (SQLException);
72
73 	//-------------------------------------------------------------------------
74
75	/** populates this object with data read from the database.
76
77
78		<p>
79		The implementation of the method must follow this protocol:
80		<br/>
81		It must read each of the attributes or elements of the SQL
82		type from the given input stream. This is done
83		by calling a method of the input stream to read each
84		item, in the order that they appear in the SQL definition
85		of the type. The method
86		<code>readSQL</code>
87		then assigns the data to appropriate fields or elements (of this
88		or other objects).
89		<br/>
90		Specifically, it must call the appropriate
91		<code>XSQLInput.readXXX</code>
92		method(s) to do the following:
93		for a Distinct Type, read its single data element;
94		for a Structured Type, read a value for each attribute of the SQL type.
95		</p>
96		<p>
97		The SDBC driver initializes the input stream with a type map
98		before calling this method, which is used by the appropriate
99		<code>SQLInput.readXXX</code>
100		method on the stream.
101		</p>
102
103		@param stream
104			the input SQL data stream
105		@param typeName
106			the SQL type of the value on the data stream
107		@throws SQLException
108			if a database access error occurs.
109
110		@see com::sun::star::sdbc::XSQLInput
111	 */
112	void readSQL([in]XSQLInput stream, [in]string typeName)
113		raises (SQLException);
114	//-------------------------------------------------------------------------
115
116	/** writes this object to the given SQL data stream.
117
118
119		<p>
120		The implementation of the method must follow this protocol:
121		<br/>
122		It must write each of the attributes of the SQL type to the given output
123		stream. This is done by calling a method of the output stream to write
124		each item, in the order that they appear in the SQL definition of the type.
125		Specifically, it must call the appropriate
126		<code>XSQLOutput.writeXXX</code>
127		method(s) to do the following:<br>
128		for a Distinct Type, write its single data element;
129		for a Structured Type, write a value for each attribute of the SQL type.
130		</p>
131		@param stream
132			the output SQL data stream
133		@throws SQLException
134			if a database access error occurs.
135		@see com::sun::star::sdbc::XSQLOutput
136	 */
137	void writeSQL([in]XSQLOutput stream) raises (SQLException);
138};
139
140//=============================================================================
141
142}; }; }; };
143
144/*===========================================================================
145===========================================================================*/
146#endif
147