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#ifndef __com_sun_star_report_XDatabaseDataProvider_idl__ 28*cdf0e10cSrcweir#define __com_sun_star_report_XDatabaseDataProvider_idl__ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir#ifndef __com_sun_star_container_NoSuchElementException_idl__ 31*cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl> 32*cdf0e10cSrcweir#endif 33*cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl> 34*cdf0e10cSrcweir#include <com/sun/star/beans/UnknownPropertyException.idl> 35*cdf0e10cSrcweir#include <com/sun/star/lang/XInitialization.idl> 36*cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl> 37*cdf0e10cSrcweir#include <com/sun/star/sdbc/XConnection.idl> 38*cdf0e10cSrcweir#include <com/sun/star/sdbc/XParameters.idl> 39*cdf0e10cSrcweir#include <com/sun/star/sdbc/XRowSet.idl> 40*cdf0e10cSrcweir#include <com/sun/star/chart2/data/XDataProvider.idl> 41*cdf0e10cSrcweir#include <com/sun/star/chart2/data/XRangeXMLConversion.idl> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir//============================================================================= 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir module com { module sun { module star { module chart2 { module data { 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir//============================================================================= 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir/** identifies a <type>XDataProvider</type> for result sets. 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir @see XDataProvider 52*cdf0e10cSrcweir @see DataProvider 53*cdf0e10cSrcweir */ 54*cdf0e10cSrcweirinterface XDatabaseDataProvider 55*cdf0e10cSrcweir{ 56*cdf0e10cSrcweir /** For accessing data a component provides for being used by 57*cdf0e10cSrcweir charts. 58*cdf0e10cSrcweir */ 59*cdf0e10cSrcweir interface XDataProvider; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir /** allows you to convert the ranges a data provider deals with 62*cdf0e10cSrcweir internally into valid XML. 63*cdf0e10cSrcweir */ 64*cdf0e10cSrcweir interface XRangeXMLConversion; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir /** allows access to the properties of the instance. 67*cdf0e10cSrcweir */ 68*cdf0e10cSrcweir interface com::sun::star::lang::XInitialization; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir /** allows life-time control of the database data provider. 71*cdf0e10cSrcweir */ 72*cdf0e10cSrcweir interface com::sun::star::lang::XComponent; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir /** allows access to the properties of the instance. 75*cdf0e10cSrcweir */ 76*cdf0e10cSrcweir interface com::sun::star::beans::XPropertySet; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir interface com::sun::star::sdbc::XParameters; 79*cdf0e10cSrcweir interface com::sun::star::sdbc::XRowSet; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir /** is used for subreports and contains the names of columns of the parent report. 82*cdf0e10cSrcweir <p> These columns are typically the foreign key fields of the parent report. 83*cdf0e10cSrcweir The values of theses columns are used to identify the data for the subreport. 84*cdf0e10cSrcweir Each time the parent report changes it's current row, the subreport requeries 85*cdf0e10cSrcweir it's data based on the values of the master fields.</p> 86*cdf0e10cSrcweir <p>If the report is no sub report (e.g. it's parent is not a report itself), this 87*cdf0e10cSrcweir property is not evaluated.</p> 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir */ 90*cdf0e10cSrcweir [attribute,bound] sequence<string> MasterFields; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir /**is used for subreports and contains the names of the columns of the subreport 93*cdf0e10cSrcweir which are related to the master fields of the parent report. 94*cdf0e10cSrcweir <p>Entries in this sequence can either denote column names in the sub report, 95*cdf0e10cSrcweir or paramater names.<br/> 96*cdf0e10cSrcweir For instance, you could base the report on the SQL statement 97*cdf0e10cSrcweir <code>SELECT * FROM invoices WHERE cust_ref = :cid</code>, and add <code>cid</code> 98*cdf0e10cSrcweir to the DetailFields property. In this case, the parameter will be filled from 99*cdf0e10cSrcweir the corresponding master field.<br/> 100*cdf0e10cSrcweir Alternatively, you could simply base your report on the table <code>invoices</code>, 101*cdf0e10cSrcweir and add the column name <code>cust_ref</code> to the DetailFields. In this case, 102*cdf0e10cSrcweir and implicit filter clause <code>WHERE cust_ref = :<new_param_name></code> will 103*cdf0e10cSrcweir be created, and the artificial parameter will be filled from the corresponding 104*cdf0e10cSrcweir master field.<br/> 105*cdf0e10cSrcweir If a string in this property denotes both a column name and a parameter name, it 106*cdf0e10cSrcweir is undefined which way it is interpreted, but implementations of the service are required 107*cdf0e10cSrcweir to either decide for the paramter or the column, and proceed as usual. 108*cdf0e10cSrcweir </p> 109*cdf0e10cSrcweir <p>The columns specified herein typically represent a part of the primary key 110*cdf0e10cSrcweir fields or their aliases of the detail report.</p> 111*cdf0e10cSrcweir <p>If the report is no sub report (e.g. it's parent is not a report itself), this 112*cdf0e10cSrcweir property is not evaluated.</p> 113*cdf0e10cSrcweir * 114*cdf0e10cSrcweir */ 115*cdf0e10cSrcweir [attribute,bound] sequence<string> DetailFields; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /** is the command which should be executed, the type of command depends 118*cdf0e10cSrcweir on the CommandType. 119*cdf0e10cSrcweir <p>In case of a <member>CommandType</member> of <member>CommandType::COMMAND</member>, 120*cdf0e10cSrcweir means in case the <member>Command</member> specifies an SQL statement, the inherited 121*cdf0e10cSrcweir <member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member> 122*cdf0e10cSrcweir becomes relevant:<br/> 123*cdf0e10cSrcweir It then can be to used to specify whether the SQL statement should be analyzed on the 124*cdf0e10cSrcweir client side before sending it to the database server.<br/> 125*cdf0e10cSrcweir The default value for <member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member> 126*cdf0e10cSrcweir is <TRUE/>. By switching it to <FALSE/>, you can pass backend-specific SQL statements, 127*cdf0e10cSrcweir which are not standard SQL, to your database.</p> 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir @see com::sun::star::sdb::CommandType 131*cdf0e10cSrcweir */ 132*cdf0e10cSrcweir [attribute,bound] string Command; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir /** specifies the type of the command to be executed to retrieve a result set. 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir <p><member>Command</member> needs to be interpreted depending on the value of this property.</p> 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir <p>This property is only meaningfull together with the <member>Command</member> 139*cdf0e10cSrcweir property, thus either <em>both</em> or <em>none</em> of them are present.</p> 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir @see com::sun::star::sdb::CommandType 142*cdf0e10cSrcweir */ 143*cdf0e10cSrcweir [attribute,bound] long CommandType; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /** specifies an addtional filter to optinally use. 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir <p>The Filter string has to form a SQL WHERE-clause, <em>without</em> the WHERE-string itself.</p> 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir <p>If a <member>DataSourceName</member>, <member>Command</member> and <member>CommandType</member> 150*cdf0e10cSrcweir are specified, a <type>RowSet</type> can be created with this information. If the results provided by the 151*cdf0e10cSrcweir row set are to be additionally filtered, the Filter property can be used.</p> 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir <p>Note that the Filter property does not make sense if a <member>ResultSet</member> has been specified 154*cdf0e10cSrcweir in the DataAccessDescriptor.</p> 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir @see com::sun::star::sdb::RowSet 157*cdf0e10cSrcweir @see ResultSet 158*cdf0e10cSrcweir */ 159*cdf0e10cSrcweir [attribute,bound] string Filter; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir /** indicates whether the filter should be applied or not, 162*cdf0e10cSrcweir default is <FALSE/>. 163*cdf0e10cSrcweir */ 164*cdf0e10cSrcweir [attribute,bound] boolean ApplyFilter; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir /** additional having clause for the row set 167*cdf0e10cSrcweir */ 168*cdf0e10cSrcweir [attribute,bound] string HavingClause 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir set raises (com::sun::star::beans::UnknownPropertyException); 171*cdf0e10cSrcweir }; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir /** additional group by for the row set 174*cdf0e10cSrcweir */ 175*cdf0e10cSrcweir [attribute,bound] string GroupBy 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir set raises (com::sun::star::beans::UnknownPropertyException); 178*cdf0e10cSrcweir }; 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir /** is a additional sort order definition for a rowset. 181*cdf0e10cSrcweir */ 182*cdf0e10cSrcweir [attribute,bound] string Order; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir /** specifies if the <member>Command</member> should be analyzed on the client side before sending it 185*cdf0e10cSrcweir to the database server. 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir <p>The default value of this property is <TRUE/>. By switching it to <FALSE/>, you can pass 188*cdf0e10cSrcweir backend-specific SQL statements, which are not standard SQL, to your database.</p> 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir <p>This property is usually present together with the <member>Command</member> and 191*cdf0e10cSrcweir <member>CommandType</member> properties, and is evaluated if and only if <member>CommandType</member> 192*cdf0e10cSrcweir equals <member>CommandType::COMMAND</member>.</p> 193*cdf0e10cSrcweir */ 194*cdf0e10cSrcweir [attribute,bound] boolean EscapeProcessing; 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir /** specifies the maximal count of rows which should be fetched. 197*cdf0e10cSrcweir <p>A value of zero implies that no limit exists.</p> 198*cdf0e10cSrcweir */ 199*cdf0e10cSrcweir [attribute,bound] long RowLimit; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir /** specifies the active connection which is used to create the resulting report. 202*cdf0e10cSrcweir */ 203*cdf0e10cSrcweir [attribute,bound] com::sun::star::sdbc::XConnection ActiveConnection 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir set raises (com::sun::star::lang::IllegalArgumentException); 206*cdf0e10cSrcweir }; 207*cdf0e10cSrcweir /** is the name of the datasource to use, this could be a named datasource 208*cdf0e10cSrcweir or the URL of a data access component. 209*cdf0e10cSrcweir */ 210*cdf0e10cSrcweir [attribute,bound] string DataSourceName; 211*cdf0e10cSrcweir}; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweirservice DatabaseDataProvider : XDatabaseDataProvider 214*cdf0e10cSrcweir{ 215*cdf0e10cSrcweir createWithConnection([in] com::sun::star::sdbc::XConnection connection); 216*cdf0e10cSrcweir}; 217*cdf0e10cSrcweir//============================================================================= 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir }; }; }; }; }; 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir/*============================================================================= 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir=============================================================================*/ 224*cdf0e10cSrcweir#endif 225