1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 30*cdf0e10cSrcweir #include "mysql/YUser.hxx" 31*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp> 33*cdf0e10cSrcweir #include "connectivity/dbtools.hxx" 34*cdf0e10cSrcweir #include "connectivity/dbexception.hxx" 35*cdf0e10cSrcweir #include <com/sun/star/sdbcx/Privilege.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/sdbcx/PrivilegeObject.hpp> 37*cdf0e10cSrcweir #include "TConnection.hxx" 38*cdf0e10cSrcweir #include "resource/common_res.hrc" 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir using namespace connectivity; 41*cdf0e10cSrcweir using namespace connectivity::mysql; 42*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 43*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 44*cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx; 45*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 46*cdf0e10cSrcweir using namespace ::com::sun::star::container; 47*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 48*cdf0e10cSrcweir // ------------------------------------------------------------------------- 49*cdf0e10cSrcweir OMySQLUser::OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(sal_True) 50*cdf0e10cSrcweir ,m_xConnection(_xConnection) 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir construct(); 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir // ------------------------------------------------------------------------- 55*cdf0e10cSrcweir OMySQLUser::OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, 56*cdf0e10cSrcweir const ::rtl::OUString& _Name 57*cdf0e10cSrcweir ) : connectivity::sdbcx::OUser(_Name,sal_True) 58*cdf0e10cSrcweir ,m_xConnection(_xConnection) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir construct(); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir // ------------------------------------------------------------------------- 63*cdf0e10cSrcweir void OMySQLUser::refreshGroups() 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir } 66*cdf0e10cSrcweir // ------------------------------------------------------------------------- 67*cdf0e10cSrcweir OUserExtend::OUserExtend( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) : OMySQLUser(_xConnection) 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir construct(); 70*cdf0e10cSrcweir } 71*cdf0e10cSrcweir // ------------------------------------------------------------------------- 72*cdf0e10cSrcweir typedef connectivity::sdbcx::OUser OUser_TYPEDEF; 73*cdf0e10cSrcweir void OUserExtend::construct() 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 78*cdf0e10cSrcweir cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir Sequence< Property > aProps; 81*cdf0e10cSrcweir describeProperties(aProps); 82*cdf0e10cSrcweir return new cppu::OPropertyArrayHelper(aProps); 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir // ------------------------------------------------------------------------- 85*cdf0e10cSrcweir cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper() 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir return *OUserExtend_PROP::getArrayHelper(); 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER; 90*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 91*cdf0e10cSrcweir sal_Int32 SAL_CALL OMySQLUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 94*cdf0e10cSrcweir checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir sal_Int32 nRights,nRightsWithGrant; 97*cdf0e10cSrcweir findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant); 98*cdf0e10cSrcweir return nRights; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 101*cdf0e10cSrcweir void OMySQLUser::findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir nRightsWithGrant = nRights = 0; 104*cdf0e10cSrcweir // first we need to create the sql stmt to select the privs 105*cdf0e10cSrcweir Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); 106*cdf0e10cSrcweir ::rtl::OUString sCatalog,sSchema,sTable; 107*cdf0e10cSrcweir ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); 108*cdf0e10cSrcweir Reference<XResultSet> xRes; 109*cdf0e10cSrcweir switch(objType) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir case PrivilegeObject::TABLE: 112*cdf0e10cSrcweir case PrivilegeObject::VIEW: 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir Any aCatalog; 115*cdf0e10cSrcweir if ( sCatalog.getLength() ) 116*cdf0e10cSrcweir aCatalog <<= sCatalog; 117*cdf0e10cSrcweir xRes = xMeta->getTablePrivileges(aCatalog,sSchema,sTable); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir break; 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir case PrivilegeObject::COLUMN: 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir Any aCatalog; 124*cdf0e10cSrcweir if ( sCatalog.getLength() ) 125*cdf0e10cSrcweir aCatalog <<= sCatalog; 126*cdf0e10cSrcweir xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"))); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir break; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir if ( xRes.is() ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir static const ::rtl::OUString sSELECT = ::rtl::OUString::createFromAscii("SELECT"); 134*cdf0e10cSrcweir static const ::rtl::OUString sINSERT = ::rtl::OUString::createFromAscii("INSERT"); 135*cdf0e10cSrcweir static const ::rtl::OUString sUPDATE = ::rtl::OUString::createFromAscii("UPDATE"); 136*cdf0e10cSrcweir static const ::rtl::OUString sDELETE = ::rtl::OUString::createFromAscii("DELETE"); 137*cdf0e10cSrcweir static const ::rtl::OUString sREAD = ::rtl::OUString::createFromAscii("READ"); 138*cdf0e10cSrcweir static const ::rtl::OUString sCREATE = ::rtl::OUString::createFromAscii("CREATE"); 139*cdf0e10cSrcweir static const ::rtl::OUString sALTER = ::rtl::OUString::createFromAscii("ALTER"); 140*cdf0e10cSrcweir static const ::rtl::OUString sREFERENCE = ::rtl::OUString::createFromAscii("REFERENCE"); 141*cdf0e10cSrcweir static const ::rtl::OUString sDROP = ::rtl::OUString::createFromAscii("DROP"); 142*cdf0e10cSrcweir static const ::rtl::OUString sYes = ::rtl::OUString::createFromAscii("YES"); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir nRightsWithGrant = nRights = 0; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir Reference<XRow> xCurrentRow(xRes,UNO_QUERY); 147*cdf0e10cSrcweir while( xCurrentRow.is() && xRes->next() ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir ::rtl::OUString sGrantee = xCurrentRow->getString(5); 150*cdf0e10cSrcweir ::rtl::OUString sPrivilege = xCurrentRow->getString(6); 151*cdf0e10cSrcweir ::rtl::OUString sGrantable = xCurrentRow->getString(7); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir if (!m_Name.equalsIgnoreAsciiCase(sGrantee)) 154*cdf0e10cSrcweir continue; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir if (sPrivilege.equalsIgnoreAsciiCase(sSELECT)) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir nRights |= Privilege::SELECT; 159*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 160*cdf0e10cSrcweir nRightsWithGrant |= Privilege::SELECT; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sINSERT)) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir nRights |= Privilege::INSERT; 165*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 166*cdf0e10cSrcweir nRightsWithGrant |= Privilege::INSERT; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sUPDATE)) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir nRights |= Privilege::UPDATE; 171*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 172*cdf0e10cSrcweir nRightsWithGrant |= Privilege::UPDATE; 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sDELETE)) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir nRights |= Privilege::DELETE; 177*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 178*cdf0e10cSrcweir nRightsWithGrant |= Privilege::DELETE; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sREAD)) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir nRights |= Privilege::READ; 183*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 184*cdf0e10cSrcweir nRightsWithGrant |= Privilege::READ; 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sCREATE)) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir nRights |= Privilege::CREATE; 189*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 190*cdf0e10cSrcweir nRightsWithGrant |= Privilege::CREATE; 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sALTER)) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir nRights |= Privilege::ALTER; 195*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 196*cdf0e10cSrcweir nRightsWithGrant |= Privilege::ALTER; 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sREFERENCE)) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir nRights |= Privilege::REFERENCE; 201*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 202*cdf0e10cSrcweir nRightsWithGrant |= Privilege::REFERENCE; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir else if (sPrivilege.equalsIgnoreAsciiCase(sDROP)) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir nRights |= Privilege::DROP; 207*cdf0e10cSrcweir if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) 208*cdf0e10cSrcweir nRightsWithGrant |= Privilege::DROP; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir ::comphelper::disposeComponent(xRes); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir // ------------------------------------------------------------------------- 215*cdf0e10cSrcweir sal_Int32 SAL_CALL OMySQLUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 218*cdf0e10cSrcweir checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir sal_Int32 nRights,nRightsWithGrant; 221*cdf0e10cSrcweir findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant); 222*cdf0e10cSrcweir return nRightsWithGrant; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir // ------------------------------------------------------------------------- 225*cdf0e10cSrcweir void SAL_CALL OMySQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir if ( objType != PrivilegeObject::TABLE ) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir ::connectivity::SharedResources aResources; 230*cdf0e10cSrcweir const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED)); 231*cdf0e10cSrcweir ::dbtools::throwGenericSQLException(sError,*this); 232*cdf0e10cSrcweir } // if ( objType != PrivilegeObject::TABLE ) 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); 237*cdf0e10cSrcweir if(sPrivs.getLength()) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir ::rtl::OUString sGrant; 240*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii("GRANT "); 241*cdf0e10cSrcweir sGrant += sPrivs; 242*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii(" ON "); 243*cdf0e10cSrcweir Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); 244*cdf0e10cSrcweir sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); 245*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii(" TO "); 246*cdf0e10cSrcweir sGrant += m_Name; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir Reference<XStatement> xStmt = m_xConnection->createStatement(); 249*cdf0e10cSrcweir if(xStmt.is()) 250*cdf0e10cSrcweir xStmt->execute(sGrant); 251*cdf0e10cSrcweir ::comphelper::disposeComponent(xStmt); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir // ------------------------------------------------------------------------- 255*cdf0e10cSrcweir void SAL_CALL OMySQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if ( objType != PrivilegeObject::TABLE ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir ::connectivity::SharedResources aResources; 260*cdf0e10cSrcweir const ::rtl::OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED)); 261*cdf0e10cSrcweir ::dbtools::throwGenericSQLException(sError,*this); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 265*cdf0e10cSrcweir checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); 266*cdf0e10cSrcweir ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); 267*cdf0e10cSrcweir if(sPrivs.getLength()) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir ::rtl::OUString sGrant; 270*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii("REVOKE "); 271*cdf0e10cSrcweir sGrant += sPrivs; 272*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii(" ON "); 273*cdf0e10cSrcweir Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); 274*cdf0e10cSrcweir sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); 275*cdf0e10cSrcweir sGrant += ::rtl::OUString::createFromAscii(" FROM "); 276*cdf0e10cSrcweir sGrant += m_Name; 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir Reference<XStatement> xStmt = m_xConnection->createStatement(); 279*cdf0e10cSrcweir if(xStmt.is()) 280*cdf0e10cSrcweir xStmt->execute(sGrant); 281*cdf0e10cSrcweir ::comphelper::disposeComponent(xStmt); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 285*cdf0e10cSrcweir // XUser 286*cdf0e10cSrcweir void SAL_CALL OMySQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 289*cdf0e10cSrcweir checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); 290*cdf0e10cSrcweir ::rtl::OUString sAlterPwd; 291*cdf0e10cSrcweir sAlterPwd = ::rtl::OUString::createFromAscii("SET PASSWORD FOR "); 292*cdf0e10cSrcweir sAlterPwd += m_Name; 293*cdf0e10cSrcweir sAlterPwd += ::rtl::OUString::createFromAscii("@\"%\" = PASSWORD('") ; 294*cdf0e10cSrcweir sAlterPwd += newPassword; 295*cdf0e10cSrcweir sAlterPwd += ::rtl::OUString::createFromAscii("')") ; 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir Reference<XStatement> xStmt = m_xConnection->createStatement(); 299*cdf0e10cSrcweir if ( xStmt.is() ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir xStmt->execute(sAlterPwd); 302*cdf0e10cSrcweir ::comphelper::disposeComponent(xStmt); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 306*cdf0e10cSrcweir ::rtl::OUString OMySQLUser::getPrivilegeString(sal_Int32 nRights) const 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir ::rtl::OUString sPrivs; 309*cdf0e10cSrcweir if((nRights & Privilege::INSERT) == Privilege::INSERT) 310*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("INSERT"); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir if((nRights & Privilege::DELETE) == Privilege::DELETE) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir if(sPrivs.getLength()) 315*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii(","); 316*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("DELETE"); 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir if((nRights & Privilege::UPDATE) == Privilege::UPDATE) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir if(sPrivs.getLength()) 322*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii(","); 323*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("UPDATE"); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir if((nRights & Privilege::ALTER) == Privilege::ALTER) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir if(sPrivs.getLength()) 329*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii(","); 330*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("ALTER"); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir if((nRights & Privilege::SELECT) == Privilege::SELECT) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir if(sPrivs.getLength()) 336*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii(","); 337*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("SELECT"); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir if(sPrivs.getLength()) 343*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii(","); 344*cdf0e10cSrcweir sPrivs += ::rtl::OUString::createFromAscii("REFERENCES"); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir return sPrivs; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 350*cdf0e10cSrcweir 351