1*d1766043SAndrew Rist/************************************************************** 2*d1766043SAndrew Rist * 3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d1766043SAndrew Rist * distributed with this work for additional information 6*d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9*d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10*d1766043SAndrew Rist * 11*d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d1766043SAndrew Rist * 13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d1766043SAndrew Rist * software distributed under the License is distributed on an 15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17*d1766043SAndrew Rist * specific language governing permissions and limitations 18*d1766043SAndrew Rist * under the License. 19*d1766043SAndrew Rist * 20*d1766043SAndrew Rist *************************************************************/ 21*d1766043SAndrew Rist 22*d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_sdb_tools_XTableName_idl__ 25cdf0e10cSrcweir#define __com_sun_star_sdb_tools_XTableName_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ 28cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl> 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir#ifndef __com_sun_star_container_NoSuchElementException_idl__ 32cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl> 33cdf0e10cSrcweir#endif 34cdf0e10cSrcweir 35cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__ 36cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl> 37cdf0e10cSrcweir#endif 38cdf0e10cSrcweir 39cdf0e10cSrcweir//============================================================================= 40cdf0e10cSrcweirmodule com { module sun { module star { module sdb { module tools { 41cdf0e10cSrcweir//============================================================================= 42cdf0e10cSrcweir 43cdf0e10cSrcweir//----------------------------------------------------------------------------- 44cdf0e10cSrcweir/** allows to manipulate table names. 45cdf0e10cSrcweir 46cdf0e10cSrcweir <p>When, in a database application, dealing with table names, there's many degrees 47cdf0e10cSrcweir of freedom to deal with. For instance, suppose you want to have the full name of a 48cdf0e10cSrcweir table object, as it should be used in a <code>SELECT</code> statement's <code>FROM</code> 49cdf0e10cSrcweir part. This requires you to evaluate whether or not the table has a catalog and/or schema 50cdf0e10cSrcweir name, to combine the catalog, the schema, and the basic table name into one name, respecting 51cdf0e10cSrcweir the database's quoting character, and the order in which all those parts should be combined. 52cdf0e10cSrcweir Additionally, you have to respect the client-side settings which tell OpenOffice.org 53cdf0e10cSrcweir to use or not use catalogs and schemas in <code>SELECT</code> at all.</p> 54cdf0e10cSrcweir 55cdf0e10cSrcweir <p>The <type>XTableName</type> interface eases this and other, similar tasks around table 56cdf0e10cSrcweir names.</p> 57cdf0e10cSrcweir 58cdf0e10cSrcweir <p>The component itself does not have life-time control mechanimns, i.e. you 59cdf0e10cSrcweir cannot explicitly dispose it (<member scope="com::sun::star::lang">XComponent::dispose</member>), 60cdf0e10cSrcweir and you cannot be notified when it dies.<br/> 61cdf0e10cSrcweir However, if your try to access any of its methods or attributes, after the 62cdf0e10cSrcweir connection which was used to create it was closed, a <type scope="com::sun::star::lang">DisposedException</type> 63cdf0e10cSrcweir will be thrown.</p> 64cdf0e10cSrcweir 65cdf0e10cSrcweir @see XConnectionTools 66cdf0e10cSrcweir @see com::sun::star::sdbc::XDatabaseMetaData 67cdf0e10cSrcweir @see com::sun::star::sdb::DataSource::Settings 68cdf0e10cSrcweir 69cdf0e10cSrcweir @since OOo 2.0.4 70cdf0e10cSrcweir*/ 71cdf0e10cSrcweirpublished interface XTableName 72cdf0e10cSrcweir{ 73cdf0e10cSrcweir /** denotes the name of the catalog which the table is a part of 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir [attribute] string CatalogName; 76cdf0e10cSrcweir 77cdf0e10cSrcweir /** denotes the name of the schema which the table is a part of 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir [attribute] string SchemaName; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** denotes the mere, unqualified table name, excluding any catalog and 82cdf0e10cSrcweir schema. 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir [attribute] string TableName; 85cdf0e10cSrcweir 86cdf0e10cSrcweir /** returns the composed table name, including the catalog and schema name, 87cdf0e10cSrcweir respecting the databases's quoting requirements, plus 88cdf0e10cSrcweir 89cdf0e10cSrcweir @param Type 90cdf0e10cSrcweir the type of name composition to be used. 91cdf0e10cSrcweir 92cdf0e10cSrcweir @param Quote 93cdf0e10cSrcweir specifies whether the single parts of the table name should be quoted 94cdf0e10cSrcweir 95cdf0e10cSrcweir @see CompositionType 96cdf0e10cSrcweir 97cdf0e10cSrcweir @throws com::sun::star::IllegalArgumentException 98cdf0e10cSrcweir if the given <arg>Type</arg> does not denote a valid <type>CompositionType</type> 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir string getComposedName( [in] long Type, [in] boolean Quote ) 101cdf0e10cSrcweir raises ( com::sun::star::lang::IllegalArgumentException ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir 104cdf0e10cSrcweir /** sets a new composed table name 105cdf0e10cSrcweir @param ComposedName 106cdf0e10cSrcweir specifies the composed table name 107cdf0e10cSrcweir @param Type 108cdf0e10cSrcweir specifies the composition type which was used to create the composed table name 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir void setComposedName( [in] string ComposedName, [in] long Type ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** represents the table name in a form to be used in a <code>SELECT</code> statement. 113cdf0e10cSrcweir 114cdf0e10cSrcweir <p>On a per-data-source basis, OpenOffice.org allows to override database meta 115cdf0e10cSrcweir data information in that you can specify to not use catalog and or schema names 116cdf0e10cSrcweir in <code>SELECT</code> statements. Using this attribute, you can generate a table 117cdf0e10cSrcweir name which respects those settings.</p> 118cdf0e10cSrcweir 119cdf0e10cSrcweir @see com::sun::star::sdb::DataSource::Settings 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir [attribute, readonly] string NameForSelect; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** is the <type scope="com::sun::star::sdb">Table</type> object specified 124cdf0e10cSrcweir by the current name. 125cdf0e10cSrcweir 126cdf0e10cSrcweir <p>Retrieving this attribute is equivalent to obtaining the tables 127cdf0e10cSrcweir container from the connection (via <type scope="com::sun::star::sdbcx">XTablesSupplier</type>), 128cdf0e10cSrcweir and calling its <member scope="com::sun::star::container">XNameAccess::getByName</member> 129cdf0e10cSrcweir method with the ComposedName.</p> 130cdf0e10cSrcweir 131cdf0e10cSrcweir @throws com::sun::star::container::NoSuchElementException 132cdf0e10cSrcweir if, upon getting the attribute value, the current composed table name 133cdf0e10cSrcweir represented by this instance does not denote an existing table in the database. 134cdf0e10cSrcweir @throws com::sun::star::lang::IllegalArgumentException 135cdf0e10cSrcweir if you try to set an object which does not denote a table from the underlying 136cdf0e10cSrcweir database. 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir [attribute] ::com::sun::star::beans::XPropertySet Table 139cdf0e10cSrcweir { 140cdf0e10cSrcweir get raises ( com::sun::star::container::NoSuchElementException ); 141cdf0e10cSrcweir set raises ( com::sun::star::lang::IllegalArgumentException ); 142cdf0e10cSrcweir }; 143cdf0e10cSrcweir}; 144cdf0e10cSrcweir 145cdf0e10cSrcweir//============================================================================= 146cdf0e10cSrcweir}; }; }; }; }; 147cdf0e10cSrcweir//============================================================================= 148cdf0e10cSrcweir 149cdf0e10cSrcweir#endif 150cdf0e10cSrcweir 151