Kaydet (Commit) 29bea29e authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

loplugin:singlevalfields in ucbhelper

Change-Id: I738bda6e6e161fb5ea96bd496a21ccf72680cd7f
Reviewed-on: https://gerrit.libreoffice.org/26604Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 1506b14a
...@@ -39,35 +39,30 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction( ...@@ -39,35 +39,30 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction(
aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
//intercept internal error //intercept internal error
aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
//intercept network error exception (WebDAV ucp provider) //intercept network error exception (WebDAV ucp provider)
aInterceptedRequest.Handle = HANDLE_INTERACTIVENETWORKEXCEPTION; aInterceptedRequest.Handle = HANDLE_INTERACTIVENETWORKEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::InteractiveNetworkException(); aInterceptedRequest.Request <<= css::ucb::InteractiveNetworkException();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
//intercept certificate validation request (WebDAV ucp provider) //intercept certificate validation request (WebDAV ucp provider)
aInterceptedRequest.Handle = HANDLE_CERTIFICATEREQUEST; aInterceptedRequest.Handle = HANDLE_CERTIFICATEREQUEST;
aInterceptedRequest.Request <<= css::ucb::CertificateValidationRequest(); aInterceptedRequest.Request <<= css::ucb::CertificateValidationRequest();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
//intercept authentication request (WebDAV ucp provider) //intercept authentication request (WebDAV ucp provider)
aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUEST; aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUEST;
aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest(); aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
setInterceptedHandler(xHandler); setInterceptedHandler(xHandler);
......
...@@ -44,19 +44,16 @@ StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< ...@@ -44,19 +44,16 @@ StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference<
aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUESTEXCEPTION; aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUESTEXCEPTION;
aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest(); aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest();
aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get(); aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
aInterceptedRequest.MatchExact = false;
lInterceptions.push_back(aInterceptedRequest); lInterceptions.push_back(aInterceptedRequest);
setInterceptedHandler(xHandler); setInterceptedHandler(xHandler);
......
...@@ -346,7 +346,6 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication : ...@@ -346,7 +346,6 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
bool m_bCanSetPassword : 1; bool m_bCanSetPassword : 1;
bool m_bCanSetAccount : 1; bool m_bCanSetAccount : 1;
bool m_bCanUseSystemCredentials : 1; bool m_bCanUseSystemCredentials : 1;
bool m_bDefaultUseSystemCredentials : 1;
bool m_bUseSystemCredentials : 1; bool m_bUseSystemCredentials : 1;
public: public:
...@@ -530,7 +529,6 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication( ...@@ -530,7 +529,6 @@ inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
m_bCanSetPassword( bCanSetPassword ), m_bCanSetPassword( bCanSetPassword ),
m_bCanSetAccount( bCanSetAccount ), m_bCanSetAccount( bCanSetAccount ),
m_bCanUseSystemCredentials( bCanUseSystemCredentials ), m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
m_bDefaultUseSystemCredentials( false ),
m_bUseSystemCredentials( false ) m_bUseSystemCredentials( false )
{ {
} }
......
...@@ -64,23 +64,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper ...@@ -64,23 +64,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper
css::uno::Type Continuation; css::uno::Type Continuation;
/** @short specify, if both interactions must have the same type
or can be derived from.
@descr Interaction base on exceptions - and exceptions are real types.
So they can be checked in its type. These parameter "MatchExact"
influence the type-check in the following way:
TRUE => the exception will be intercepted only
if it supports exactly the same type ...
or
FALSE => derived exceptions will be intercepted too.
@attention This parameter does not influence the check of the continuation
type! The continuation must be matched exactly every time ...
*/
bool MatchExact;
/** @short its an unique identifier, which must be managed by the outside code. /** @short its an unique identifier, which must be managed by the outside code.
@descr If there is a derived class, which overwrites the InterceptedInteraction::intercepted() @descr If there is a derived class, which overwrites the InterceptedInteraction::intercepted()
...@@ -98,7 +81,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper ...@@ -98,7 +81,6 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper
*/ */
InterceptedRequest() InterceptedRequest()
{ {
MatchExact = false;
Handle = INVALID_HANDLE; Handle = INVALID_HANDLE;
} }
......
...@@ -57,18 +57,6 @@ struct ResultSetColumnData ...@@ -57,18 +57,6 @@ struct ResultSetColumnData
/** @see ResultSetMetaData::isCaseSensitive */ /** @see ResultSetMetaData::isCaseSensitive */
bool isCaseSensitive; bool isCaseSensitive;
/** @see ResultSetMetaData::isSearchable */
bool isSearchable;
/** @see ResultSetMetaData::isCurrency */
bool isCurrency;
/** @see ResultSetMetaData::isNullable */
sal_Int32 isNullable;
/** @see ResultSetMetaData::isSigned */
bool isSigned;
/** @see ResultSetMetaData::getColumnDisplaySize */ /** @see ResultSetMetaData::getColumnDisplaySize */
sal_Int32 columnDisplaySize; sal_Int32 columnDisplaySize;
...@@ -78,12 +66,6 @@ struct ResultSetColumnData ...@@ -78,12 +66,6 @@ struct ResultSetColumnData
/** @see ResultSetMetaData::getSchemaName */ /** @see ResultSetMetaData::getSchemaName */
OUString schemaName; OUString schemaName;
/** @see ResultSetMetaData::getPrecision */
sal_Int32 precision;
/** @see ResultSetMetaData::getScale */
sal_Int32 scale;
/** @see ResultSetMetaData::getTableName */ /** @see ResultSetMetaData::getTableName */
OUString tableName; OUString tableName;
...@@ -93,15 +75,6 @@ struct ResultSetColumnData ...@@ -93,15 +75,6 @@ struct ResultSetColumnData
/** @see ResultSetMetaData::getColumnTypeName */ /** @see ResultSetMetaData::getColumnTypeName */
OUString columnTypeName; OUString columnTypeName;
/** @see ResultSetMetaData::isReadOnly */
bool isReadOnly;
/** @see ResultSetMetaData::isWritable */
bool isWritable;
/** @see ResultSetMetaData::isDefinitelyWritable */
bool isDefinitelyWritable;
/** @see ResultSetMetaData::getColumnServiceName */ /** @see ResultSetMetaData::getColumnServiceName */
OUString columnServiceName; OUString columnServiceName;
...@@ -114,16 +87,7 @@ struct ResultSetColumnData ...@@ -114,16 +87,7 @@ struct ResultSetColumnData
ResultSetColumnData::ResultSetColumnData() ResultSetColumnData::ResultSetColumnData()
: isAutoIncrement( false ), : isAutoIncrement( false ),
isCaseSensitive( true ), isCaseSensitive( true ),
isSearchable( false ), columnDisplaySize( 16 )
isCurrency( false ),
isNullable( css::sdbc::ColumnValue::NULLABLE ),
isSigned( false ),
columnDisplaySize( 16 ),
precision( -1 ),
scale( 0 ),
isReadOnly( true ),
isWritable( false ),
isDefinitelyWritable( false )
{ {
} }
...@@ -145,7 +109,6 @@ private: ...@@ -145,7 +109,6 @@ private:
protected: protected:
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Sequence< css::beans::Property > m_aProps; css::uno::Sequence< css::beans::Property > m_aProps;
bool m_bReadOnly;
public: public:
......
...@@ -115,11 +115,7 @@ InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_intercep ...@@ -115,11 +115,7 @@ InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_intercep
css::uno::Type aInterceptedType = rInterception.Request.getValueType(); css::uno::Type aInterceptedType = rInterception.Request.getValueType();
// check the request // check the request
bool bMatch = false; bool bMatch = aInterceptedType.isAssignableFrom(aRequestType); // don't change intercepted and request type here -> it will check the wrong direction!
if (rInterception.MatchExact)
bMatch = aInterceptedType.equals(aRequestType);
else
bMatch = aInterceptedType.isAssignableFrom(aRequestType); // don't change intercepted and request type here -> it will check the wrong direction!
// intercepted ... // intercepted ...
// Call they might existing derived class, so they can handle that by its own. // Call they might existing derived class, so they can handle that by its own.
......
...@@ -758,7 +758,7 @@ InteractionSupplyAuthentication::canUseSystemCredentials( ...@@ -758,7 +758,7 @@ InteractionSupplyAuthentication::canUseSystemCredentials(
sal_Bool& Default ) sal_Bool& Default )
throw ( uno::RuntimeException, std::exception ) throw ( uno::RuntimeException, std::exception )
{ {
Default = m_bDefaultUseSystemCredentials; Default = false;
return m_bCanUseSystemCredentials; return m_bCanUseSystemCredentials;
} }
......
...@@ -83,8 +83,7 @@ ResultSetMetaData::ResultSetMetaData( ...@@ -83,8 +83,7 @@ ResultSetMetaData::ResultSetMetaData(
const Sequence< Property >& rProps ) const Sequence< Property >& rProps )
: m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ), : m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ),
m_xContext( rxContext ), m_xContext( rxContext ),
m_aProps( rProps ), m_aProps( rProps )
m_bReadOnly( true )
{ {
} }
...@@ -95,8 +94,7 @@ ResultSetMetaData::ResultSetMetaData( ...@@ -95,8 +94,7 @@ ResultSetMetaData::ResultSetMetaData(
const std::vector< ResultSetColumnData >& rColumnData ) const std::vector< ResultSetColumnData >& rColumnData )
: m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ), : m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ),
m_xContext( rxContext ), m_xContext( rxContext ),
m_aProps( rProps ), m_aProps( rProps )
m_bReadOnly( true )
{ {
OSL_ENSURE( rColumnData.size() == sal_uInt32( rProps.getLength() ), OSL_ENSURE( rColumnData.size() == sal_uInt32( rProps.getLength() ),
"ResultSetMetaData ctor - different array sizes!" ); "ResultSetMetaData ctor - different array sizes!" );
...@@ -180,64 +178,34 @@ sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column ) ...@@ -180,64 +178,34 @@ sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return false;
Checks whether the value stored in column can be used in a
WHERE clause.
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return false;
return m_pImpl->m_aColumnData[ column - 1 ].isSearchable;
} }
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return false;
Checks whether column is a cash value.
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return false;
return m_pImpl->m_aColumnData[ column - 1 ].isCurrency;
} }
// virtual // virtual
sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column ) sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return ColumnValue::NULLABLE;
Checks whether a NULL can be stored in column.
Possible values: see com/sun/star/sdbc/ColumnValue.idl
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return ColumnValue::NULLABLE;
return m_pImpl->m_aColumnData[ column - 1 ].isNullable;
} }
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return false;
Checks whether the value stored in column is a signed number.
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return false;
return m_pImpl->m_aColumnData[ column - 1 ].isSigned;
} }
...@@ -310,37 +278,18 @@ OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column ) ...@@ -310,37 +278,18 @@ OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
// virtual // virtual
sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column ) sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return -1;
For number types, getprecision gets the number of decimal digits
in column.
For character types, it gets the maximum length in characters for
column.
For binary types, it gets the maximum length in bytes for column.
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return -1;
return m_pImpl->m_aColumnData[ column - 1 ].precision;
} }
// virtual // virtual
sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column ) sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
/* return 0;
Gets the number of digits to the right of the decimal point for
values in column.
*/
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return 0;
return m_pImpl->m_aColumnData[ column - 1 ].scale;
} }
...@@ -507,46 +456,26 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column ) ...@@ -507,46 +456,26 @@ OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
if ( m_pImpl->m_bGlobalReadOnlyValue ) return true;
return m_bReadOnly;
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return true;
// autoincrement==true => readonly
return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement ||
m_pImpl->m_aColumnData[ column - 1 ].isReadOnly;
} }
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
if ( m_pImpl->m_bGlobalReadOnlyValue ) return false;
return !m_bReadOnly;
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return false;
return m_pImpl->m_aColumnData[ column - 1 ].isWritable;
} }
// virtual // virtual
sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 /*column*/ )
throw( SQLException, RuntimeException, std::exception ) throw( SQLException, RuntimeException, std::exception )
{ {
if ( m_pImpl->m_bGlobalReadOnlyValue ) return false;
return !m_bReadOnly;
if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
return false;
return m_pImpl->m_aColumnData[ column - 1 ].isDefinitelyWritable;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment