Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Mon, Jul 02, 2012 at 03:33:21PM +0200, Lionel Elie Mamane wrote:
diff --git a/connectivity/source/commontools/dbtools.cxx 
b/connectivity/source/commontools/dbtools.cxx
index 755fe9e..9286efd 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -1819,7 +1819,7 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& 
_xComposer,
     Reference<XIndexAccess>  xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() 
: Reference<XIndexAccess>();
     sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
     ::std::vector<bool, std::allocator<bool> > aNewParameterSet( _aParametersSet );
-    if ( nParamCount || ::std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != 
nParamCount )
+    if ( nParamCount && ::std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != 
nParamCount )
     {
         static const ::rtl::OUString 
PROPERTY_NAME(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME));
         aNewParameterSet.resize(nParamCount ,false);

The idea of this hunk is as follows:

As I understand this code, _aParametersSet / aNewParameterSet stores
at position N the information whether parameter number N has already
been set (and thus does not need to be queried from the user
anymore). So the old code does:

if (there is at least one parameter OR
    the number of parameters that have already been set != the total number of parameters)
{
    prompt the user for parameter values
}

My new code does:

if (there is at least one parameter AND
    the number of parameters that have already been set != the total number of parameters
    (i.e. there is at least one parameter that has not been not, since set parameters <= total 
parameters)
   )
{
    prompt the user for parameter values
}

So, if (as is the situation in the bug's example document) all
parameters have already been given a value, do not fire up a dialog to
ask the user for the values of ... no parameter, which is silly and the code
handling this dialog cannot handle well; it has an OSL_ENSURE to test
for this:

warn:legacy.osl:13341:1:/home/master/src/libreoffice/core/dbaccess/source/ui/dlg/paramdialog.cxx:106:
 OParameterDialog::OParameterDialog : can't handle empty containers !

-- 
Lionel

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.