User: vg Date: 05/03/10 07:18:56 Modified: /dba/connectivity/source/drivers/adabas/ BCatalog.cxx
Log: INTEGRATION: CWS dba24 (1.11.240); FILE MERGED 2005/02/09 08:07:35 oj 1.11.240.1: #i26950# remove the need for XNamed File Changes: Directory: /dba/connectivity/source/drivers/adabas/ =================================================== File [changed]: BCatalog.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/adabas/BCatalog.cxx?r1=1.11&r2=1.12 Delta lines: +28 -38 --------------------- --- BCatalog.cxx 20 Nov 2002 15:44:58 -0000 1.11 +++ BCatalog.cxx 10 Mar 2005 15:18:53 -0000 1.12 @@ -89,6 +89,7 @@ // ------------------------------------------------------------------------- +using namespace connectivity; using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -96,7 +97,7 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; -// ------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- OAdabasCatalog::OAdabasCatalog(SQLHANDLE _aConnectionHdl, OAdabasConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) ,m_pConnection(_pCon) ,m_aConnectionHdl(_aConnectionHdl) @@ -107,11 +108,24 @@ { ::rtl::OUString sName; sName = _xRow->getString(2); + if ( sName.getLength() ) sName += OAdabasCatalog::getDot(); sName += _xRow->getString(3); + return sName; } +// ----------------------------------------------------------------------------- +void OAdabasCatalog::fillVector(const ::rtl::OUString& _sQuery,TStringVector& _rVector) +{ + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + OSL_ENSURE(xStmt.is(),"OAdabasCatalog::fillVector: Could not create a statement!"); + Reference< XResultSet > xResult = xStmt->executeQuery(_sQuery); + + fillNames(xResult,_rVector); + ::comphelper::disposeComponent(xStmt); + +} // ------------------------------------------------------------------------- void OAdabasCatalog::refreshTables() { @@ -135,13 +149,8 @@ void OAdabasCatalog::refreshViews() { TStringVector aVector; - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - Reference< XResultSet > xResult = xStmt->executeQuery( - ::rtl::OUString::createFromAscii("SELECT DISTINCT NULL,DOMAIN.VIEWDEFS.OWNER, DOMAIN.VIEWDEFS.VIEWNAME FROM DOMAIN.VIEWDEFS")); - - fillNames(xResult,aVector); - ::comphelper::disposeComponent(xStmt); + static const ::rtl::OUString s_sView(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,DOMAIN.VIEWDEFS.OWNER, DOMAIN.VIEWDEFS.VIEWNAME FROM DOMAIN.VIEWDEFS")); + fillVector(s_sView,aVector); if(m_pViews) m_pViews->reFill(aVector); @@ -152,18 +161,8 @@ void OAdabasCatalog::refreshGroups() { TStringVector aVector; - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - Reference< XResultSet > xResult = xStmt->executeQuery( - ::rtl::OUString::createFromAscii("SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' '")); - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - aVector.push_back(xRow->getString(1)); - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); - + static const ::rtl::OUString s_sGroup(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,NULL,GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' '")); + fillVector(s_sGroup,aVector); if(m_pGroups) m_pGroups->reFill(aVector); else @@ -173,17 +172,8 @@ void OAdabasCatalog::refreshUsers() { TStringVector aVector; - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - Reference< XResultSet > xResult = xStmt->executeQuery( - ::rtl::OUString::createFromAscii("SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL'")); - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - aVector.push_back(xRow->getString(1)); - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); + static const ::rtl::OUString s_sUsers(RTL_CONSTASCII_USTRINGPARAM("SELECT DISTINCT NULL,NULL,USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL'")); + fillVector(s_sUsers,aVector); if(m_pUsers) m_pUsers->reFill(aVector); @@ -193,7 +183,7 @@ // ------------------------------------------------------------------------- const ::rtl::OUString& OAdabasCatalog::getDot() { - static const ::rtl::OUString sDot = ::rtl::OUString::createFromAscii("."); + static const ::rtl::OUString sDot(RTL_CONSTASCII_USTRINGPARAM(".")); return sDot; } // ----------------------------------------------------------------------------- @@ -203,7 +193,7 @@ { case DataType::DECIMAL: { - static const ::rtl::OUString sDecimal = ::rtl::OUString::createFromAscii("DECIMAL"); + static const ::rtl::OUString sDecimal(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); if(_rnType == DataType::DECIMAL && _rsTypeName == sDecimal) _rnType = DataType::NUMERIC; } @@ -211,7 +201,7 @@ case DataType::FLOAT: // if(_nPrec >= 16) { - static const ::rtl::OUString sDouble = ::rtl::OUString::createFromAscii("DOUBLE PRECISION"); + static const ::rtl::OUString sDouble(RTL_CONSTASCII_USTRINGPARAM("DOUBLE PRECISION")); _rsTypeName = sDouble; _rnType = DataType::DOUBLE; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
