LibreOffice Module connectivity (master) 1
|
#include <parameters.hxx>
Classes | |
struct | ParameterMetaData |
meta data about an inner parameter More... | |
Public Types | |
enum class | ParameterClassification { LinkedByParamName , LinkedByColumnName , FilledExternally } |
classifies the origin of the data to fill a parameter More... | |
Public Member Functions | |
ParameterManager (::osl::Mutex &_rMutex, const css::uno::Reference< css::uno::XComponentContext > &_rxContext) | |
ctor More... | |
void | initialize (const css::uno::Reference< css::beans::XPropertySet > &_rxComponent, const css::uno::Reference< css::uno::XAggregation > &_rxComponentAggregate) |
late ctor More... | |
void | dispose () |
makes the object forgetting the references to the database component More... | |
void | clearAllParameterInformation () |
clears the instance data More... | |
bool | isUpToDate () const |
checks whether the parameter information is up-to-date More... | |
void | updateParameterInfo (FilterManager &_rFilterManager) |
updates all parameter information represented by the instance More... | |
bool | fillParameterValues (const css::uno::Reference< css::task::XInteractionHandler > &_rxCompletionHandler, ::osl::ResettableMutexGuard &_rClearForNotifies) |
fills parameter values, as extensive as possible More... | |
void | setAllParametersNull () |
sets all parameter values to null (via <member>XParameters::setNull</member>) More... | |
void | resetParameterValues () |
resets all detail columns which are, via a parameter, linked to a master column, to the value of this master column. More... | |
void | addParameterListener (const css::uno::Reference< css::form::XDatabaseParameterListener > &_rxListener) |
adds the given listener to the list of parameter listeners More... | |
void | removeParameterListener (const css::uno::Reference< css::form::XDatabaseParameterListener > &_rxListener) |
removes the given listener from the list of parameter listeners More... | |
void | setNull (sal_Int32 _nIndex, sal_Int32 sqlType) |
void | setObjectNull (sal_Int32 _nIndex, sal_Int32 sqlType, const OUString &typeName) |
void | setBoolean (sal_Int32 _nIndex, bool x) |
void | setByte (sal_Int32 _nIndex, sal_Int8 x) |
void | setShort (sal_Int32 _nIndex, sal_Int16 x) |
void | setInt (sal_Int32 _nIndex, sal_Int32 x) |
void | setLong (sal_Int32 _nIndex, sal_Int64 x) |
void | setFloat (sal_Int32 _nIndex, float x) |
void | setDouble (sal_Int32 _nIndex, double x) |
void | setString (sal_Int32 _nIndex, const OUString &x) |
void | setBytes (sal_Int32 _nIndex, const css::uno::Sequence< sal_Int8 > &x) |
void | setDate (sal_Int32 _nIndex, const css::util::Date &x) |
void | setTime (sal_Int32 _nIndex, const css::util::Time &x) |
void | setTimestamp (sal_Int32 _nIndex, const css::util::DateTime &x) |
void | setBinaryStream (sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) |
void | setCharacterStream (sal_Int32 _nIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) |
void | setObject (sal_Int32 _nIndex, const css::uno::Any &x) |
void | setObjectWithInfo (sal_Int32 _nIndex, const css::uno::Any &x, sal_Int32 targetSqlType, sal_Int32 scale) |
void | setRef (sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XRef > &x) |
void | setBlob (sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XBlob > &x) |
void | setClob (sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XClob > &x) |
void | setArray (sal_Int32 _nIndex, const css::uno::Reference< css::sdbc::XArray > &x) |
void | clearParameters () |
Private Types | |
typedef ::std::map< OUString, ParameterMetaData > | ParameterInformation |
Private Member Functions | |
bool | isAlive () const |
checks whether the object is already initialized, and not yet disposed More... | |
OUString | createFilterConditionFromColumnLink (const OUString &_rMasterColumn, const css::uno::Reference< css::beans::XPropertySet > &xDetailColumn, OUString &_rNewParamName) |
creates a filter expression from a master-detail link where the detail denotes a column name More... | |
bool | initializeComposerByComponent (const css::uno::Reference< css::beans::XPropertySet > &_rxComponent) |
initializes our query composer, and the collection of inner parameter columns More... | |
void | collectInnerParameters (bool _bSecondRun) |
collects initial meta information about inner parameters (i.e. More... | |
void | analyzeFieldLinks (FilterManager &_rFilterManager, bool &_rColumnsInLinkDetails) |
analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields More... | |
void | classifyLinks (const css::uno::Reference< css::container::XNameAccess > &_rxParentColumns, const css::uno::Reference< css::container::XNameAccess > &_rxColumns, ::std::vector< OUString > &_out_rAdditionalFilterComponents, ::std::vector< OUString > &_out_rAdditionalHavingComponents) |
classifies the link pairs More... | |
void | createOuterParameters () |
finalizes our <member>m_pOuterParameters</member> so that it can be used for external parameter listeners More... | |
void | fillLinkedParameters (const css::uno::Reference< css::container::XNameAccess > &_rxParentColumns) |
fills in the parameters values which result from the master-detail relationship between the database component and its parent More... | |
bool | completeParameters (const css::uno::Reference< css::task::XInteractionHandler > &_rxCompletionHandler, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection) |
completes all missing parameters via an interaction handler More... | |
bool | consultParameterListeners (::osl::ResettableMutexGuard &_rClearForNotifies) |
asks the parameter listeners to fill in final values More... | |
void | externalParameterVisited (sal_Int32 _nIndex) |
mark an externally filled parameter as visited More... | |
bool | getParentColumns (css::uno::Reference< css::container::XNameAccess > &_out_rxParentColumns, bool _bFromComposer) |
retrieves the columns of the parent database component More... | |
bool | getColumns (css::uno::Reference< css::container::XNameAccess > &_rxColumns, bool _bFromComposer) |
retrieves the columns of our database component More... | |
void | getConnection (css::uno::Reference< css::sdbc::XConnection > &_rxConnection) |
retrieves the active connection of the database component More... | |
void | cacheConnectionInfo () |
caches some info about the connection of our database component More... | |
ParameterManager (const ParameterManager &)=delete | |
ParameterManager & | operator= (const ParameterManager &)=delete |
Private Attributes | |
::osl::Mutex & | m_rMutex |
::comphelper::OInterfaceContainerHelper3< css::form::XDatabaseParameterListener > | m_aParameterListeners |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
css::uno::WeakReference< css::beans::XPropertySet > | m_xComponent |
css::uno::Reference< css::uno::XAggregation > | m_xAggregatedRowSet |
css::uno::Reference< css::sdbc::XParameters > | m_xInnerParamUpdate |
SharedQueryComposer | m_xComposer |
SharedQueryComposer | m_xParentComposer |
css::uno::Reference< css::container::XIndexAccess > | m_xInnerParamColumns |
::dbtools::param::ParametersContainerRef | m_pOuterParameters |
sal_Int32 | m_nInnerCount |
ParameterInformation | m_aParameterInformation |
std::vector< OUString > | m_aMasterFields |
std::vector< OUString > | m_aDetailFields |
OUString | m_sIdentifierQuoteString |
OUString | m_sSpecialCharacters |
css::uno::Reference< css::sdbc::XDatabaseMetaData > | m_xConnectionMetadata |
::std::vector< bool > | m_aParametersVisited |
bool | m_bUpToDate |
Definition at line 59 of file parameters.hxx.
|
private |
Definition at line 98 of file parameters.hxx.
|
strong |
classifies the origin of the data to fill a parameter
Definition at line 63 of file parameters.hxx.
|
explicit |
ctor
References dispose().
|
privatedelete |
void dbtools::ParameterManager::addParameterListener | ( | const css::uno::Reference< css::form::XDatabaseParameterListener > & | _rxListener | ) |
adds the given listener to the list of parameter listeners
Definition at line 848 of file parameters.cxx.
|
private |
analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields
_rFilterManager | the filter manager of the database component |
_rColumnsInLinkDetails | will be set to <TRUE> if and only if there were link pairs where the detail field denoted a column name of our database component |
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 340 of file parameters.cxx.
References Exception, isAlive(), PROPERTY_ID_DETAILFIELDS, PROPERTY_ID_MASTERFIELDS, comphelper::sequenceToContainer(), dbtools::FilterManager::setFilterComponent(), and TOOLS_WARN_EXCEPTION.
|
private |
caches some info about the connection of our database component
Definition at line 768 of file parameters.cxx.
References Exception, dbtools::getConnection(), and TOOLS_WARN_EXCEPTION.
|
private |
classifies the link pairs
_rxParentColumns | the columns of the parent database component |
_rxColumns | the columns of our own database component |
_out_rAdditionalFilterComponents | the additional filter components which are required for master-detail relationships where the detail part denotes a column name. In such a case, an additional filter needs to be created, containing a new parameter. |
_out_rAdditionalHavingComponents | the additional having clause components which are required for master-detail relationships where the detail part denotes a column name. In such a case, an additional filter needs to be created, containing a new parameter. |
@precond <member>m_aMasterFields</member> and <member>m_aDetailFields</member> have the same length
Definition at line 241 of file parameters.cxx.
References dbtools::isAggregateColumn(), and SAL_WARN_IF.
void dbtools::ParameterManager::clearAllParameterInformation | ( | ) |
clears the instance data
Definition at line 95 of file parameters.cxx.
void dbtools::ParameterManager::clearParameters | ( | ) |
Definition at line 1197 of file parameters.cxx.
|
private |
collects initial meta information about inner parameters (i.e.
it initially fills <member>m_aParameterInformation</member>).
_bSecondRun | if <TRUE>, this is the second run, because we ourself previously extended the filter of the RowSet |
@precond <member>m_xInnerParamColumns</member> is not <NULL>
Definition at line 154 of file parameters.cxx.
References Exception, i, PROPERTY_ID_NAME, sName, and TOOLS_WARN_EXCEPTION.
|
private |
completes all missing parameters via an interaction handler
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 636 of file parameters.cxx.
References Any, Exception, i, isAlive(), PROPERTY_ID_NAME, PROPERTY_ID_VALUE, sName, and TOOLS_WARN_EXCEPTION.
|
private |
asks the parameter listeners to fill in final values
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 698 of file parameters.cxx.
References aEvent, comphelper::OInterfaceIteratorHelper3< class ListenerT >::hasMoreElements(), and comphelper::OInterfaceIteratorHelper3< class ListenerT >::next().
|
private |
creates a filter expression from a master-detail link where the detail denotes a column name
Definition at line 206 of file parameters.cxx.
References dbtools::convertName2SQLName(), dbtools::quoteName(), and dbtools::quoteTableName().
|
private |
finalizes our <member>m_pOuterParameters</member> so that it can be used for external parameter listeners
@precond <member>m_pOuterParameters</member> is <NULL> @precond <member>m_xInnerParamUpdate</member> is not <NULL>
Definition at line 430 of file parameters.cxx.
References aIndex, and o3tl::make_unsigned().
void dbtools::ParameterManager::dispose | ( | void | ) |
makes the object forgetting the references to the database component
Definition at line 83 of file parameters.cxx.
|
private |
mark an externally filled parameter as visited
Definition at line 944 of file parameters.cxx.
References i, and o3tl::make_unsigned().
|
private |
fills in the parameters values which result from the master-detail relationship between the database component and its parent
_rxParentColumns | the columns of the parameter database component. Must not be <NULL> @precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE> |
Definition at line 553 of file parameters.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, i, isAlive(), PROPERTY_ID_SCALE, PROPERTY_ID_TYPE, PROPERTY_ID_VALUE, and SAL_WARN.
bool dbtools::ParameterManager::fillParameterValues | ( | const css::uno::Reference< css::task::XInteractionHandler > & | _rxCompletionHandler, |
::osl::ResettableMutexGuard & | _rClearForNotifies | ||
) |
fills parameter values, as extensive as possible
In particular, all values which can be filled from the master-detail relationship of between our database component and its parent are filled in.
_rxCompletionHandler | an interaction handler which should be used to fill all parameters which cannot be filled by other means. May be <NULL> |
_rClearForNotifies | the mutex guard to be (temporarily) cleared for notifications |
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 721 of file parameters.cxx.
References dbtools::getConnection(), and isAlive().
|
private |
retrieves the columns of our database component
_bFromComposer | if <TRUE>, the columns are obtained from the composer, else from the living database component itself |
Definition at line 791 of file parameters.cxx.
|
private |
retrieves the active connection of the database component
Definition at line 747 of file parameters.cxx.
References Exception, isAlive(), PROPERTY_ID_ACTIVE_CONNECTION, and SAL_WARN.
|
private |
retrieves the columns of the parent database component
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 808 of file parameters.cxx.
References Exception, dbtools::getCurrentSettingsComposer(), isAlive(), m_xContext, and TOOLS_WARN_EXCEPTION.
void dbtools::ParameterManager::initialize | ( | const css::uno::Reference< css::beans::XPropertySet > & | _rxComponent, |
const css::uno::Reference< css::uno::XAggregation > & | _rxComponentAggregate | ||
) |
late ctor
Definition at line 69 of file parameters.cxx.
|
private |
initializes our query composer, and the collection of inner parameter columns
_rxComponent | the database component to initialize from. Must not be <NULL> |
@postcond if and only if <TRUE> is returned, then <member>m_xInnerParamColumns</member> contains the collection of inner parameters
Definition at line 124 of file parameters.cxx.
References dbtools::getCurrentSettingsComposer(), and m_xContext.
|
inlineprivate |
checks whether the object is already initialized, and not yet disposed
Definition at line 242 of file parameters.hxx.
|
inline |
checks whether the parameter information is up-to-date
Definition at line 157 of file parameters.hxx.
|
privatedelete |
void dbtools::ParameterManager::removeParameterListener | ( | const css::uno::Reference< css::form::XDatabaseParameterListener > & | _rxListener | ) |
removes the given listener from the list of parameter listeners
Definition at line 855 of file parameters.cxx.
void dbtools::ParameterManager::resetParameterValues | ( | ) |
resets all detail columns which are, via a parameter, linked to a master column, to the value of this master column.
For instance, if the database component is bound to a statement SELECT * from invoice where inv_id = :cid
, and there is one master-detail link from
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 861 of file parameters.cxx.
References Exception, isAlive(), PROPERTY_ID_REALNAME, PROPERTY_ID_VALUE, SAL_WARN, and TOOLS_WARN_EXCEPTION.
void dbtools::ParameterManager::setAllParametersNull | ( | ) |
sets all parameter values to null (via <member>XParameters::setNull</member>)
@precond the instance is alive, i.e. <member>isAlive</member> returns <TRUE>
Definition at line 113 of file parameters.cxx.
void dbtools::ParameterManager::setArray | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::sdbc::XArray > & | x | ||
) |
Definition at line 1186 of file parameters.cxx.
void dbtools::ParameterManager::setBinaryStream | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::io::XInputStream > & | x, | ||
sal_Int32 | length | ||
) |
Definition at line 1109 of file parameters.cxx.
void dbtools::ParameterManager::setBlob | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::sdbc::XBlob > & | x | ||
) |
Definition at line 1164 of file parameters.cxx.
void dbtools::ParameterManager::setBoolean | ( | sal_Int32 | _nIndex, |
bool | x | ||
) |
Definition at line 977 of file parameters.cxx.
void dbtools::ParameterManager::setByte | ( | sal_Int32 | _nIndex, |
sal_Int8 | x | ||
) |
Definition at line 988 of file parameters.cxx.
void dbtools::ParameterManager::setBytes | ( | sal_Int32 | _nIndex, |
const css::uno::Sequence< sal_Int8 > & | x | ||
) |
Definition at line 1065 of file parameters.cxx.
void dbtools::ParameterManager::setCharacterStream | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::io::XInputStream > & | x, | ||
sal_Int32 | length | ||
) |
Definition at line 1120 of file parameters.cxx.
void dbtools::ParameterManager::setClob | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::sdbc::XClob > & | x | ||
) |
Definition at line 1175 of file parameters.cxx.
void dbtools::ParameterManager::setDate | ( | sal_Int32 | _nIndex, |
const css::util::Date & | x | ||
) |
Definition at line 1076 of file parameters.cxx.
void dbtools::ParameterManager::setDouble | ( | sal_Int32 | _nIndex, |
double | x | ||
) |
Definition at line 1043 of file parameters.cxx.
void dbtools::ParameterManager::setFloat | ( | sal_Int32 | _nIndex, |
float | x | ||
) |
Definition at line 1032 of file parameters.cxx.
void dbtools::ParameterManager::setInt | ( | sal_Int32 | _nIndex, |
sal_Int32 | x | ||
) |
Definition at line 1010 of file parameters.cxx.
void dbtools::ParameterManager::setLong | ( | sal_Int32 | _nIndex, |
sal_Int64 | x | ||
) |
Definition at line 1021 of file parameters.cxx.
void dbtools::ParameterManager::setNull | ( | sal_Int32 | _nIndex, |
sal_Int32 | sqlType | ||
) |
Definition at line 955 of file parameters.cxx.
References m_rMutex.
void dbtools::ParameterManager::setObject | ( | sal_Int32 | _nIndex, |
const css::uno::Any & | x | ||
) |
Definition at line 1131 of file parameters.cxx.
void dbtools::ParameterManager::setObjectNull | ( | sal_Int32 | _nIndex, |
sal_Int32 | sqlType, | ||
const OUString & | typeName | ||
) |
Definition at line 966 of file parameters.cxx.
void dbtools::ParameterManager::setObjectWithInfo | ( | sal_Int32 | _nIndex, |
const css::uno::Any & | x, | ||
sal_Int32 | targetSqlType, | ||
sal_Int32 | scale | ||
) |
Definition at line 1142 of file parameters.cxx.
void dbtools::ParameterManager::setRef | ( | sal_Int32 | _nIndex, |
const css::uno::Reference< css::sdbc::XRef > & | x | ||
) |
Definition at line 1153 of file parameters.cxx.
void dbtools::ParameterManager::setShort | ( | sal_Int32 | _nIndex, |
sal_Int16 | x | ||
) |
Definition at line 999 of file parameters.cxx.
void dbtools::ParameterManager::setString | ( | sal_Int32 | _nIndex, |
const OUString & | x | ||
) |
Definition at line 1054 of file parameters.cxx.
void dbtools::ParameterManager::setTime | ( | sal_Int32 | _nIndex, |
const css::util::Time & | x | ||
) |
Definition at line 1087 of file parameters.cxx.
void dbtools::ParameterManager::setTimestamp | ( | sal_Int32 | _nIndex, |
const css::util::DateTime & | x | ||
) |
Definition at line 1098 of file parameters.cxx.
void dbtools::ParameterManager::updateParameterInfo | ( | FilterManager & | _rFilterManager | ) |
updates all parameter information represented by the instance
Definition at line 497 of file parameters.cxx.
References isAlive(), and SAL_WARN_IF.
|
private |
Definition at line 126 of file parameters.hxx.
|
private |
Definition at line 125 of file parameters.hxx.
|
private |
Definition at line 123 of file parameters.hxx.
|
private |
Definition at line 102 of file parameters.hxx.
|
private |
Definition at line 132 of file parameters.hxx.
|
private |
Definition at line 134 of file parameters.hxx.
|
private |
Definition at line 121 of file parameters.hxx.
|
private |
Definition at line 119 of file parameters.hxx.
|
private |
Definition at line 101 of file parameters.hxx.
|
private |
Definition at line 128 of file parameters.hxx.
|
private |
Definition at line 129 of file parameters.hxx.
|
private |
Definition at line 110 of file parameters.hxx.
|
private |
Definition at line 108 of file parameters.hxx.
|
private |
Definition at line 113 of file parameters.hxx.
|
private |
Definition at line 130 of file parameters.hxx.
|
private |
Definition at line 105 of file parameters.hxx.
|
private |
Definition at line 116 of file parameters.hxx.
|
private |
Definition at line 112 of file parameters.hxx.
|
private |
Definition at line 114 of file parameters.hxx.