Files
libreoffice/dbaccess/source/core/api/query.cxx

399 lines
16 KiB
C++
Raw Normal View History

2000-09-18 23:16:46 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:16:46 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:16:46 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 23:16:46 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 23:16:46 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
2000-09-18 23:16:46 +00:00
#include "query.hxx"
2000-10-25 06:32:52 +00:00
#include "dbastrings.hrc"
CWS-TOOLING: integrate CWS evoab2def 2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set 2009-05-22 14:25:51 +0200 fs r272193 : #i10000# 2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically 2009-05-22 14:19:00 +0200 fs r272191 : #i10000# 2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points 2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache 2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces 2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY 2009-05-20 14:02:29 +0200 fs r272125 : implement sorting 2009-05-20 10:10:19 +0200 fs r272107 : #i10000# 2009-05-19 16:02:17 +0200 fs r272089 : #i10000# 2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED 2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code 2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED 2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty 2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes 2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing 2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing 2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings 2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings 2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set 2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet 2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too 2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types 2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types 2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version) 2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree 2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree 2009-05-18 11:40:16 +0200 fs r272008 : #i55701# 2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too 2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface 2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion 2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const 2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const 2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework 2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes 2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data 2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class 2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class 2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC 2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6) 2009-05-06 09:01:30 +0200 fs r271564 : #i101493# 2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
#include <connectivity/warningscontainer.hxx>
#include "HelperCollections.hxx"
#include "core_resource.hxx"
#include "core_resource.hrc"
2000-09-18 23:16:46 +00:00
#include <cppuhelper/queryinterface.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
2000-10-11 10:21:40 +00:00
#include <comphelper/propagg.hxx>
#include <comphelper/sequence.hxx>
2000-09-18 23:16:46 +00:00
/** === begin UNO includes === **/
2000-09-18 23:16:46 +00:00
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
/** === end UNO includes === **/
2001-01-04 13:26:47 +00:00
#include <comphelper/types.hxx>
#include <comphelper/property.hxx>
#include <unotools/sharedunocomponent.hxx>
2001-02-23 14:22:32 +00:00
#include "definitioncolumn.hxx"
2001-08-30 07:07:36 +00:00
2001-08-15 12:05:15 +00:00
#include <functional>
2000-09-18 23:16:46 +00:00
2001-08-30 07:07:36 +00:00
#include "sdbcoretools.hxx"
2001-11-23 10:28:26 +00:00
#include "querycomposer.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include "ContainerMediator.hxx"
2001-08-30 07:07:36 +00:00
2000-09-18 23:16:46 +00:00
using namespace dbaccess;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdb;
2000-09-18 23:16:46 +00:00
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
2000-10-11 10:21:40 +00:00
using namespace ::comphelper;
2000-09-18 23:16:46 +00:00
using namespace ::osl;
using namespace ::cppu;
using namespace ::utl;
2000-09-18 23:16:46 +00:00
//........................................................................
namespace dbaccess
{
//........................................................................
2000-09-18 23:16:46 +00:00
//==========================================================================
2001-08-30 07:07:36 +00:00
//= OQuery
2000-09-18 23:16:46 +00:00
//==========================================================================
2001-08-30 07:07:36 +00:00
DBG_NAME(OQuery)
2000-09-18 23:16:46 +00:00
//--------------------------------------------------------------------------
OQuery::OQuery( const Reference< XPropertySet >& _rxCommandDefinition
,const Reference< XConnection >& _rxConn
,const Reference< XMultiServiceFactory >& _xORB)
:OContentHelper(_xORB,NULL,TContentPtr(new OContentHelper_Impl))
,OQueryDescriptor_Base(m_aMutex,*this)
CWS-TOOLING: integrate CWS dba31e 2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
2008-12-01 12:31:27 +00:00
,ODataSettings(OContentHelper::rBHelper,sal_True)
2000-09-18 23:16:46 +00:00
,m_xCommandDefinition(_rxCommandDefinition)
,m_xConnection(_rxConn)
,m_pColumnMediator( NULL )
,m_pWarnings( NULL )
,m_bCaseSensitiv(sal_True)
,m_eDoingCurrently(NONE)
2000-09-18 23:16:46 +00:00
{
2001-08-30 07:07:36 +00:00
DBG_CTOR(OQuery, NULL);
registerProperties();
ODataSettings::registerPropertiesFor(this);
2000-09-18 23:16:46 +00:00
osl_incrementInterlockedCount(&m_refCount);
2001-08-30 07:07:36 +00:00
DBG_ASSERT(m_xCommandDefinition.is(), "OQuery::OQuery : invalid CommandDefinition object !");
if ( m_xCommandDefinition.is() )
2000-09-18 23:16:46 +00:00
{
try
{
::comphelper::copyProperties(_rxCommandDefinition,this);
}
catch(Exception&)
{
OSL_ENSURE(sal_False, "OQueryDescriptor_Base::OQueryDescriptor_Base: caught an exception!");
}
2000-09-18 23:16:46 +00:00
m_xCommandDefinition->addPropertyChangeListener(::rtl::OUString(), this);
// m_xCommandDefinition->addPropertyChangeListener(PROPERTY_NAME, this);
2001-03-02 09:24:52 +00:00
m_xCommandPropInfo = m_xCommandDefinition->getPropertySetInfo();
2000-09-18 23:16:46 +00:00
}
2001-08-30 07:07:36 +00:00
DBG_ASSERT(m_xConnection.is(), "OQuery::OQuery : invalid connection !");
osl_decrementInterlockedCount(&m_refCount);
2001-08-30 07:07:36 +00:00
}
//--------------------------------------------------------------------------
OQuery::~OQuery()
{
DBG_DTOR(OQuery, NULL);
2000-09-18 23:16:46 +00:00
}
// -----------------------------------------------------------------------------
IMPLEMENT_IMPLEMENTATION_ID(OQuery);
IMPLEMENT_GETTYPES3(OQuery,OQueryDescriptor_Base,ODataSettings,OContentHelper);
IMPLEMENT_FORWARD_XINTERFACE3( OQuery,OContentHelper,OQueryDescriptor_Base,ODataSettings)
2000-09-18 23:16:46 +00:00
//--------------------------------------------------------------------------
void OQuery::rebuildColumns()
2000-09-18 23:16:46 +00:00
{
OSL_PRECOND( getColumnCount() == 0, "OQuery::rebuildColumns: column container should be empty!" );
// the base class' definition of rebuildColumns promised that clearColumns is called before rebuildColumns
2001-08-30 07:07:36 +00:00
try
2000-09-18 23:16:46 +00:00
{
m_pColumnMediator = NULL;
Reference<XColumnsSupplier> xColSup(m_xCommandDefinition,UNO_QUERY);
Reference< XNameAccess > xColumnDefinitions;
if ( xColSup.is() )
{
xColumnDefinitions = xColSup->getColumns();
if ( xColumnDefinitions.is() )
m_pColumnMediator = new OContainerMediator( m_pColumns, xColumnDefinitions, m_xConnection, OContainerMediator::eColumns );
}
2000-09-18 23:16:46 +00:00
2001-08-30 07:07:36 +00:00
// fill the columns with columns from the statement
Reference< XMultiServiceFactory > xFactory( m_xConnection, UNO_QUERY_THROW );
SharedUNOComponent< XSingleSelectQueryComposer, DisposableComponent > xComposer(
Reference< XSingleSelectQueryComposer >( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW ) );
Reference< XNameAccess > xColumns;
Reference< XIndexAccess > xColumnsIndexed;
try
2001-11-23 10:28:26 +00:00
{
xComposer->setQuery( m_sCommand );
Reference< XColumnsSupplier > xCols( xComposer, UNO_QUERY_THROW );
xColumns.set( xCols->getColumns(), UNO_QUERY_THROW );
xColumnsIndexed.set( xColumns, UNO_QUERY_THROW );
}
catch( const SQLException& ) { }
SharedUNOComponent< XPreparedStatement, DisposableComponent > xPreparedStatement;
if ( !xColumns.is() || ( xColumnsIndexed->getCount() == 0 ) )
{ // the QueryComposer could not parse it. Try a lean version.
xPreparedStatement.set( m_xConnection->prepareStatement( m_sCommand ), UNO_QUERY_THROW );
Reference< XResultSetMetaDataSupplier > xResMetaDataSup( xPreparedStatement, UNO_QUERY_THROW );
Reference< XResultSetMetaData > xResultSetMeta( xResMetaDataSup->getMetaData() );
if ( !xResultSetMeta.is() )
2001-11-23 10:28:26 +00:00
{
::rtl::OUString sError( DBA_RES( RID_STR_STATEMENT_WITHOUT_RESULT_SET ) );
::dbtools::throwSQLException( sError, SQL_GENERAL_ERROR, *this );
2001-11-23 10:28:26 +00:00
}
Reference< XDatabaseMetaData > xDBMeta( m_xConnection->getMetaData(), UNO_QUERY_THROW );
::vos::ORef< OSQLColumns > aParseColumns(
::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta,xColumnDefinitions ) );
xColumns = OPrivateColumns::createWithIntrinsicNames(
aParseColumns, xDBMeta->storesMixedCaseQuotedIdentifiers(), *this, m_aMutex );
if ( !xColumns.is() )
throw RuntimeException();
2001-11-23 10:28:26 +00:00
}
Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
const ::rtl::OUString* pIter = aNames.getConstArray();
const ::rtl::OUString* pEnd = pIter + aNames.getLength();
for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i)
{
Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY);
::rtl::OUString sLabel = *pIter;
if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(*pIter) )
{
Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( *pIter ),UNO_QUERY);
xCommandColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
}
OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW );
xChild->setParent( *this );
2001-08-30 07:07:36 +00:00
implAppendColumn( *pIter, pColumn );
Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
m_pColumnMediator->notifyElementCreated( *pIter, xDest );
}
2000-09-18 23:16:46 +00:00
}
2001-08-30 07:07:36 +00:00
catch( const SQLContext& e )
{
if ( m_pWarnings )
m_pWarnings->appendWarning( e );
}
catch( const SQLWarning& e )
{
if ( m_pWarnings )
m_pWarnings->appendWarning( e );
}
catch( const SQLException& e )
{
if ( m_pWarnings )
m_pWarnings->appendWarning( e );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
2001-08-30 07:07:36 +00:00
}
}
2000-09-18 23:16:46 +00:00
// XServiceInfo
//--------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, SERVICE_SDB_QUERYDEFINITION)
2000-09-18 23:16:46 +00:00
// ::com::sun::star::beans::XPropertyChangeListener
//--------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) throw(RuntimeException)
2000-09-18 23:16:46 +00:00
{
sal_Int32 nOwnHandle = -1;
{
MutexGuard aGuard(m_aMutex);
DBG_ASSERT(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(),
2001-08-30 07:07:36 +00:00
"OQuery::propertyChange : where did this call come from ?");
2000-09-18 23:16:46 +00:00
if (m_eDoingCurrently == SETTING_PROPERTIES)
// we're setting the property ourself, so we will do the neccessary notifications later
return;
// forward this to our own member holding a copy of the property value
if (getArrayHelper()->hasPropertyByName(_rSource.PropertyName))
{
Property aOwnProp = getArrayHelper()->getPropertyByName(_rSource.PropertyName);
nOwnHandle = aOwnProp.Handle;
ODataSettings::setFastPropertyValue_NoBroadcast(nOwnHandle, _rSource.NewValue);
2000-09-18 23:16:46 +00:00
// don't use our own setFastPropertyValue_NoBroadcast, this would forward it to the CommandSettings,
// again
// and don't use the "real" setPropertyValue, this is to expensive and not sure to succeed
}
else
{
2001-08-30 07:07:36 +00:00
DBG_ERROR("OQuery::propertyChange : my CommandDefinition has more properties than I do !");
2000-09-18 23:16:46 +00:00
}
}
fire(&nOwnHandle, &_rSource.NewValue, &_rSource.OldValue, 1, sal_False);
}
//--------------------------------------------------------------------------
void SAL_CALL OQuery::disposing( const EventObject& _rSource ) throw (RuntimeException)
2000-09-18 23:16:46 +00:00
{
MutexGuard aGuard(m_aMutex);
(void)_rSource;
2000-09-18 23:16:46 +00:00
DBG_ASSERT(_rSource.Source.get() == Reference< XInterface >(m_xCommandDefinition, UNO_QUERY).get(),
2001-08-30 07:07:36 +00:00
"OQuery::disposing : where did this call come from ?");
2000-09-18 23:16:46 +00:00
m_xCommandDefinition->removePropertyChangeListener(::rtl::OUString(), this);
m_xCommandDefinition = NULL;
}
// XDataDescriptorFactory
//--------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
Reference< XPropertySet > SAL_CALL OQuery::createDataDescriptor( ) throw(RuntimeException)
2000-09-18 23:16:46 +00:00
{
return new OQueryDescriptor(*this);
}
// pseudo-XComponent
//--------------------------------------------------------------------------
void SAL_CALL OQuery::disposing()
2000-09-18 23:16:46 +00:00
{
MutexGuard aGuard(m_aMutex);
if (m_xCommandDefinition.is())
{
m_xCommandDefinition->removePropertyChangeListener(::rtl::OUString(), this);
m_xCommandDefinition = NULL;
}
disposeColumns();
m_pWarnings = NULL;
2000-09-18 23:16:46 +00:00
}
//--------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
void OQuery::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw (Exception)
2000-09-18 23:16:46 +00:00
{
ODataSettings::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
2000-09-18 23:16:46 +00:00
::rtl::OUString sAggPropName;
2001-01-04 13:26:47 +00:00
sal_Int16 nAttr = 0;
2001-03-02 09:24:52 +00:00
if (getInfoHelper().fillPropertyMembersByHandle(&sAggPropName,&nAttr,_nHandle) &&
m_xCommandPropInfo.is() &&
m_xCommandPropInfo->hasPropertyByName(sAggPropName))
2000-09-18 23:16:46 +00:00
{ // the base class holds the property values itself, but we have to forward this to our CommandDefinition
2001-03-02 09:24:52 +00:00
2000-09-18 23:16:46 +00:00
m_eDoingCurrently = SETTING_PROPERTIES;
OAutoActionReset(this);
m_xCommandDefinition->setPropertyValue(sAggPropName, _rValue);
if ( PROPERTY_ID_COMMAND == _nHandle )
// the columns are out of date if we are based on a new statement ....
2001-08-30 07:07:36 +00:00
setColumnsOutOfDate();
2000-09-18 23:16:46 +00:00
}
}
//--------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
Reference< XPropertySetInfo > SAL_CALL OQuery::getPropertySetInfo( ) throw(RuntimeException)
2000-09-18 23:16:46 +00:00
{
return createPropertySetInfo( getInfoHelper() ) ;
}
//------------------------------------------------------------------------------
2001-08-30 07:07:36 +00:00
::cppu::IPropertyArrayHelper& OQuery::getInfoHelper()
2000-09-18 23:16:46 +00:00
{
return *getArrayHelper();
}
//--------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OQuery::createArrayHelper( ) const
{
Sequence< Property > aProps;
// our own props
describeProperties(aProps);
return new ::cppu::OPropertyArrayHelper(aProps);
}
2001-02-23 14:22:32 +00:00
// -----------------------------------------------------------------------------
OColumn* OQuery::createColumn(const ::rtl::OUString& /*_rName*/) const
2001-02-23 14:22:32 +00:00
{
2001-08-30 07:07:36 +00:00
return NULL;
2001-02-23 14:22:32 +00:00
}
// -----------------------------------------------------------------------------
void SAL_CALL OQuery::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException)
{
MutexGuard aGuard(m_aMutex);
Reference<XRename> xRename(m_xCommandDefinition,UNO_QUERY);
OSL_ENSURE(xRename.is(),"No XRename interface!");
if(xRename.is())
xRename->rename(newName);
}
// -----------------------------------------------------------------------------
void OQuery::registerProperties()
{
// the properties which OCommandBase supplies (it has no own registration, as it's not derived from
// a OPropertyStateContainer)
registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND|PropertyAttribute::CONSTRAINED,
&m_sElementName, ::getCppuType(&m_sElementName));
registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
&m_sCommand, ::getCppuType(&m_sCommand));
registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
&m_bEscapeProcessing, ::getBooleanCppuType());
registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
&m_sUpdateTableName, ::getCppuType(&m_sUpdateTableName));
registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
&m_sUpdateSchemaName, ::getCppuType(&m_sUpdateSchemaName));
registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
&m_sUpdateCatalogName, ::getCppuType(&m_sUpdateCatalogName));
registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
&m_aLayoutInformation, ::getCppuType(&m_aLayoutInformation));
}
2001-08-30 07:07:36 +00:00
CWS-TOOLING: integrate CWS dba31d 2008-12-08 16:22:07 +0100 rt r265005 : Remove DOS lineends 2008-12-05 13:56:24 +0100 fs r264906 : #i10000# removed unreachable statement 2008-11-20 11:41:26 +0100 fs r264037 : merged in the fix for #i95865# (it was wrongly committed to CWS dba32a, should have been here) 2008-11-20 11:34:24 +0100 fs r264036 : line ends 2008-11-14 08:44:50 +0100 lla r263665 : #i10000# comparsion between int and uint fixed 2008-11-13 13:31:12 +0100 lla r263641 : #i10000# build problem fixed 2008-11-13 11:20:01 +0100 lla r263625 : #i96130# hard code name of extension 2008-11-12 11:13:41 +0100 fs r263582 : #i96096# when opening a SRB-report fails due to the missing SRB extension, log this as warning only, and proceed with the migration 2008-11-12 11:11:35 +0100 fs r263581 : #i96096# ContentType handling. Now all contents deliver proper results in XContent::getContentType 2008-11-12 11:10:11 +0100 fs r263580 : #i96096# new ctors taking UNO_QUERY_THROW 2008-11-11 10:10:13 +0100 lla r263546 : CWS-TOOLING: rebase CWS dba31d to trunk@263288 (milestone: DEV300:m35) 2008-11-06 15:55:39 +0100 oj r263393 : #i93452# get field from model fallbackis the name 2008-11-06 15:31:47 +0100 oj r263392 : #i93465# remeber location of floating windows 2008-11-06 13:36:24 +0100 oj r263381 : #i93450# check typemap for null 2008-11-06 13:28:49 +0100 oj r263379 : #i93020# empty column list boxes when new relation should be created 2008-11-06 12:33:53 +0100 oj r263377 : #i93012# set border to default : flat 2008-11-06 12:26:54 +0100 oj r263375 : #i74927# do some less calls for odbc 2008-11-06 09:34:01 +0100 oj r263362 : #i93383# grabFocus in suspend to get allmodified cells 2008-11-03 21:01:39 +0100 oj r263308 : #i86739# check if slash can be valid for tables 2008-11-03 14:40:21 +0100 oj r263287 : #i86739# check if slash can be valid for tables 2008-11-03 14:32:17 +0100 oj r263286 : #i95227# column width 2008-11-03 14:27:26 +0100 oj r263285 : link fwe 2008-11-03 14:24:54 +0100 oj r263284 : #i95235# changed to hold no ref only weak 2008-10-31 11:21:48 +0100 oj r262859 : #i93459# set images add menu entry 2008-10-31 09:06:37 +0100 oj r262851 : #i88629# correct fileopen filter for database odb files 2008-10-30 15:01:04 +0100 oj r262828 : #i95229# set filter at the composer 2008-10-29 15:57:41 +0100 oj r262817 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:19 +0100 oj r262816 : #i95235# changed to hold no ref only weak 2008-10-29 15:57:03 +0100 oj r262815 : #i95235# changed to hold no ref only weak 2008-10-29 15:56:15 +0100 oj r262814 : #i95235# filtermanger changed to hold no ref only weak 2008-10-29 10:32:39 +0100 oj r262773 : #i93474# use correct table name 2008-10-28 13:49:33 +0100 lla r262744 : #i95524# make an Invalidate and refresh on Tables 2008-10-28 10:45:02 +0100 fs r262707 : line ends 2008-10-28 10:34:42 +0100 fs r262706 : #i95522# don't expect the component to live in a TopWindow 2008-10-28 08:30:40 +0100 lla r262696 : #i93176# set preview mode on view 2008-10-28 07:56:57 +0100 oj r262694 : merge cvs svn 2008-10-27 14:13:51 +0100 oj r262673 : #i94129# use dummy data 2008-10-27 12:38:45 +0100 fs r262669 : #i94125# rework ScrollColumns 2008-10-23 15:53:57 +0200 oj r262624 : #i94568# do not load the embeddedobj just copy the storage 2008-10-23 14:39:14 +0200 oj r262622 : #i94129# handle chart correctly 2008-10-22 10:51:19 +0200 lla r262582 : #i94115# problem with left walk chart shape fixed 2008-10-22 07:47:48 +0200 oj r262576 : #i94455# rename now do not use remove insert 2008-10-22 07:47:27 +0200 oj r262575 : #i94455# rename now do not use remove insert 2008-10-21 12:46:26 +0200 lla r262567 : #i93845# extra check if default schema doesn't exists, fix assertion
2008-12-09 07:25:38 +00:00
// -----------------------------------------------------------------------------
::rtl::OUString OQuery::determineContentType() const
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseQuery" ) );
}
2001-07-16 06:38:40 +00:00
// -----------------------------------------------------------------------------
//........................................................................
} // namespace dbaccess
//........................................................................
2000-09-18 23:16:46 +00:00