1d1766043SAndrew Rist/************************************************************** 2d1766043SAndrew Rist * 3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5d1766043SAndrew Rist * distributed with this work for additional information 6d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10d1766043SAndrew Rist * 11d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12d1766043SAndrew Rist * 13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14d1766043SAndrew Rist * software distributed under the License is distributed on an 15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17d1766043SAndrew Rist * specific language governing permissions and limitations 18d1766043SAndrew Rist * under the License. 19d1766043SAndrew Rist * 20d1766043SAndrew Rist *************************************************************/ 21d1766043SAndrew Rist 22d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_sdb_tools_XConnectionTools_idl__ 25cdf0e10cSrcweir#define __com_sun_star_sdb_tools_XConnectionTools_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 28cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 29cdf0e10cSrcweir#endif 30cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_SQLException_idl__ 31cdf0e10cSrcweir#include <com/sun/star/sdbc/SQLException.idl> 32cdf0e10cSrcweir#endif 33cdf0e10cSrcweir 34cdf0e10cSrcweirmodule com { module sun { module star { 35cdf0e10cSrcweir module container { 36cdf0e10cSrcweir published interface XNameAccess; 37cdf0e10cSrcweir }; 38cdf0e10cSrcweir module lang { 39cdf0e10cSrcweir published interface XComponent; 40cdf0e10cSrcweir }; 41cdf0e10cSrcweir};};}; 42cdf0e10cSrcweir//============================================================================= 43cdf0e10cSrcweirmodule com { module sun { module star { module sdb { 44cdf0e10cSrcweir published interface XSingleSelectQueryComposer; 45cdf0e10cSrcweir module tools { 46cdf0e10cSrcweir//============================================================================= 47cdf0e10cSrcweir 48cdf0e10cSrcweirpublished interface XTableName; 49cdf0e10cSrcweirpublished interface XObjectNames; 50cdf0e10cSrcweirpublished interface XDataSourceMetaData; 51cdf0e10cSrcweir 52cdf0e10cSrcweir//----------------------------------------------------------------------------- 53cdf0e10cSrcweir/** encapsulates various useful functionality around a 54cdf0e10cSrcweir <type scope="com::sun::star::sdb">Connection</type> 55cdf0e10cSrcweir 56cdf0e10cSrcweir <p>Most of the functionality provided here is meaningful only relative to 57cdf0e10cSrcweir a given database connection. For instance, for quoting table names, you need 58cdf0e10cSrcweir the meta data instance of the connection. Thus, the entry point for obtaining 59cdf0e10cSrcweir a <type>XConnectionTools</type> instance is the 60cdf0e10cSrcweir <type scope="com::sun::star::sdb">Connection</type> service.</p> 61cdf0e10cSrcweir 62cdf0e10cSrcweir <p>Note that nearly all functionality provided by this interface is also 63cdf0e10cSrcweir available by other means, it's only provided here for convenience purposes.</p> 64cdf0e10cSrcweir 65*c4dc0a1aSJürgen Schmidt @since OpenOffice 2.0.4 66cdf0e10cSrcweir*/ 67cdf0e10cSrcweirpublished interface XConnectionTools 68cdf0e10cSrcweir{ 69cdf0e10cSrcweir /** creates an instance supporting the <type>XTableName</type> interface, 70cdf0e10cSrcweir which can be used to manipulate table names for various purposes. 71cdf0e10cSrcweir 72cdf0e10cSrcweir <p>The returned object is guanrateed to not be <NULL/>.</p> 73cdf0e10cSrcweir */ 74cdf0e10cSrcweir XTableName createTableName(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** returns an instance supporting the <type>XObjectNames</type> interface, 77cdf0e10cSrcweir which provides access to functionality around table and query names. 78cdf0e10cSrcweir 79cdf0e10cSrcweir <p>The returned object is guanrateed to not be <NULL/>.</p> 80cdf0e10cSrcweir */ 81cdf0e10cSrcweir XObjectNames getObjectNames(); 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** provides access to the application-level data source meta data 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir XDataSourceMetaData 86cdf0e10cSrcweir getDataSourceMetaData(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir /** get fields for a result set given by a "command descriptor" 89cdf0e10cSrcweir 90cdf0e10cSrcweir <p>A command descriptor here means: 91cdf0e10cSrcweir <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li> 92cdf0e10cSrcweir <li>a string specifying the name of an object relative to the connection</li> 93cdf0e10cSrcweir <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type 94cdf0e10cSrcweir of the object</type></li> 95cdf0e10cSrcweir </ul> 96cdf0e10cSrcweir </p> 97cdf0e10cSrcweir 98cdf0e10cSrcweir @param commandType 99cdf0e10cSrcweir the type of the object 100cdf0e10cSrcweir 101cdf0e10cSrcweir @param command 102cdf0e10cSrcweir the object. This may be a table name, a query name, or an SQL statement, depending on the value 103cdf0e10cSrcweir of <arg>_nCommandType</arg> 104cdf0e10cSrcweir 105cdf0e10cSrcweir @param _rxCollectionOner 106cdf0e10cSrcweir If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned 107cdf0e10cSrcweir by this function here is a temporary object. It is kept alive by another object, which is to be 108cdf0e10cSrcweir created temporarily, too. To ensure that the fields you get are valid as long as you need them, 109cdf0e10cSrcweir the owner which controls their life time is transfered to this parameter upon return.<br/> 110cdf0e10cSrcweir 111cdf0e10cSrcweir Your fields live as long as this component lives.<br/> 112cdf0e10cSrcweir 113cdf0e10cSrcweir Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore. 114cdf0e10cSrcweir It depends on the connection's implementation if this is necessary, but the is no guarantee, so to 115cdf0e10cSrcweir be on the safe side with respect to resource leaks, you should dispose the component. 116cdf0e10cSrcweir 117cdf0e10cSrcweir @return 118cdf0e10cSrcweir the container of the columns (aka fields) of the object 119cdf0e10cSrcweir */ 120cdf0e10cSrcweir ::com::sun::star::container::XNameAccess getFieldsByCommandDescriptor( [in] long commandType, 121cdf0e10cSrcweir [in] string command, 122cdf0e10cSrcweir [out] ::com::sun::star::lang::XComponent keepFieldsAlive 123cdf0e10cSrcweir ) raises( com::sun::star::sdbc::SQLException ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir /** get the composer initialized with a command and command type. 126cdf0e10cSrcweir @param commandType 127cdf0e10cSrcweir the type of the object 128cdf0e10cSrcweir 129cdf0e10cSrcweir @param command 130cdf0e10cSrcweir the object. This may be a table name, a query name, or an SQL statement, depending on the value 131cdf0e10cSrcweir of <arg>_nCommandType</arg> 132cdf0e10cSrcweir @return 133cdf0e10cSrcweir the composer filled with command and command type. 134cdf0e10cSrcweir */ 135cdf0e10cSrcweir ::com::sun::star::sdb::XSingleSelectQueryComposer getComposer([in] long commandType,[in] string command); 136cdf0e10cSrcweir}; 137cdf0e10cSrcweir 138cdf0e10cSrcweir//============================================================================= 139cdf0e10cSrcweir}; }; }; }; }; 140cdf0e10cSrcweir//============================================================================= 141cdf0e10cSrcweir 142cdf0e10cSrcweir#endif 143