1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_sdb_tools_XConnectionTools_idl__
29*cdf0e10cSrcweir#define __com_sun_star_sdb_tools_XConnectionTools_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
32*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_SQLException_idl__
35*cdf0e10cSrcweir#include <com/sun/star/sdbc/SQLException.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirmodule com {  module sun {  module star {
39*cdf0e10cSrcweir    module container {
40*cdf0e10cSrcweir        published interface XNameAccess;
41*cdf0e10cSrcweir    };
42*cdf0e10cSrcweir    module lang {
43*cdf0e10cSrcweir        published interface XComponent;
44*cdf0e10cSrcweir    };
45*cdf0e10cSrcweir};};};
46*cdf0e10cSrcweir//=============================================================================
47*cdf0e10cSrcweirmodule com {  module sun {  module star {  module sdb {
48*cdf0e10cSrcweir    published interface XSingleSelectQueryComposer;
49*cdf0e10cSrcweir    module tools {
50*cdf0e10cSrcweir//=============================================================================
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirpublished interface XTableName;
53*cdf0e10cSrcweirpublished interface XObjectNames;
54*cdf0e10cSrcweirpublished interface XDataSourceMetaData;
55*cdf0e10cSrcweir
56*cdf0e10cSrcweir//-----------------------------------------------------------------------------
57*cdf0e10cSrcweir/** encapsulates various useful functionality around a
58*cdf0e10cSrcweir    <type scope="com::sun::star::sdb">Connection</type>
59*cdf0e10cSrcweir
60*cdf0e10cSrcweir    <p>Most of the functionality provided here is meaningful only relative to
61*cdf0e10cSrcweir    a given database connection. For instance, for quoting table names, you need
62*cdf0e10cSrcweir    the meta data instance of the connection. Thus, the entry point for obtaining
63*cdf0e10cSrcweir    a <type>XConnectionTools</type> instance is the
64*cdf0e10cSrcweir    <type scope="com::sun::star::sdb">Connection</type> service.</p>
65*cdf0e10cSrcweir
66*cdf0e10cSrcweir    <p>Note that nearly all functionality provided by this interface is also
67*cdf0e10cSrcweir    available by other means, it's only provided here for convenience purposes.</p>
68*cdf0e10cSrcweir
69*cdf0e10cSrcweir    @since OOo 2.0.4
70*cdf0e10cSrcweir*/
71*cdf0e10cSrcweirpublished interface XConnectionTools
72*cdf0e10cSrcweir{
73*cdf0e10cSrcweir    /** creates an instance supporting the <type>XTableName</type> interface,
74*cdf0e10cSrcweir        which can be used to manipulate table names for various purposes.
75*cdf0e10cSrcweir
76*cdf0e10cSrcweir        <p>The returned object is guanrateed to not be <NULL/>.</p>
77*cdf0e10cSrcweir    */
78*cdf0e10cSrcweir    XTableName      createTableName();
79*cdf0e10cSrcweir
80*cdf0e10cSrcweir    /** returns an instance supporting the <type>XObjectNames</type> interface,
81*cdf0e10cSrcweir        which provides access to functionality around table and query names.
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir        <p>The returned object is guanrateed to not be <NULL/>.</p>
84*cdf0e10cSrcweir    */
85*cdf0e10cSrcweir    XObjectNames    getObjectNames();
86*cdf0e10cSrcweir
87*cdf0e10cSrcweir    /** provides access to the application-level data source meta data
88*cdf0e10cSrcweir    */
89*cdf0e10cSrcweir    XDataSourceMetaData
90*cdf0e10cSrcweir                    getDataSourceMetaData();
91*cdf0e10cSrcweir
92*cdf0e10cSrcweir    /** get fields for a result set given by a "command descriptor"
93*cdf0e10cSrcweir
94*cdf0e10cSrcweir        <p>A command descriptor here means:
95*cdf0e10cSrcweir        <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
96*cdf0e10cSrcweir            <li>a string specifying the name of an object relative to the connection</li>
97*cdf0e10cSrcweir            <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
98*cdf0e10cSrcweir                of the object</type></li>
99*cdf0e10cSrcweir        </ul>
100*cdf0e10cSrcweir        </p>
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir        @param commandType
103*cdf0e10cSrcweir            the type of the object
104*cdf0e10cSrcweir
105*cdf0e10cSrcweir        @param command
106*cdf0e10cSrcweir            the object. This may be a table name, a query name, or an SQL statement, depending on the value
107*cdf0e10cSrcweir            of <arg>_nCommandType</arg>
108*cdf0e10cSrcweir
109*cdf0e10cSrcweir        @param _rxCollectionOner
110*cdf0e10cSrcweir            If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned
111*cdf0e10cSrcweir            by this function here is a temporary object. It is kept alive by another object, which is to be
112*cdf0e10cSrcweir            created temporarily, too. To ensure that the fields you get are valid as long as you need them,
113*cdf0e10cSrcweir            the owner which controls their life time is transfered to this parameter upon return.<br/>
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir            Your fields live as long as this component lives.<br/>
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir            Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
118*cdf0e10cSrcweir            It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
119*cdf0e10cSrcweir            be on the safe side with respect to resource leaks, you should dispose the component.
120*cdf0e10cSrcweir
121*cdf0e10cSrcweir        @return
122*cdf0e10cSrcweir            the container of the columns (aka fields) of the object
123*cdf0e10cSrcweir    */
124*cdf0e10cSrcweir    ::com::sun::star::container::XNameAccess getFieldsByCommandDescriptor(  [in] long commandType,
125*cdf0e10cSrcweir                                                                            [in] string command,
126*cdf0e10cSrcweir                                                                            [out] ::com::sun::star::lang::XComponent  keepFieldsAlive
127*cdf0e10cSrcweir                                                                            ) raises( com::sun::star::sdbc::SQLException );
128*cdf0e10cSrcweir
129*cdf0e10cSrcweir    /** get the composer initialized with a command and command type.
130*cdf0e10cSrcweir        @param commandType
131*cdf0e10cSrcweir            the type of the object
132*cdf0e10cSrcweir
133*cdf0e10cSrcweir        @param command
134*cdf0e10cSrcweir            the object. This may be a table name, a query name, or an SQL statement, depending on the value
135*cdf0e10cSrcweir            of <arg>_nCommandType</arg>
136*cdf0e10cSrcweir        @return
137*cdf0e10cSrcweir            the composer filled with command and command type.
138*cdf0e10cSrcweir    */
139*cdf0e10cSrcweir    ::com::sun::star::sdb::XSingleSelectQueryComposer getComposer([in] long commandType,[in] string command);
140*cdf0e10cSrcweir};
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir//=============================================================================
143*cdf0e10cSrcweir}; }; }; }; };
144*cdf0e10cSrcweir//=============================================================================
145*cdf0e10cSrcweir
146*cdf0e10cSrcweir#endif
147