diff options
Diffstat (limited to 'connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx')
-rw-r--r-- | connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx | 125 |
1 files changed, 35 insertions, 90 deletions
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index 6c798e5a166c..6b6ff6553b53 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -989,7 +989,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) // here we fill the rows which should be visible when ask for data from the resultset returned here auto nNbTypes = SAL_N_ELEMENTS(sTableTypes); - ODatabaseMetaDataResultSet::ORows aRows(nNbTypes); + ODatabaseMetaDataResultSet::ORows aRows; for(std::size_t i=0;i < nNbTypes;++i) { // bound row @@ -1010,7 +1010,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) static ODatabaseMetaDataResultSet::ORows aRows = []() { - ODatabaseMetaDataResultSet::ORows tmp(2); + ODatabaseMetaDataResultSet::ORows tmp; ODatabaseMetaDataResultSet::ORow aRow { ODatabaseMetaDataResultSet::getEmptyValue() , @@ -1102,105 +1102,50 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ODatabaseMetaDataResultSet::ORows aRows; - if (eds_check_version(3, 6, 0) == nullptr) - { - GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK); - - for (GList* liter = pSources; liter; liter = liter->next) - { - ESource *pSource = E_SOURCE (liter->data); - bool can = false; - switch (m_pConnection->getSDBCAddressType()) - { - case SDBCAddress::EVO_GWISE: - can = isSourceBackend( pSource, "groupwise"); // not supported in evo/eds 3.6.x+, somehow - break; - case SDBCAddress::EVO_LOCAL: - can = isSourceBackend( pSource, "local"); - break; - case SDBCAddress::EVO_LDAP: - can = isSourceBackend( pSource, "ldap"); - break; - case SDBCAddress::Unknown: - can = true; - break; - } - if (!can) - continue; - - OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ), - RTL_TEXTENCODING_UTF8 ); - OUString aUID = OStringToOUString( e_source_get_uid( pSource ), - RTL_TEXTENCODING_UTF8 ); - ODatabaseMetaDataResultSet::ORow aRow{ - ORowSetValueDecoratorRef(), - ORowSetValueDecoratorRef(), - ORowSetValueDecoratorRef(), - new ORowSetValueDecorator(aHumanName), //tablename - new ORowSetValueDecorator(ORowSetValue(aTable)), - new ORowSetValueDecorator(aUID)}; //comment - //I'd prefer to swap the comment and the human name and - //just use e_source_registry_ref_source(get_e_source_registry(), aUID); - //in open book rather than search for the name again - aRows.push_back(aRow); - } + GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK); - g_list_foreach (pSources, reinterpret_cast<GFunc>(g_object_unref), nullptr); - g_list_free (pSources); - } - else + for (GList* liter = pSources; liter; liter = liter->next) { - ESourceList *pSourceList; - if( !e_book_get_addressbooks (&pSourceList, nullptr) ) - pSourceList = nullptr; - - GSList *g; - for( g = e_source_list_peek_groups( pSourceList ); g; g = g->next) + ESource *pSource = E_SOURCE (liter->data); + bool can = false; + switch (m_pConnection->getSDBCAddressType()) { - GSList *s; - const char *p = e_source_group_peek_base_uri(E_SOURCE_GROUP(g->data)); - - switch (m_pConnection->getSDBCAddressType()) { case SDBCAddress::EVO_GWISE: - if ( !strncmp( "groupwise://", p, 11 )) - break; - else - continue; + can = isSourceBackend( pSource, "groupwise"); // not supported in evo/eds 3.6.x+, somehow + break; case SDBCAddress::EVO_LOCAL: - if ( !strncmp( "file://", p, 6 ) || - !strncmp( "local://", p, 6 ) ) - break; - else - continue; + can = isSourceBackend( pSource, "local"); + break; case SDBCAddress::EVO_LDAP: - if ( !strncmp( "ldap://", p, 6 )) - break; - else - continue; + can = isSourceBackend( pSource, "ldap"); + break; case SDBCAddress::Unknown: + can = true; break; - } - for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data)); s; s = s->next) - { - ESource *pSource = E_SOURCE (s->data); - - OUString aName = OStringToOUString( e_source_peek_name( pSource ), - RTL_TEXTENCODING_UTF8 ); - - aRows.push_back( - { - ORowSetValueDecoratorRef(), - ORowSetValueDecoratorRef(), - ORowSetValueDecoratorRef(), - new ORowSetValueDecorator(aName), - new ORowSetValueDecorator(ORowSetValue(aTable)), - ODatabaseMetaDataResultSet::getEmptyValue() - } - ); - } } + if (!can) + continue; + + OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ), + RTL_TEXTENCODING_UTF8 ); + OUString aUID = OStringToOUString( e_source_get_uid( pSource ), + RTL_TEXTENCODING_UTF8 ); + ODatabaseMetaDataResultSet::ORow aRow{ + ORowSetValueDecoratorRef(), + ORowSetValueDecoratorRef(), + ORowSetValueDecoratorRef(), + new ORowSetValueDecorator(aHumanName), //tablename + new ORowSetValueDecorator(ORowSetValue(aTable)), + new ORowSetValueDecorator(aUID)}; //comment + //I'd prefer to swap the comment and the human name and + //just use e_source_registry_ref_source(get_e_source_registry(), aUID); + //in open book rather than search for the name again + aRows.push_back(aRow); } + g_list_foreach (pSources, reinterpret_cast<GFunc>(g_object_unref), nullptr); + g_list_free (pSources); + pResult->setRows(aRows); return pResult; |