tdf#158072 Fails to apply AutoFilter in Mail Merge dialog

regression from
    commit 66b0bc5585
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Fri Mar 10 10:35:33 2023 +0200
    simplify initialisation in *DatabaseMetaData
where I failed to notice that the supposedly static data was being
std::move'd

Change-Id: I6238fa8e20ee6ca9fe31c29a7e05262dc1e3bede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159851
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-11-23 11:16:23 +02:00
parent d7b33b1be8
commit f23ee91646
3 changed files with 130 additions and 144 deletions

View file

@ -48,72 +48,67 @@ Reference< XResultSet > OComponentDatabaseMetaData::impl_getTypeInfo_throw( )
{
rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
static ODatabaseMetaDataResultSet::ORows aRows = []()
ODatabaseMetaDataResultSet::ORows aRows;
aRows.reserve(6);
ODatabaseMetaDataResultSet::ORow aRow
{
ODatabaseMetaDataResultSet::ORows aTmp;
aTmp.reserve(6);
ODatabaseMetaDataResultSet::ORow aRow
{
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(OUString("VARCHAR")),
new ORowSetValueDecorator(DataType::VARCHAR),
new ORowSetValueDecorator(sal_Int32(65535)),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::get1Value(), // ORowSetValue((sal_Int32)ColumnValue::NULLABLE
ODatabaseMetaDataResultSet::get1Value(),
new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)),
ODatabaseMetaDataResultSet::get1Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(sal_Int32(10))
};
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(OUString("VARCHAR")),
new ORowSetValueDecorator(DataType::VARCHAR),
new ORowSetValueDecorator(sal_Int32(65535)),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::get1Value(), // ORowSetValue((sal_Int32)ColumnValue::NULLABLE
ODatabaseMetaDataResultSet::get1Value(),
new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR)),
ODatabaseMetaDataResultSet::get1Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(sal_Int32(10))
};
aTmp.push_back(aRow);
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("BOOL"));
aRow[2] = new ORowSetValueDecorator(DataType::BIT);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = new ORowSetValueDecorator(sal_Int32(15));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("BOOL"));
aRow[2] = new ORowSetValueDecorator(DataType::BIT);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = new ORowSetValueDecorator(sal_Int32(15));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
aRow[2] = new ORowSetValueDecorator(DataType::TIME);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
aRow[2] = new ORowSetValueDecorator(DataType::TIME);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aTmp.push_back(aRow);
return aTmp;
}();
aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[3] = ODatabaseMetaDataResultSet::get0Value();
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[15] = ODatabaseMetaDataResultSet::get0Value();
aRows.push_back(aRow);
pResult->setRows(std::move(aRows));
return pResult;

View file

@ -56,96 +56,91 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
{
rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
static ODatabaseMetaDataResultSet::ORows aRows = []()
ODatabaseMetaDataResultSet::ORows aRows;
aRows.reserve(10);
ODatabaseMetaDataResultSet::ORow aRow
{
ODatabaseMetaDataResultSet::ORows aTmp;
aTmp.reserve(10);
ODatabaseMetaDataResultSet::ORow aRow
{
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(OUString("VARCHAR")),
new ORowSetValueDecorator(DataType::VARCHAR),
new ORowSetValueDecorator(sal_Int32(254)),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getQuoteValue(),
new ORowSetValueDecorator(OUString("length")),
new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)),
ODatabaseMetaDataResultSet::get1Value(),
new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)),
ODatabaseMetaDataResultSet::get1Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
new ORowSetValueDecorator(OUString("C")),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(sal_Int32(10))
};
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(OUString("VARCHAR")),
new ORowSetValueDecorator(DataType::VARCHAR),
new ORowSetValueDecorator(sal_Int32(254)),
ODatabaseMetaDataResultSet::getQuoteValue(),
ODatabaseMetaDataResultSet::getQuoteValue(),
new ORowSetValueDecorator(OUString("length")),
new ORowSetValueDecorator(sal_Int32(ColumnValue::NULLABLE)),
ODatabaseMetaDataResultSet::get1Value(),
new ORowSetValueDecorator(sal_Int32(ColumnSearch::FULL)),
ODatabaseMetaDataResultSet::get1Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
new ORowSetValueDecorator(OUString("C")),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::get0Value(),
ODatabaseMetaDataResultSet::getEmptyValue(),
ODatabaseMetaDataResultSet::getEmptyValue(),
new ORowSetValueDecorator(sal_Int32(10))
};
aTmp.push_back(aRow);
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("LONGVARCHAR"));
aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647));
aRow[6] = new ORowSetValueDecorator();
aRow[13] = new ORowSetValueDecorator(OUString("M"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("LONGVARCHAR"));
aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647));
aRow[6] = new ORowSetValueDecorator();
aRow[13] = new ORowSetValueDecorator(OUString("M"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
aRow[13] = new ORowSetValueDecorator(OUString("D"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
aRow[13] = new ORowSetValueDecorator(OUString("D"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("BOOLEAN"));
aRow[2] = new ORowSetValueDecorator(DataType::BIT);
aRow[3] = ODatabaseMetaDataResultSet::get1Value();
aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[6] = new ORowSetValueDecorator(OUString());
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[13] = new ORowSetValueDecorator(OUString("L"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("BOOLEAN"));
aRow[2] = new ORowSetValueDecorator(DataType::BIT);
aRow[3] = ODatabaseMetaDataResultSet::get1Value();
aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[6] = new ORowSetValueDecorator(OUString());
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
aRow[13] = new ORowSetValueDecorator(OUString("L"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE"));
aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8));
aRow[13] = new ORowSetValueDecorator(OUString("B"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE"));
aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
aRow[3] = new ORowSetValueDecorator(sal_Int32(8));
aRow[13] = new ORowSetValueDecorator(OUString("B"));
aRows.push_back(aRow);
aRow[11] = new ORowSetValueDecorator(ORowSetValue(true));
aRow[13] = new ORowSetValueDecorator(OUString("Y"));
aTmp.push_back(aRow);
aRow[11] = new ORowSetValueDecorator(ORowSetValue(true));
aRow[13] = new ORowSetValueDecorator(OUString("Y"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[11] = new ORowSetValueDecorator(ORowSetValue(false));
aRow[13] = new ORowSetValueDecorator(OUString("T"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
aRow[11] = new ORowSetValueDecorator(ORowSetValue(false));
aRow[13] = new ORowSetValueDecorator(OUString("T"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
aRow[13] = new ORowSetValueDecorator(OUString("I"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
aRow[3] = new ORowSetValueDecorator(sal_Int32(10));
aRow[13] = new ORowSetValueDecorator(OUString("I"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[6] = new ORowSetValueDecorator(OUString("length,scale"));
aRow[13] = new ORowSetValueDecorator(OUString("F"));
aTmp.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int32(20));
aRow[6] = new ORowSetValueDecorator(OUString("length,scale"));
aRow[13] = new ORowSetValueDecorator(OUString("F"));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int32(16));
aRow[13] = new ORowSetValueDecorator(OUString("N"));
aRow[15] = new ORowSetValueDecorator(sal_Int32(16));
aTmp.push_back(aRow);
return aTmp;
}();
aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator(sal_Int32(16));
aRow[13] = new ORowSetValueDecorator(OUString("N"));
aRow[15] = new ORowSetValueDecorator(sal_Int32(16));
aRows.push_back(aRow);
pResult->setRows(std::move(aRows));
return pResult;

View file

@ -619,12 +619,8 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( )
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
{
rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eTableTypes );
static ODatabaseMetaDataResultSet::ORows aRows = []()
{
ODatabaseMetaDataResultSet::ORows aTmp;
aTmp.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } );
return aTmp;
}();
ODatabaseMetaDataResultSet::ORows aRows;
aRows.push_back( { ODatabaseMetaDataResultSet::getEmptyValue(), new ORowSetValueDecorator(OUString("TABLE")) } );
pResult->setRows(std::move(aRows));
return pResult;
}