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_XTableName_idl__
29*cdf0e10cSrcweir#define __com_sun_star_sdb_tools_XTableName_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
32*cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir#ifndef __com_sun_star_container_NoSuchElementException_idl__
36*cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl>
37*cdf0e10cSrcweir#endif
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__
40*cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl>
41*cdf0e10cSrcweir#endif
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir//=============================================================================
44*cdf0e10cSrcweirmodule com {  module sun {  module star {  module sdb { module tools {
45*cdf0e10cSrcweir//=============================================================================
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir//-----------------------------------------------------------------------------
48*cdf0e10cSrcweir/** allows to manipulate table names.
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir    <p>When, in a database application, dealing with table names, there's many degrees
51*cdf0e10cSrcweir    of freedom to deal with. For instance, suppose you want to have the full name of a
52*cdf0e10cSrcweir    table object, as it should be used in a <code>SELECT</code> statement's <code>FROM</code>
53*cdf0e10cSrcweir    part. This requires you to evaluate whether or not the table has a catalog and/or schema
54*cdf0e10cSrcweir    name, to combine the catalog, the schema, and the basic table name into one name, respecting
55*cdf0e10cSrcweir    the database's quoting character, and the order in which all those parts should be combined.
56*cdf0e10cSrcweir    Additionally, you have to respect the client-side settings which tell OpenOffice.org
57*cdf0e10cSrcweir    to use or not use catalogs and schemas in <code>SELECT</code> at all.</p>
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir    <p>The <type>XTableName</type> interface eases this and other, similar tasks around table
60*cdf0e10cSrcweir    names.</p>
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir    <p>The component itself does not have life-time control mechanimns, i.e. you
63*cdf0e10cSrcweir    cannot explicitly dispose it (<member scope="com::sun::star::lang">XComponent::dispose</member>),
64*cdf0e10cSrcweir    and you cannot be notified when it dies.<br/>
65*cdf0e10cSrcweir    However, if your try to access any of its methods or attributes, after the
66*cdf0e10cSrcweir    connection which was used to create it was closed, a <type scope="com::sun::star::lang">DisposedException</type>
67*cdf0e10cSrcweir    will be thrown.</p>
68*cdf0e10cSrcweir
69*cdf0e10cSrcweir    @see XConnectionTools
70*cdf0e10cSrcweir    @see com::sun::star::sdbc::XDatabaseMetaData
71*cdf0e10cSrcweir    @see com::sun::star::sdb::DataSource::Settings
72*cdf0e10cSrcweir
73*cdf0e10cSrcweir    @since OOo 2.0.4
74*cdf0e10cSrcweir*/
75*cdf0e10cSrcweirpublished interface XTableName
76*cdf0e10cSrcweir{
77*cdf0e10cSrcweir    /** denotes the name of the catalog which the table is a part of
78*cdf0e10cSrcweir    */
79*cdf0e10cSrcweir    [attribute] string  CatalogName;
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir    /** denotes the name of the schema which the table is a part of
82*cdf0e10cSrcweir    */
83*cdf0e10cSrcweir    [attribute] string  SchemaName;
84*cdf0e10cSrcweir
85*cdf0e10cSrcweir    /** denotes the mere, unqualified table name, excluding any catalog and
86*cdf0e10cSrcweir        schema.
87*cdf0e10cSrcweir    */
88*cdf0e10cSrcweir    [attribute] string  TableName;
89*cdf0e10cSrcweir
90*cdf0e10cSrcweir    /** returns the composed table name, including the catalog and schema name,
91*cdf0e10cSrcweir        respecting the databases's quoting requirements, plus
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir        @param Type
94*cdf0e10cSrcweir            the type of name composition to be used.
95*cdf0e10cSrcweir
96*cdf0e10cSrcweir        @param Quote
97*cdf0e10cSrcweir            specifies whether the single parts of the table name should be quoted
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir        @see CompositionType
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir        @throws com::sun::star::IllegalArgumentException
102*cdf0e10cSrcweir            if the given <arg>Type</arg> does not denote a valid <type>CompositionType</type>
103*cdf0e10cSrcweir    */
104*cdf0e10cSrcweir    string  getComposedName( [in] long Type, [in] boolean Quote )
105*cdf0e10cSrcweir        raises ( com::sun::star::lang::IllegalArgumentException );
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir    /** sets a new composed table name
109*cdf0e10cSrcweir        @param ComposedName
110*cdf0e10cSrcweir            specifies the composed table name
111*cdf0e10cSrcweir        @param Type
112*cdf0e10cSrcweir            specifies the composition type which was used to create the composed table name
113*cdf0e10cSrcweir    */
114*cdf0e10cSrcweir    void    setComposedName( [in] string ComposedName, [in] long Type );
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir    /** represents the table name in a form to be used in a <code>SELECT</code> statement.
117*cdf0e10cSrcweir
118*cdf0e10cSrcweir        <p>On a per-data-source basis, OpenOffice.org allows to override database meta
119*cdf0e10cSrcweir        data information in that you can specify to not use catalog and or schema names
120*cdf0e10cSrcweir        in <code>SELECT</code> statements. Using this attribute, you can generate a table
121*cdf0e10cSrcweir        name which respects those settings.</p>
122*cdf0e10cSrcweir
123*cdf0e10cSrcweir        @see com::sun::star::sdb::DataSource::Settings
124*cdf0e10cSrcweir    */
125*cdf0e10cSrcweir    [attribute, readonly]   string  NameForSelect;
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir    /** is the <type scope="com::sun::star::sdb">Table</type> object specified
128*cdf0e10cSrcweir        by the current name.
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir        <p>Retrieving this attribute is equivalent to obtaining the tables
131*cdf0e10cSrcweir        container from the connection (via <type scope="com::sun::star::sdbcx">XTablesSupplier</type>),
132*cdf0e10cSrcweir        and calling its <member scope="com::sun::star::container">XNameAccess::getByName</member>
133*cdf0e10cSrcweir        method with the ComposedName.</p>
134*cdf0e10cSrcweir
135*cdf0e10cSrcweir        @throws com::sun::star::container::NoSuchElementException
136*cdf0e10cSrcweir            if, upon getting the attribute value, the current composed table name
137*cdf0e10cSrcweir            represented by this instance does not denote an existing table in the database.
138*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
139*cdf0e10cSrcweir            if you try to set an object which does not denote a table from the underlying
140*cdf0e10cSrcweir            database.
141*cdf0e10cSrcweir    */
142*cdf0e10cSrcweir    [attribute] ::com::sun::star::beans::XPropertySet    Table
143*cdf0e10cSrcweir    {
144*cdf0e10cSrcweir        get raises ( com::sun::star::container::NoSuchElementException );
145*cdf0e10cSrcweir        set raises ( com::sun::star::lang::IllegalArgumentException );
146*cdf0e10cSrcweir    };
147*cdf0e10cSrcweir};
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir//=============================================================================
150*cdf0e10cSrcweir}; }; }; }; };
151*cdf0e10cSrcweir//=============================================================================
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir#endif
154*cdf0e10cSrcweir
155