diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-18 21:41:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-19 09:30:43 +0100 |
commit | 2add3f0e5a6b6e5b818a9e41b19436c496aa4c66 (patch) | |
tree | e0fb688e0533e229a294dd082975d70ee50e5d71 /connectivity | |
parent | 229d63249ae602bef9c0ce7c673e97f9c4583aa1 (diff) |
drop it completely
Diffstat (limited to 'connectivity')
28 files changed, 0 insertions, 6297 deletions
diff --git a/connectivity/source/drivers/adabas/BCatalog.cxx b/connectivity/source/drivers/adabas/BCatalog.cxx deleted file mode 100644 index e04f4d3a9373..000000000000 --- a/connectivity/source/drivers/adabas/BCatalog.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BCatalog.hxx" -#include "adabas/BConnection.hxx" -#include "adabas/BGroups.hxx" -#include "adabas/BUsers.hxx" -#include "adabas/BTables.hxx" -#include "adabas/BViews.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <comphelper/types.hxx> - - -// ------------------------------------------------------------------------- -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -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) -{ -} -// ----------------------------------------------------------------------------- -::rtl::OUString OAdabasCatalog::buildName(const Reference< XRow >& _xRow) -{ - ::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() -{ - TStringVector aVector; - { - Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")); - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")), - aTypes); - fillNames(xResult,aVector); - } - - if(m_pTables) - m_pTables->reFill(aVector); - else - m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector); -} -// ------------------------------------------------------------------------- -void OAdabasCatalog::refreshViews() -{ - TStringVector aVector; - 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); - else - m_pViews = new OViews(m_xMetaData,*this,m_aMutex,aVector); -} -// ------------------------------------------------------------------------- -void OAdabasCatalog::refreshGroups() -{ - TStringVector aVector; - 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 - m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this); -} -// ------------------------------------------------------------------------- -void OAdabasCatalog::refreshUsers() -{ - TStringVector aVector; - 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); - else - m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); -} -// ------------------------------------------------------------------------- -const ::rtl::OUString& OAdabasCatalog::getDot() -{ - static const ::rtl::OUString sDot(RTL_CONSTASCII_USTRINGPARAM(".")); - return sDot; -} -// ----------------------------------------------------------------------------- -void OAdabasCatalog::correctColumnProperties(sal_Int32 /*_nPrec*/, sal_Int32& _rnType,::rtl::OUString& _rsTypeName) -{ - switch(_rnType) - { - case DataType::DECIMAL: - { - static const ::rtl::OUString sDecimal(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); - if(_rnType == DataType::DECIMAL && _rsTypeName == sDecimal) - _rnType = DataType::NUMERIC; - } - break; - case DataType::FLOAT: - // if(_nPrec >= 16) - { - static const ::rtl::OUString sDouble(RTL_CONSTASCII_USTRINGPARAM("DOUBLE PRECISION")); - _rsTypeName = sDouble; - _rnType = DataType::DOUBLE; - } -// else if(_nPrec > 15) -// { -// static const ::rtl::OUString sReal( RTL_CONSTASCII_USTRINGPARAM( "REAL" )); -// _rsTypeName = sReal; -// _rnType = DataType::REAL; -// } - break; - } -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx deleted file mode 100644 index 227646beeb9b..000000000000 --- a/connectivity/source/drivers/adabas/BColumns.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BColumns.hxx" -#include "connectivity/sdbcx/VColumn.hxx" -#include "connectivity/sdbcx/VColumn.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include "adabas/BTable.hxx" -#include "adabas/BTables.hxx" -#include "adabas/BCatalog.hxx" -#include <comphelper/types.hxx> -#include "connectivity/dbtools.hxx" -#include <comphelper/property.hxx> - -using namespace ::comphelper; -using namespace connectivity::adabas; -using namespace connectivity::sdbcx; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) -{ - Reference< XResultSet > xResult = m_pTable->getMetaData()->getColumns(Any(), - m_pTable->getSchema(),m_pTable->getTableName(),_rName); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - if(xRow->getString(4) == _rName) - { - sal_Int32 nType = xRow->getInt(5); - ::rtl::OUString sTypeName = xRow->getString(6); - sal_Int32 nPrec = xRow->getInt(7); - OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName); - sal_Bool bAutoIncrement = sal_False; - if ( !_rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DEFAULT")) && !m_pTable->getSchema().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DOMAIN")) && !m_pTable->getTableName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("COLUMNS")) ) - { - Reference< XStatement > xStmt = m_pTable->getMetaData()->getConnection()->createStatement( ); - ::rtl::OUString sQuery(RTL_CONSTASCII_USTRINGPARAM("SELECT \"DEFAULT\" FROM DOMAIN.COLUMNS WHERE OWNER = '")); - sQuery += m_pTable->getSchema(); - sQuery += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND TABLENAME = '")); - sQuery += m_pTable->getTableName() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND COLUMNNAME = '")); - sQuery += _rName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - try - { - Reference< XResultSet > xResult2 = xStmt->executeQuery(sQuery); - Reference< XRow > xRow2(xResult2,UNO_QUERY); - if ( xRow2.is() && xResult2->next() ) - bAutoIncrement = xRow2->getString(1) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DEFAULT STAMP")); - } - catch(const Exception&) - { - } - } - - xRet = new OColumn(_rName, - sTypeName, - xRow->getString(13), - xRow->getString(12), - xRow->getInt(11), - nPrec, - xRow->getInt(9), - nType, - bAutoIncrement,sal_False,sal_False,sal_True); - break; - } - } - ::comphelper::disposeComponent(xResult); - } - - return xRet; -} - -// ------------------------------------------------------------------------- -void OColumns::impl_refresh() throw(RuntimeException) -{ - m_pTable->refreshColumns(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OColumns::createDescriptor() -{ - return new OColumn(sal_True); -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - ::osl::MutexGuard aGuard(m_rMutex); - if ( m_pTable->isNew() ) - return cloneDescriptor( descriptor ); - - ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - ::rtl::OUString sQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - m_pTable->beginTransAction(); - try - { - aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName()); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD (")); - aSql += ::dbtools::quoteName(sQuote,_rForName); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - aSql += OTables::getColumnSqlType(descriptor); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" )")); - - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement(); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - m_pTable->alterNotNullValue(getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))),_rForName); - } - catch(const Exception&) - { - m_pTable->rollbackTransAction(); - throw; - } - m_pTable->endTransAction(); - - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -// XDrop -void OColumns::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) -{ - OSL_ENSURE(m_pTable,"OColumns::dropByName: Table is null!"); - if(!m_pTable->isNew()) - { - ::rtl::OUString aSql(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - ::rtl::OUString sQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - aSql += ::dbtools::quoteName(sQuote,m_pTable->getSchema()) + sDot + ::dbtools::quoteName(sQuote,m_pTable->getTableName()); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP ")); - aSql += ::dbtools::quoteName(sQuote,_sElementName); - - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx deleted file mode 100644 index 33923c56a69d..000000000000 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ /dev/null @@ -1,274 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <cppuhelper/typeprovider.hxx> -#include "adabas/BConnection.hxx" -#include "adabas/BDriver.hxx" -#include "adabas/BCatalog.hxx" -#include "odbc/OFunctions.hxx" -#include "odbc/OTools.hxx" -#include "adabas/BDatabaseMetaData.hxx" -#include "adabas/BStatement.hxx" -#include "adabas/BPreparedStatement.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include <connectivity/dbcharset.hxx> -#include "connectivity/sqliterator.hxx" -#include <connectivity/sqlparse.hxx> - -#include <string.h> - -using namespace connectivity::adabas; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - - -//------------------------------------------------------------------------------ -namespace starlang = ::com::sun::star::lang; -// -------------------------------------------------------------------------------- -OAdabasConnection::OAdabasConnection(const SQLHANDLE _pDriverHandle, connectivity::odbc::ODBCDriver* _pDriver) - : OConnection_BASE2(_pDriverHandle,_pDriver) -{ - m_bUseOldDateFormat = sal_True; -} -//----------------------------------------------------------------------------- -SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - m_aConnectionHandle = SQL_NULL_HANDLE; - setURL(url); - setConnectionInfo(info); - - // Connection allozieren - N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle); - if(m_aConnectionHandle == SQL_NULL_HANDLE) - throw SQLException(); - - const PropertyValue *pBegin = info.getConstArray(); - const PropertyValue *pEnd = pBegin + info.getLength(); - ::rtl::OUString sHostName; - - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - sal_Int32 nTimeout = 20; - for(;pBegin != pEnd;++pBegin) - { - if ( !pBegin->Name.compareToAscii("Timeout") ) - pBegin->Value >>= nTimeout; - else if(!pBegin->Name.compareToAscii("user")) - pBegin->Value >>= aUID; - else if(!pBegin->Name.compareToAscii("password")) - pBegin->Value >>= aPWD; - else if(!pBegin->Name.compareToAscii("HostName")) - pBegin->Value >>= sHostName; - else if(0 == pBegin->Name.compareToAscii("CharSet")) - { - ::rtl::OUString sIanaName; - OSL_VERIFY( pBegin->Value >>= sIanaName ); - - ::dbtools::OCharsetMap aLookupIanaName; - ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(sIanaName, ::dbtools::OCharsetMap::IANA()); - if (aLookup != aLookupIanaName.end()) - m_nTextEncoding = (*aLookup).getEncoding(); - else - m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW; - if(m_nTextEncoding == RTL_TEXTENCODING_DONTKNOW) - m_nTextEncoding = osl_getThreadTextEncoding(); - } - } - m_sUser = aUID; - - if ( sHostName.getLength() ) - aDSN = sHostName + rtl::OUString(static_cast<sal_Unicode>(':')) + aDSN; - SQLRETURN nSQLRETURN = openConnectionWithAuth(aDSN,nTimeout, aUID,aPWD); - - return nSQLRETURN; -} -//----------------------------------------------------------------------------- -SQLRETURN OAdabasConnection::openConnectionWithAuth(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd) -{ - if (m_aConnectionHandle == SQL_NULL_HANDLE) - return -1; - - SQLRETURN nSQLRETURN = 0; - SDB_ODBC_CHAR szDSN[4096]; - SDB_ODBC_CHAR szUID[20]; - SDB_ODBC_CHAR szPWD[20]; - - memset(szDSN,'\0',4096); - memset(szUID,'\0',20); - memset(szPWD,'\0',20); - - ::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,getTextEncoding())); - ::rtl::OString aUID(::rtl::OUStringToOString(_uid,getTextEncoding())); - ::rtl::OString aPWD(::rtl::OUStringToOString(_pwd,getTextEncoding())); - memcpy(szDSN, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength())); - memcpy(szUID, (SDB_ODBC_CHAR*) aUID.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength())); - memcpy(szPWD, (SDB_ODBC_CHAR*) aPWD.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength())); - - - - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_INTEGER); - // Verbindung aufbauen - - nSQLRETURN = N3SQLConnect(m_aConnectionHandle, - szDSN, - (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()), - szUID, - (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength()), - szPWD, - (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength())); - if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) - return nSQLRETURN; - - m_bClosed = sal_False; - - // autocoomit ist immer default - - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER); - - return nSQLRETURN; -} - -//------------------------------------------------------------------------------ -void OAdabasConnection::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - - Reference< XTablesSupplier > xTableSupplier(m_xCatalog); - ::comphelper::disposeComponent(xTableSupplier); - - m_xCatalog = WeakReference< XTablesSupplier >(); - - OConnection_BASE2::disposing(); -} -//------------------------------------------------------------------------------ -Reference< XTablesSupplier > OAdabasConnection::createCatalog() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XTablesSupplier > xTab = m_xCatalog; - if(!xTab.is()) - { - xTab = new OAdabasCatalog(m_aConnectionHandle,this); - m_xCatalog = xTab; - } - return xTab; -} -// -------------------------------------------------------------------------------- -Reference< XDatabaseMetaData > SAL_CALL OAdabasConnection::getMetaData( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE2::rBHelper.bDisposed); - - - Reference< XDatabaseMetaData > xMetaData = m_xMetaData; - if(!xMetaData.is()) - { - xMetaData = new OAdabasDatabaseMetaData(m_aConnectionHandle,this); - m_xMetaData = xMetaData; - } - - return xMetaData; -} -// -------------------------------------------------------------------------------- -Reference< XStatement > SAL_CALL OAdabasConnection::createStatement( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE2::rBHelper.bDisposed); - - Reference< XStatement > xReturn = new OAdabasStatement(this); - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} -// -------------------------------------------------------------------------------- -Reference< XPreparedStatement > SAL_CALL OAdabasConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE2::rBHelper.bDisposed); - - Reference< XPreparedStatement > xReturn = new OAdabasPreparedStatement(this,sql); - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} -// ----------------------------------------------------------------------------- -sal_Int64 SAL_CALL OAdabasConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException) -{ - return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - ? reinterpret_cast< sal_Int64 >( this ) - : OConnection_BASE2::getSomething(rId); -} -// ----------------------------------------------------------------------------- -Sequence< sal_Int8 > OAdabasConnection::getUnoTunnelImplementationId() -{ - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} -// ----------------------------------------------------------------------------- -::connectivity::odbc::OConnection* OAdabasConnection::cloneConnection() -{ - return new OAdabasConnection(m_pDriverHandleCopy,m_pDriver); -} -// ----------------------------------------------------------------------------- -::rtl::Reference<OSQLColumns> OAdabasConnection::createSelectColumns(const ::rtl::OUString& _rSql) -{ - ::rtl::Reference<OSQLColumns> aRet; - OSQLParser aParser(getDriver()->getORB()); - ::rtl::OUString sErrorMessage; - OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_rSql); - if(pNode) - { - Reference< XTablesSupplier> xCata = createCatalog(); - OSQLParseTreeIterator aParseIter(this, xCata->getTables(), - aParser, pNode); - aParseIter.traverseAll(); - aRet = aParseIter.getSelectColumns(); - } - return aRet; -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx deleted file mode 100644 index 2dbd6b22266b..000000000000 --- a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "adabas/BDatabaseMetaData.hxx" -#include "FDatabaseMetaDataResultSet.hxx" - -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -::rtl::OUString SAL_CALL OAdabasDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM("sdbc:adabas:")); - aValue += OAdabasDatabaseMetaData_BASE::getURLImpl(); - return aValue; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) -{ - return sal_True; -} -// ----------------------------------------------------------------------------- -Reference< XResultSet > OAdabasDatabaseMetaData::impl_getTypeInfo_throw( ) -{ - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); - Reference< XResultSet > xNewRes = pResult; - static ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; - if(aRows.empty()) - { - aRows.reserve(19); - Reference< XResultSet > xRes = OAdabasDatabaseMetaData_BASE::impl_getTypeInfo_throw(); - - if(xRes.is()) - { - ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(19); - - Reference< XRow> xRow(xRes,UNO_QUERY); - while(xRes->next()) - { - sal_Int32 nPos = 1; - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (1)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (2)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (3)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (4)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (5)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (6)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (7)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (8)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (9)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (10)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (11)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (12)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (13)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (14)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (15)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (16)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (17)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - aRow[nPos++] = new ::connectivity::ORowSetValueDecorator((sal_Int16)xRow->getInt(18)); - if(xRow->wasNull()) - aRow[nPos-1]->setNull(); - - // we have to fix some incorrect entries - if(!aRow[2]->getValue().isNull()) - { - switch((sal_Int32)aRow[2]->getValue()) - { - case DataType::FLOAT: - case DataType::REAL: - case DataType::DOUBLE: - aRow[2]->setValue(DataType::DOUBLE); - aRow[3]->setValue(sal_Int32(18)); - break; - case DataType::TIMESTAMP: - aRow[3]->setValue(sal_Int32(27)); - break; - default: - break; - } - } - aRows.push_back(aRow); - } - } - } - pResult->setRows(aRows); - return xNewRes; -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx deleted file mode 100644 index 664ba0d749d2..000000000000 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ /dev/null @@ -1,1870 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#ifdef SYSTEM_ODBC_HEADERS -#include <sqltypes.h> -#else -#include <odbc/sqltypes.h> -#endif - -#include <unotools/tempfile.hxx> -#include <sal/macros.h> -#include "adabas/BDriver.hxx" -#include "adabas/BConnection.hxx" -#include "odbc/OFunctions.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include "odbc/OTools.hxx" -#include "connectivity/dbexception.hxx" -#include "TConnection.hxx" -#include "diagnose_ex.h" - -#include <osl/process.h> -#include <unotools/ucbhelper.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <unotools/localfilehelper.hxx> -#include "resource/adabas_res.hrc" -#include "resource/sharedresources.hxx" - - -#include <memory> -#include <sys/stat.h> - -#if defined(UNX) -const char sNewLine = '\012'; -#else -const char sNewLine[] = "\015\012"; // \015\012 and not \n -#endif -#define ADABAS_DB_11 "11.02.00" -#define ADABAS_KERNEL_11 "11.02" -#define ADABAS_DB_12 "12.01.00" -#define ADABAS_KERNEL_12 "12.01" -#define CURRENT_DB_VERSION "13.01.00" -#define CURRENT_KERNEL_VERSION "13.01" - -#define OPROCESS_ADABAS (osl_Process_HIDDEN | osl_Process_WAIT | osl_Process_SEARCHPATH) -#define OPROCESS_ADABAS_DBG (osl_Process_WAIT | osl_Process_SEARCHPATH) - - -using namespace connectivity; -namespace connectivity -{ - namespace adabas - { - // extern declaration of the function pointer - extern T3SQLAllocHandle pODBC3SQLAllocHandle; - extern T3SQLConnect pODBC3SQLConnect; - extern T3SQLDriverConnect pODBC3SQLDriverConnect; - extern T3SQLBrowseConnect pODBC3SQLBrowseConnect; - extern T3SQLDataSources pODBC3SQLDataSources; - extern T3SQLDrivers pODBC3SQLDrivers; - extern T3SQLGetInfo pODBC3SQLGetInfo; - extern T3SQLGetFunctions pODBC3SQLGetFunctions; - extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo; - extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr; - extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr; - extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr; - extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr; - extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr; - extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr; - extern T3SQLPrepare pODBC3SQLPrepare; - extern T3SQLBindParameter pODBC3SQLBindParameter; - extern T3SQLSetCursorName pODBC3SQLSetCursorName; - extern T3SQLExecute pODBC3SQLExecute; - extern T3SQLExecDirect pODBC3SQLExecDirect; - extern T3SQLDescribeParam pODBC3SQLDescribeParam; - extern T3SQLNumParams pODBC3SQLNumParams; - extern T3SQLParamData pODBC3SQLParamData; - extern T3SQLPutData pODBC3SQLPutData; - extern T3SQLRowCount pODBC3SQLRowCount; - extern T3SQLNumResultCols pODBC3SQLNumResultCols; - extern T3SQLDescribeCol pODBC3SQLDescribeCol; - extern T3SQLColAttribute pODBC3SQLColAttribute; - extern T3SQLBindCol pODBC3SQLBindCol; - extern T3SQLFetch pODBC3SQLFetch; - extern T3SQLFetchScroll pODBC3SQLFetchScroll; - extern T3SQLGetData pODBC3SQLGetData; - extern T3SQLSetPos pODBC3SQLSetPos; - extern T3SQLBulkOperations pODBC3SQLBulkOperations; - extern T3SQLMoreResults pODBC3SQLMoreResults; - extern T3SQLGetDiagRec pODBC3SQLGetDiagRec; - extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges; - extern T3SQLColumns pODBC3SQLColumns; - extern T3SQLForeignKeys pODBC3SQLForeignKeys; - extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys; - extern T3SQLProcedureColumns pODBC3SQLProcedureColumns; - extern T3SQLProcedures pODBC3SQLProcedures; - extern T3SQLSpecialColumns pODBC3SQLSpecialColumns; - extern T3SQLStatistics pODBC3SQLStatistics; - extern T3SQLTablePrivileges pODBC3SQLTablePrivileges; - extern T3SQLTables pODBC3SQLTables; - extern T3SQLFreeStmt pODBC3SQLFreeStmt; - extern T3SQLCloseCursor pODBC3SQLCloseCursor; - extern T3SQLCancel pODBC3SQLCancel; - extern T3SQLEndTran pODBC3SQLEndTran; - extern T3SQLDisconnect pODBC3SQLDisconnect; - extern T3SQLFreeHandle pODBC3SQLFreeHandle; - extern T3SQLGetCursorName pODBC3SQLGetCursorName; - extern T3SQLNativeSql pODBC3SQLNativeSql; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace utl; -using namespace osl; -using namespace ::dbtools; - - sal_Bool LoadFunctions(oslModule pODBCso); - sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath); - // -------------------------------------------------------------------------------- -void ODriver::fillInfo(const Sequence< PropertyValue >& info, TDatabaseStruct& _rDBInfo) -{ - const PropertyValue* pIter = info.getConstArray(); - const PropertyValue* pEnd = pIter + info.getLength(); - for(;pIter != pEnd;++pIter) - { - if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseName")))) - { - pIter->Value >>= _rDBInfo.sDBName; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")))) - { - pIter->Value >>= _rDBInfo.sControlUser; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))) - { - pIter->Value >>= _rDBInfo.sControlPassword; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")))) - pIter->Value >>= _rDBInfo.nDataIncrement; - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))) - pIter->Value >>= _rDBInfo.bShutDown; - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("User")))) - { - pIter->Value >>= _rDBInfo.sSysUser; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password")))) - { - pIter->Value >>= _rDBInfo.sSysPassword; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DomainPassword")))) - { - pIter->Value >>= _rDBInfo.sDomainPassword; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CacheSize")))) - { - pIter->Value >>= _rDBInfo.sCacheSize; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RestoreDatabase")))) - { - pIter->Value >>= _rDBInfo.bRestoreDatabase; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Backup")))) - { - pIter->Value >>= _rDBInfo.sBackupFile; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataDevSpace")))) - { - pIter->Value >>= _rDBInfo.sDataDevName; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSDEVSPACE")))) - { - pIter->Value >>= _rDBInfo.sSysDevSpace; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRANSACTION_LOG")))) - { - pIter->Value >>= _rDBInfo.sTransLogName; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataDevSize")))) - { - pIter->Value >>= _rDBInfo.nDataSize; - } - else if(pIter->Name.equalsIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LogDevSize")))) - { - pIter->Value >>= _rDBInfo.nLogSize; - } - } -} - - -// -------------------------------------------------------------------------------- -ODriver::ODriver(const Reference< XMultiServiceFactory >& _rxFactory) : ODBCDriver(_rxFactory) -{ - osl_incrementInterlockedCount(&m_refCount); - fillEnvironmentVariables(); - Reference< XComponent > xComponent(m_xORB, UNO_QUERY); - if (xComponent.is()) - { - Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY); - xComponent->addEventListener(xEvtL); - } - osl_decrementInterlockedCount(&m_refCount); -} -//------------------------------------------------------------------------------ -void ODriver::disposing() -{ - ::osl::MutexGuard aGuard(m_aMutex); - ODriver_BASE::disposing(); - Reference< XComponent > xComponent(m_xORB, UNO_QUERY); - if (xComponent.is()) - { - Reference< XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY); - xComponent->removeEventListener(xEvtL); - } - m_xORB.clear(); -} - -// static ServiceInfo -//------------------------------------------------------------------------------ -rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbcx.adabas.ODriver")); -} -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); - aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); - return aSNS; -} -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------ -sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) -{ - const Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; -} -//------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------ -Any SAL_CALL ODriver::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this)); - if ( !aRet.hasValue() ) - aRet = ODriver_BASE::queryInterface(rType); - return aRet.hasValue() ? aRet : ODriver_BASE2::queryInterface(rType); -} -//------------------------------------------------------------------ -Reference< XInterface > SAL_CALL ODriver_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception ) -{ - return *(new ODriver(_rxFac)); -} -// ----------------------------------------------------------------------------- -void SAL_CALL ODriver::disposing( const EventObject& Source ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if(m_xORB.is() && Reference< XMultiServiceFactory >(Source.Source,UNO_QUERY) == m_xORB) - { - TDatabaseMap::iterator aIter = m_aDatabaseMap.begin(); - for(;aIter != m_aDatabaseMap.end();++aIter) - { - if(aIter->second.bShutDown) - { - ::rtl::OUString sName; - if(getDBName(aIter->first,sName)) - { - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHUTDOWN QUICK")),sName,aIter->second.sControlUser,aIter->second.sControlPassword); - X_STOP(sName); - } - } - } - m_xORB.clear(); - } -} -// -------------------------------------------------------------------------------- -Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) -{ - if ( ! acceptsURL(url) ) - return NULL; - - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); - - TDatabaseStruct aDBInfo; - aDBInfo.bShutDown = sal_False; - fillInfo(info,aDBInfo); - aDBInfo.sControlUser = aDBInfo.sControlUser.toAsciiUpperCase(); - aDBInfo.sControlPassword = aDBInfo.sControlPassword.toAsciiUpperCase(); - aDBInfo.sSysUser = aDBInfo.sSysUser.toAsciiUpperCase(); - aDBInfo.sSysPassword = aDBInfo.sSysPassword.toAsciiUpperCase(); - - - TDatabaseMap::iterator aFind = m_aDatabaseMap.find(url); - if(aFind == m_aDatabaseMap.end()) // only when not found yet - m_aDatabaseMap[url] = aDBInfo; - else - { - if(aFind->second.bShutDown != aDBInfo.bShutDown) - aFind->second.bShutDown &= aDBInfo.bShutDown; - } - - ::rtl::OUString sName; - if(aDBInfo.sControlPassword.getLength() && aDBInfo.sControlUser.getLength() && getDBName(url,sName)) - { - // check if we have to add a new data dev space - checkAndInsertNewDevSpace(sName,aDBInfo); - - convertOldVersion(sName,aDBInfo); - // check if we must restart the database - checkAndRestart(sName,aDBInfo); - } - - - if(!m_pDriverHandle) - { - ::rtl::OUString aPath; - if(!EnvironmentHandle(aPath)) - throw SQLException(aPath,*this,::rtl::OUString(),1000,Any()); - } - OAdabasConnection* pCon = new OAdabasConnection(m_pDriverHandle,this); - Reference< XConnection > xCon = pCon; - SQLRETURN nSQLRETURN = pCon->Construct(url,info); - - if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) - { - odbc::OTools::ThrowException(pCon,nSQLRETURN,pCon->getConnection(),SQL_HANDLE_DBC,*this); - } - - m_xConnections.push_back(WeakReferenceHelper(*pCon)); - - return xCon; -} -// ----------------------------------------------------------------------------- -sal_Bool ODriver::getDBName(const ::rtl::OUString& _rName,::rtl::OUString& sDBName) const -{ - sDBName = ::rtl::OUString(); - ::rtl::OUString sName = _rName.copy(12); - sal_Int32 nPos = sName.indexOf(':'); - if(nPos != -1 && nPos < 1) - sDBName = sName.copy(1); - return (nPos != -1 && nPos < 1); -} -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) - throw(SQLException, RuntimeException) -{ - return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:adabas:")),12)); -} -// -------------------------------------------------------------------------------- -Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/) throw(SQLException, RuntimeException) -{ - if ( acceptsURL(url) ) - { - ::std::vector< DriverPropertyInfo > aDriverInfo; - - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Shut down service when closing.")) - ,sal_False - ,::rtl::OUString() - ,Sequence< ::rtl::OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control user name.")) - ,sal_False - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0")) - ,Sequence< ::rtl::OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control password.")) - ,sal_False - ,::rtl::OUString() - ,Sequence< ::rtl::OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data increment (MB).")) - ,sal_False - ,::rtl::OUString() - ,Sequence< ::rtl::OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")) - ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet of the database.")) - ,sal_False - ,::rtl::OUString() - ,Sequence< ::rtl::OUString >()) - ); - return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); - } - - SharedResources aResources; - const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); - ::dbtools::throwGenericSQLException(sMessage ,*this); - return Sequence< DriverPropertyInfo >(); -} -// -------------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODriver::getMajorVersion( ) throw(RuntimeException) -{ - return 1; -} -// -------------------------------------------------------------------------------- -sal_Int32 SAL_CALL ODriver::getMinorVersion( ) throw(RuntimeException) -{ - return 0; -} -// ----------------------------------------------------------------------------- -// XCreateCatalog -void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) throw(SQLException, ElementExistException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); - - try - { - TDatabaseStruct aDBInfo; - fillInfo(info,aDBInfo); - - ::rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DBSERVICE")); - ::rtl::OUString envData(RTL_CONSTASCII_USTRINGPARAM("0")); - osl_setEnvironment(envVar.pData, envData.pData); - - m_sDbRunDir = m_sDbWorkURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/wrk/")) + aDBInfo.sDBName; - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(m_sDbRunDir,sTemp); - m_sDbRunDir = sTemp; - - createNeededDirs(aDBInfo.sDBName); - if(CreateFiles(aDBInfo)) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( - STR_NO_DISK_SPACE, - "$filename$",aDBInfo.sDBName - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } // if(CreateFiles(aDBInfo)) - - createDb(aDBInfo); - } - catch( SQLException&) - { - throw; - } - catch(Exception&) - { - throw SQLException(); - } - -} -// ----------------------------------------------------------------------------- -// XDropCatalog -void SAL_CALL ODriver::dropCatalog( const ::rtl::OUString& /*catalogName*/, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, NoSuchElementException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); - - ::dbtools::throwFeatureNotImplementedException( "!XDropCatalog::dropCatalog", *this ); -} -//----------------------------------------------------------------------------- -// ODBC Environment (common for all Connections): -SQLHANDLE ODriver::EnvironmentHandle(::rtl::OUString &_rPath) -{ - // Has an Environment already been created (for this Instance)? - if (!m_pDriverHandle) - { - SQLHANDLE h = SQL_NULL_HANDLE; - // allocate Environment - - // load ODBC-DLL now: - if (! LoadLibrary_ADABAS(_rPath)) - return SQL_NULL_HANDLE; - - if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) - return SQL_NULL_HANDLE; - - // Save in global Structure... - m_pDriverHandle = h; - SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER); - OSL_UNUSED( nError ); - //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER); - } - - return m_pDriverHandle; -} -// -------------------------------------------------------------------------------- -// XDataDefinitionSupplier -Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if (ODriver_BASE::rBHelper.bDisposed) - throw DisposedException(); - - Reference< XTablesSupplier > xTab; - Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY); - if ( xTunnel.is() ) - { - - OAdabasConnection* pConnection = NULL; - OAdabasConnection* pSearchConnection = reinterpret_cast< OAdabasConnection* >( xTunnel->getSomething(OAdabasConnection::getUnoTunnelImplementationId()) ); - for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) - { - if ( (OAdabasConnection*) Reference< XConnection >::query(i->get().get()).get() == pSearchConnection ) - { - pConnection = pSearchConnection; - break; - } - } - - - if ( pConnection ) - xTab = pConnection->createCatalog(); - } - return xTab; -} - -// -------------------------------------------------------------------------------- -Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) -{ - if ( ! acceptsURL(url) ) - { - SharedResources aResources; - const ::rtl::OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); - ::dbtools::throwGenericSQLException(sMessage ,*this); - } // if ( ! acceptsURL(url) ) - - return getDataDefinitionByConnection(connect(url,info)); -} -// ----------------------------------------------------------------------------- -void SAL_CALL ODriver::acquire() throw() -{ - ODriver_BASE::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL ODriver::release() throw() -{ - ODriver_BASE::release(); -} -ODriver::~ODriver() -{ -} -// ----------------------------------------------------------------------------- -oslGenericFunction ODriver::getOdbcFunction(sal_Int32 _nIndex) const -{ - oslGenericFunction pFunction = NULL; - switch(_nIndex) - { - case ODBC3SQLAllocHandle: - pFunction = (oslGenericFunction)pODBC3SQLAllocHandle;; - break; - case ODBC3SQLConnect: - pFunction = (oslGenericFunction)pODBC3SQLConnect; - break; - case ODBC3SQLDriverConnect: - pFunction = (oslGenericFunction)pODBC3SQLDriverConnect; - break; - case ODBC3SQLBrowseConnect: - pFunction = (oslGenericFunction)pODBC3SQLBrowseConnect; - break; - case ODBC3SQLDataSources: - pFunction = (oslGenericFunction)pODBC3SQLDataSources; - break; - case ODBC3SQLDrivers: - pFunction = (oslGenericFunction)pODBC3SQLDrivers; - break; - case ODBC3SQLGetInfo: - - pFunction = (oslGenericFunction)pODBC3SQLGetInfo; - break; - case ODBC3SQLGetFunctions: - - pFunction = (oslGenericFunction)pODBC3SQLGetFunctions; - break; - case ODBC3SQLGetTypeInfo: - - pFunction = (oslGenericFunction)pODBC3SQLGetTypeInfo; - break; - case ODBC3SQLSetConnectAttr: - - pFunction = (oslGenericFunction)pODBC3SQLSetConnectAttr; - break; - case ODBC3SQLGetConnectAttr: - - pFunction = (oslGenericFunction)pODBC3SQLGetConnectAttr; - break; - case ODBC3SQLSetEnvAttr: - - pFunction = (oslGenericFunction)pODBC3SQLSetEnvAttr; - break; - case ODBC3SQLGetEnvAttr: - - pFunction = (oslGenericFunction)pODBC3SQLGetEnvAttr; - break; - case ODBC3SQLSetStmtAttr: - - pFunction = (oslGenericFunction)pODBC3SQLSetStmtAttr; - break; - case ODBC3SQLGetStmtAttr: - - pFunction = (oslGenericFunction)pODBC3SQLGetStmtAttr; - break; - case ODBC3SQLPrepare: - - pFunction = (oslGenericFunction)pODBC3SQLPrepare; - break; - case ODBC3SQLBindParameter: - - pFunction = (oslGenericFunction)pODBC3SQLBindParameter; - break; - case ODBC3SQLSetCursorName: - - pFunction = (oslGenericFunction)pODBC3SQLSetCursorName; - break; - case ODBC3SQLExecute: - - pFunction = (oslGenericFunction)pODBC3SQLExecute; - break; - case ODBC3SQLExecDirect: - - pFunction = (oslGenericFunction)pODBC3SQLExecDirect; - break; - case ODBC3SQLDescribeParam: - - pFunction = (oslGenericFunction)pODBC3SQLDescribeParam; - break; - case ODBC3SQLNumParams: - - pFunction = (oslGenericFunction)pODBC3SQLNumParams; - break; - case ODBC3SQLParamData: - - pFunction = (oslGenericFunction)pODBC3SQLParamData; - break; - case ODBC3SQLPutData: - - pFunction = (oslGenericFunction)pODBC3SQLPutData; - break; - case ODBC3SQLRowCount: - - pFunction = (oslGenericFunction)pODBC3SQLRowCount; - break; - case ODBC3SQLNumResultCols: - - pFunction = (oslGenericFunction)pODBC3SQLNumResultCols; - break; - case ODBC3SQLDescribeCol: - - pFunction = (oslGenericFunction)pODBC3SQLDescribeCol; - break; - case ODBC3SQLColAttribute: - - pFunction = (oslGenericFunction)pODBC3SQLColAttribute; - break; - case ODBC3SQLBindCol: - - pFunction = (oslGenericFunction)pODBC3SQLBindCol; - break; - case ODBC3SQLFetch: - - pFunction = (oslGenericFunction)pODBC3SQLFetch; - break; - case ODBC3SQLFetchScroll: - - pFunction = (oslGenericFunction)pODBC3SQLFetchScroll; - break; - case ODBC3SQLGetData: - - pFunction = (oslGenericFunction)pODBC3SQLGetData; - break; - case ODBC3SQLSetPos: - - pFunction = (oslGenericFunction)pODBC3SQLSetPos; - break; - case ODBC3SQLBulkOperations: - - pFunction = (oslGenericFunction)pODBC3SQLBulkOperations; - break; - case ODBC3SQLMoreResults: - - pFunction = (oslGenericFunction)pODBC3SQLMoreResults; - break; - case ODBC3SQLGetDiagRec: - - pFunction = (oslGenericFunction)pODBC3SQLGetDiagRec; - break; - case ODBC3SQLColumnPrivileges: - - pFunction = (oslGenericFunction)pODBC3SQLColumnPrivileges; - break; - case ODBC3SQLColumns: - - pFunction = (oslGenericFunction)pODBC3SQLColumns; - break; - case ODBC3SQLForeignKeys: - - pFunction = (oslGenericFunction)pODBC3SQLForeignKeys; - break; - case ODBC3SQLPrimaryKeys: - - pFunction = (oslGenericFunction)pODBC3SQLPrimaryKeys; - break; - case ODBC3SQLProcedureColumns: - - pFunction = (oslGenericFunction)pODBC3SQLProcedureColumns; - break; - case ODBC3SQLProcedures: - - pFunction = (oslGenericFunction)pODBC3SQLProcedures; - break; - case ODBC3SQLSpecialColumns: - - pFunction = (oslGenericFunction)pODBC3SQLSpecialColumns; - break; - case ODBC3SQLStatistics: - - pFunction = (oslGenericFunction)pODBC3SQLStatistics; - break; - case ODBC3SQLTablePrivileges: - - pFunction = (oslGenericFunction)pODBC3SQLTablePrivileges; - break; - case ODBC3SQLTables: - - pFunction = (oslGenericFunction)pODBC3SQLTables; - break; - case ODBC3SQLFreeStmt: - - pFunction = (oslGenericFunction)pODBC3SQLFreeStmt; - break; - case ODBC3SQLCloseCursor: - - pFunction = (oslGenericFunction)pODBC3SQLCloseCursor; - break; - case ODBC3SQLCancel: - - pFunction = (oslGenericFunction)pODBC3SQLCancel; - break; - case ODBC3SQLEndTran: - - pFunction = (oslGenericFunction)pODBC3SQLEndTran; - break; - case ODBC3SQLDisconnect: - - pFunction = (oslGenericFunction)pODBC3SQLDisconnect; - break; - case ODBC3SQLFreeHandle: - - pFunction = (oslGenericFunction)pODBC3SQLFreeHandle; - break; - case ODBC3SQLGetCursorName: - - pFunction = (oslGenericFunction)pODBC3SQLGetCursorName; - break; - case ODBC3SQLNativeSql: - - pFunction = (oslGenericFunction)pODBC3SQLNativeSql; - break; - default: - OSL_FAIL("Function unknown!"); - } - return pFunction; -} -// ----------------------------------------------------------------------------- -void ODriver::createNeededDirs(const ::rtl::OUString& sDBName) -{ - ::rtl::OUString sDbWork,sDBConfig,sTemp; - - if(m_sDbWork.getLength()) - { - sDbWork = m_sDbWorkURL; - if(!UCBContentHelper::IsFolder(m_sDbWorkURL)) - UCBContentHelper::MakeFolder(m_sDbWorkURL); - - sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("wrk")); - if(!UCBContentHelper::IsFolder(sDbWork)) - UCBContentHelper::MakeFolder(sDbWork); - - sDbWork += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - - sTemp = sDbWork; - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("config")); - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); - - sTemp = sDbWork; - sTemp += sDBName; - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); - } - - if(m_sDbConfig.getLength()) - { - sDBConfig = m_sDbConfigURL; - if(!UCBContentHelper::IsFolder(sDBConfig)) - UCBContentHelper::MakeFolder(sDBConfig); - - sDBConfig += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - sTemp = sDBConfig; - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("config")); - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); - - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - sTemp += sDBName; - if(UCBContentHelper::Exists(sTemp)) - UCBContentHelper::Kill(sTemp); - -#if !(defined(WNT)) - sTemp = sDBConfig; - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diag")); - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); - - sTemp = sDBConfig; - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ipc")); - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); - - sTemp = sDBConfig; - sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("spool")); - if(!UCBContentHelper::IsFolder(sTemp)) - UCBContentHelper::MakeFolder(sTemp); -#endif - } -} -// ----------------------------------------------------------------------------- -void ODriver::clearDatabase(const ::rtl::OUString& sDBName) -{ // stop the database - ::rtl::OUString sCommand; -#if defined(WNT) - ::rtl::OUString sStop = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stop")); - const sal_uInt32 nArgsCount = 2; - rtl_uString *pArgs[nArgsCount] = { sDBName.pData, sStop.pData }; -#else - sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_clear")); - const sal_uInt32 nArgsCount = 1; - rtl_uString* pArgs[nArgsCount] = { sDBName.pData }; -#endif - - oslProcess aApp; - -#if OSL_DEBUG_LEVEL > 0 - oslProcessError eError = -#endif - osl_executeProcess(sCommand.pData, pArgs, nArgsCount, - OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData, - NULL, 0, &aApp); - OSL_ENSURE( eError == osl_Process_E_None, "ODriver::clearDatabase: calling the executable failed!" ); -} -// ----------------------------------------------------------------------------- -void ODriver::createDb( const TDatabaseStruct& _aInfo) -{ - - clearDatabase(_aInfo.sDBName); - - X_PARAM(_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword,String::CreateFromAscii("BINIT")); - - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(_aInfo.sSysDevSpace,sTemp); - - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSDEVSPACE")),sTemp); - - sTemp.Erase(); - LocalFileHelper::ConvertURLToPhysicalName(_aInfo.sTransLogName,sTemp); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRANSACTION_LOG")),sTemp); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXUSERTASKS")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("3"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDEVSPACES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("7"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDATADEVSPACES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("5"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXDATAPAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("25599"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXBACKUPDEVS")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MAXSERVERDB")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA_CACHE_PAGES")),_aInfo.sCacheSize); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONV_CACHE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("23"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PROC_DATA_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("40"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RUNDIRECTORY")),m_sDbRunDir); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KERNELTRACESIZE")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100"))); - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOG_QUEUE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10"))); - -#if !defined(WNT) - PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPMSG1")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/dev/null"))); -#endif - - X_PARAM(_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK"))); - - X_START(_aInfo.sDBName); - - // SHOW_STATE() - // %m_sDbRoot%\bin\xutil -d %_aInfo.sDBName% -u %CONUSR%,%CONPWD% -b %INITCMD% - ::rtl::OUString aBatch2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b ")); - - // generate the init file for the database - String sInitFile = getDatabaseInitFile(_aInfo); - - LocalFileHelper::ConvertURLToPhysicalName(sInitFile,sTemp); - aBatch2 += sTemp; - XUTIL(aBatch2,_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sInitFile)) - UCBContentHelper::Kill(sInitFile); -#endif - - // install system tables - installSystemTables(_aInfo); - // now we have to make our SYSDBA user "NOT EXCLUSIVE" - { - String sExt; - sExt.AssignAscii(".sql"); - - String sWorkUrl(m_sDbWorkURL); - ::utl::TempFile aInitFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl); - aInitFile.EnableKillingFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(aInitFile.GetURL(),STREAM_WRITE) ); - (*pFileStream) << "ALTER USER \"" - << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()) - << "\" NOT EXCLUSIVE " - << sNewLine; - pFileStream->Flush(); - } - { // just to get sure that the tempfile still lives - sTemp.Erase(); - LocalFileHelper::ConvertURLToPhysicalName(aInitFile.GetURL(),sTemp); - LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp); - } - } -} - - -//------------------------------------------------------------------------------------------------- -int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME, - const ::rtl::OUString& _USR, - const ::rtl::OUString& _PWD, - const ::rtl::OUString& _CMD) -{ - // %XPARAM% -u %CONUSR%,%CONPWD% BINIT - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - (*pFileStream) << "x_param" -#if defined(WNT) - << ".exe" -#endif - << " -d " - << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding()) - << " -u " - << ::rtl::OString(_USR,_USR.getLength(),gsl_getSystemTextEncoding()) - << "," - << ::rtl::OString(_PWD,_PWD.getLength(),gsl_getSystemTextEncoding()) - << " " - << ::rtl::OString(_CMD,_CMD.getLength(),gsl_getSystemTextEncoding()) -#if defined(WNT) -#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL) - << " >> %DBWORK%\\create.log 2>&1" -#endif -#else -#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL) - << " >> /tmp/kstart.log" -#else - << " > /dev/null" -#endif -#endif - << " " - << sNewLine - << sNewLine; - - pFileStream->Flush(); - } - - oslProcess aApp; - -#if OSL_DEBUG_LEVEL > 0 - oslProcessError eError = -#endif - osl_executeProcess(sCommandFile.pData, NULL, 0, - osl_Process_HIDDEN | osl_Process_WAIT, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - OSL_ENSURE( eError == osl_Process_E_None, "ODriver::X_PARAM: calling the executable failed!" ); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif - - return 0; -} -// ----------------------------------------------------------------------------- -sal_Int32 ODriver::CreateFiles(const TDatabaseStruct& _aInfo) -{ - int nRet = CreateFile(_aInfo.sSysDevSpace,_aInfo.nDataSize/50) ? 0 : -9; - if(!nRet) - nRet = CreateFile(_aInfo.sTransLogName,_aInfo.nLogSize) ? 0 : -10; - if(!nRet) - nRet = CreateFile(_aInfo.sDataDevName,_aInfo.nDataSize) ? 0 : -11; - - return nRet; - -} -// ----------------------------------------------------------------------------- -void ODriver::PutParam(const ::rtl::OUString& sDBName, - const ::rtl::OUString& rWhat, - const ::rtl::OUString& rHow) -{ - const sal_uInt32 nArgsCount = 3; - rtl_uString* pArgs[nArgsCount] = { sDBName.pData, rWhat.pData, rHow.pData }; - - ::rtl::OUString sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("putparam")); -#if defined(WNT) - sCommand += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe")); -#endif - - oslProcess aApp; - - -#if OSL_DEBUG_LEVEL > 0 - oslProcessError eError = -#endif - osl_executeProcess(sCommand.pData, pArgs, nArgsCount, - OPROCESS_ADABAS, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - - OSL_ENSURE( eError == osl_Process_E_None, "ODriver::PutParam: calling the executable failed!" ); -} -// ----------------------------------------------------------------------------- -sal_Bool ODriver::CreateFile(const ::rtl::OUString &_FileName, - sal_Int32 _nSize) -{ -OSL_TRACE("CreateFile %d",_nSize); - sal_Bool bOK = sal_True; - try - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(_FileName,STREAM_WRITE)); - if( !pFileStream.get()) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( - STR_NO_DISK_SPACE, - "$filename$",_FileName - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - sal_Int32 nNewSize = 0; - sal_Int32 nCount = _nSize /2; - for(sal_Int32 i=0; bOK && i < nCount; ++i) - { - nNewSize += 8192;//4096; - bOK = (*pFileStream).SetStreamSize(nNewSize); - pFileStream->Flush(); - } - - bOK = bOK && static_cast<sal_Int32>(pFileStream->Seek(STREAM_SEEK_TO_END)) == nNewSize; - } - catch(Exception&) - { - OSL_TRACE("Exception"); - } - if(!bOK) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( - STR_NO_DISK_SPACE, - "$filename$",_FileName - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - - return bOK; - // dd if=/dev/zero bs=4k of=$DEV_NAME count=$2 -} -// ----------------------------------------------------------------------------- -int ODriver::X_START(const ::rtl::OUString& sDBName) -{ - ::rtl::OUString sCommand; -#if defined(WNT) - - ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d")); - ::rtl::OUString sArg3 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService")); - ::rtl::OUString sArg4 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBWindow")); - - const sal_uInt32 nArgsCount = 4; - rtl_uString* pArgs[nArgsCount] = { sArg1.pData, sDBName.pData, sArg3.pData, sArg4.pData }; - sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("strt.exe")); -#else - const sal_uInt32 nArgsCount = 1; - rtl_uString* pArgs[nArgsCount] = { sDBName.pData }; - sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_start")); -#endif - - oslProcess aApp; - - oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgsCount, - OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData, - NULL, 0, &aApp); - - if(eError == osl_Process_E_NotFound) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( - STR_COMMAND_NOT_FOUND, - "$databasename$",sDBName, - "$progname$",sCommand - ) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - OSL_ASSERT(eError == osl_Process_E_None); - - oslProcessInfo aInfo; - aInfo.Size = sizeof(oslProcessInfo); - - if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code) - return aInfo.Code; - - return 0; -} -// ----------------------------------------------------------------------------- -int ODriver::X_STOP(const ::rtl::OUString& sDBName) -{ - ::rtl::OUString sCommand; -#if defined(WNT) - - ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d")); - ::rtl::OUString sArg2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService")); - - const sal_uInt32 nArgsCount = 3; - rtl_uString* pArgs[nArgsCount] = { sArg1.pData, sDBName.pData, sArg2.pData }; - sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stp.exe")); -#else - const sal_uInt32 nArgsCount = 1; - rtl_uString* pArgs[nArgsCount] = { sDBName.pData }; - sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("x_stop")); -#endif - - oslProcess aApp; - - oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgsCount, - OPROCESS_ADABAS, NULL, m_sDbWorkURL.pData, - NULL, 0, &aApp); - - OSL_ASSERT(eError == osl_Process_E_None); - if(eError != osl_Process_E_None) - return 1; - - oslProcessInfo aInfo; - aInfo.Size = sizeof(oslProcessInfo); - - if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code) - return aInfo.Code; - - return 0; -} -// ----------------------------------------------------------------------------- -void ODriver::XUTIL(const ::rtl::OUString& _rParam, - const ::rtl::OUString& _DBNAME, - const ::rtl::OUString& _USRNAME, - const ::rtl::OUString& _USRPWD) -{ - String sWorkUrl(m_sDbWorkURL); - String sExt = String::CreateFromAscii(".log"); - ::utl::TempFile aCmdFile(String::CreateFromAscii("xutil"),&sExt,&sWorkUrl); - aCmdFile.EnableKillingFile(); - - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - (*pFileStream) << -#if defined(WNT) - "xutil.exe" -#else - "utility" -#endif - << " -u " - << ::rtl::OString(_USRNAME,_USRNAME.getLength(),gsl_getSystemTextEncoding()) - << "," - << ::rtl::OString(_USRPWD,_USRPWD.getLength(),gsl_getSystemTextEncoding()) - << " -d " - << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding()) - << " " - << ::rtl::OString(_rParam,_rParam.getLength(),gsl_getSystemTextEncoding()) - << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << " 2>&1" - << sNewLine; - pFileStream->Flush(); - } - - oslProcess aApp; - - -#if OSL_DEBUG_LEVEL > 0 - oslProcessError eError = -#endif - osl_executeProcess(sCommandFile.pData, NULL, 0, - osl_Process_HIDDEN | osl_Process_WAIT, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - OSL_ENSURE( eError == osl_Process_E_None, "ODriver::XUTIL: calling the executable failed!" ); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif -} -// ----------------------------------------------------------------------------- -void ODriver::LoadBatch(const ::rtl::OUString& sDBName, - const ::rtl::OUString& _rUSR, - const ::rtl::OUString& _rPWD, - const ::rtl::OUString& _rBatch) -{ - OSL_ENSURE(_rBatch.getLength(),"No batch file given!"); - String sWorkUrl(m_sDbWorkURL); - String sExt = String::CreateFromAscii(".log"); - ::utl::TempFile aCmdFile(String::CreateFromAscii("LoadBatch"),&sExt,&sWorkUrl); -#if OSL_DEBUG_LEVEL < 2 - aCmdFile.EnableKillingFile(); -#endif - - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - (*pFileStream) << "xload" -#if defined(WNT) - << ".exe" -#endif - << " -d " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) - << " -u " - << ::rtl::OString(_rUSR,_rUSR.getLength(),gsl_getSystemTextEncoding()) - << "," - << ::rtl::OString(_rPWD,_rPWD.getLength(),gsl_getSystemTextEncoding()); - - if ( !isKernelVersion(CURRENT_DB_VERSION) ) - (*pFileStream) << " -S adabas -b "; - else - (*pFileStream) << " -S NATIVE -b "; - - (*pFileStream) << ::rtl::OString(_rBatch,_rBatch.getLength(),gsl_getSystemTextEncoding()) - << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << " 2>&1" - << sNewLine; - - pFileStream->Flush(); - } - - oslProcess aApp; - - -#if OSL_DEBUG_LEVEL > 0 - oslProcessError eError = -#endif - osl_executeProcess(sCommandFile.pData, NULL, 0, - osl_Process_HIDDEN | osl_Process_WAIT, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - OSL_ENSURE( eError == osl_Process_E_None, "ODriver::LoadBatch: calling the executable failed!" ); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif -} -// ----------------------------------------------------------------------------- -void ODriver::fillEnvironmentVariables() -{ - // read the environment vars - struct env_data - { - const sal_Char* pAsciiEnvName; - ::rtl::OUString* pValue; - ::rtl::OUString* pValueURL; - } EnvData[] = { - { "DBWORK", &m_sDbWork, &m_sDbWorkURL }, - { "DBCONFIG", &m_sDbConfig, &m_sDbConfigURL }, - { "DBROOT", &m_sDbRoot, &m_sDbRootURL } - }; - - for ( size_t i = 0; i < SAL_N_ELEMENTS( EnvData ); ++i ) - { - ::rtl::OUString sVarName = ::rtl::OUString::createFromAscii( EnvData[i].pAsciiEnvName ); - ::rtl::OUString sEnvValue; - if(osl_getEnvironment( sVarName.pData, &sEnvValue.pData ) == osl_Process_E_None ) - { - *EnvData[i].pValue = sEnvValue; - String sURL; - LocalFileHelper::ConvertPhysicalNameToURL( *EnvData[i].pValue, sURL ); - *EnvData[i].pValueURL = sURL; - } - } - - m_sDelimit = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); -} -// ----------------------------------------------------------------------------- -::rtl::OUString ODriver::generateInitFile() const -{ - String sExt; -#if !defined(WNT) - sExt = String::CreateFromAscii(".sh"); -#else - sExt = String::CreateFromAscii(".bat"); -#endif - - String sWorkUrl(m_sDbWorkURL); - ::utl::TempFile aCmdFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl); -#if !defined(WNT) - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - chmod(ByteString(sPhysicalPath,gsl_getSystemTextEncoding()).GetBuffer(),S_IRUSR|S_IWUSR|S_IXUSR); -#endif - -#if !defined(WNT) - SvStream* pFileStream = aCmdFile.GetStream(STREAM_WRITE); - (*pFileStream) << "#!/bin/sh" - << sNewLine - << "cd \"$DBWORK\"" - << sNewLine - << sNewLine; - pFileStream->Flush(); -#endif - - return aCmdFile.GetURL(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString ODriver::getDatabaseInitFile( const TDatabaseStruct& _aDBInfo) -{ - String sExt; - sExt.AssignAscii(".ins"); - - - String sWorkUrl(m_sDbWorkURL); - ::utl::TempFile aInitFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl); - { - SvStream* pFileStream = aInitFile.GetStream(STREAM_WRITE); - (*pFileStream) << "* @(#)init.cmd 6.1.1 1994-11-10\n"; - (*pFileStream) << "init config\n"; - (*pFileStream) << "* default code:\n"; - (*pFileStream) << "ascii\n"; - (*pFileStream) << "* date time format\n"; - (*pFileStream) << "internal\n"; - (*pFileStream) << "* command timeout:\n"; - (*pFileStream) << "900\n"; - (*pFileStream) << "* lock timeout:\n"; - (*pFileStream) << "360\n"; - (*pFileStream) << "* request timeout:\n"; - (*pFileStream) << "180\n"; - (*pFileStream) << "* log mode:\n"; - (*pFileStream) << "demo\n"; - (*pFileStream) << "* log segment size:\n"; - (*pFileStream) << "0\n"; - (*pFileStream) << "* no of archive logs:\n"; - (*pFileStream) << "0\n"; - (*pFileStream) << "* no of data devspaces:\n"; - (*pFileStream) << "1\n"; - (*pFileStream) << "* mirror devspaces:\n"; - (*pFileStream) << "n\n"; - (*pFileStream) << "if $rc <> 0 then stop\n"; - (*pFileStream) << "*--- device description ---\n"; - (*pFileStream) << "* sys devspace name:\n"; - { - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sSysDevSpace,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); - } - (*pFileStream) << "\n* log devspace size:\n"; - (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nLogSize); - (*pFileStream) << "\n* log devspace name:\n"; - { - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sTransLogName,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); - } - (*pFileStream) << "\n* data devspace size:\n"; - (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nDataSize); - (*pFileStream) << "\n* data devspace name:\n"; - { - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sDataDevName,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); - } - - (*pFileStream) << "\n* END INIT CONFIG\n"; - (*pFileStream) << "if $rc <> 0 then stop\n"; - if(_aDBInfo.bRestoreDatabase) - { - (*pFileStream) << "RESTORE DATA QUICK FROM '"; - { - String sTemp; - LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sBackupFile,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); - } - (*pFileStream) << "' BLOCKSIZE 8\n"; - (*pFileStream) << "if $rc <> 0 then stop\n"; - (*pFileStream) << "RESTART\n"; - - } - else - { - (*pFileStream) << "ACTIVATE SERVERDB SYSDBA \""; - (*pFileStream) << ::rtl::OString(_aDBInfo.sSysUser,_aDBInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()); - (*pFileStream) << "\" PASSWORD \""; - (*pFileStream) << ::rtl::OString(_aDBInfo.sSysPassword,_aDBInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding()); - (*pFileStream) << "\"\n"; - } - (*pFileStream) << "if $rc <> 0 then stop\n"; - (*pFileStream) << "exit\n"; - } - return aInitFile.GetURL(); -} -// ----------------------------------------------------------------------------- -void ODriver::X_CONS(const ::rtl::OUString& sDBName,const ::rtl::OString& _ACTION,const ::rtl::OUString& _FILENAME) -{ - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(_FILENAME,sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - - (*pFileStream) << "x_cons" -#if defined(WNT) - << ".exe" -#endif - << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) - << " SHOW " - << _ACTION - << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << sNewLine; - pFileStream->Flush(); - } - - oslProcess aApp; - - osl_executeProcess(sCommandFile.pData, NULL, 0, - osl_Process_HIDDEN | osl_Process_WAIT, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif -} -// ----------------------------------------------------------------------------- -void ODriver::checkAndRestart(const ::rtl::OUString& sDBName,const TDatabaseStruct& _rDbInfo) -{ - String sWorkUrl(m_sDbWorkURL); - String sExt = String::CreateFromAscii(".st"); - ::utl::TempFile aCmdFile(String::CreateFromAscii("State"),&sExt,&sWorkUrl); - aCmdFile.EnableKillingFile(); - - X_CONS(sDBName,"STATE",aCmdFile.GetURL()); - SvStream* pFileStream = aCmdFile.GetStream(STREAM_SHARE_DENYALL); - if ( pFileStream ) - { - ByteString sStateLine; - sal_Bool bRead = sal_True; - sal_Int32 nStart = 2; - while(bRead && !pFileStream->IsEof()) - { - String aLine; - bRead = pFileStream->ReadLine(sStateLine); - if(bRead) - { - if(sStateLine.Search("WARM") != STRING_NOTFOUND) - { // nothing to do - nStart = 0; - break; - } - else if(sStateLine.Search("COLD") != STRING_NOTFOUND) - { - nStart = 1; - break; - } - } - } - switch(nStart) - { - case 2: - clearDatabase(sDBName); - X_START(sDBName); - // don't break here - case 1: - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTART")),sDBName,_rDbInfo.sControlUser,_rDbInfo.sControlPassword); - case 0: - break; - } - } -} -// ----------------------------------------------------------------------------- -sal_Bool ODriver::isVersion(const ::rtl::OUString& sDBName, const char* _pVersion) -{ - String sWorkUrl(m_sDbWorkURL); - String sExt = String::CreateFromAscii(".st"); - ::utl::TempFile aCmdFile(String::CreateFromAscii("DevSpaces"),&sExt,&sWorkUrl); - aCmdFile.EnableKillingFile(); - - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - - (*pFileStream) << "getparam" -#if defined(WNT) - << ".exe" -#endif - << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) - << " KERNELVERSION > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << sNewLine; - } - - oslProcess aApp; - - osl_executeProcess(sCommandFile.pData, NULL, 0, - OPROCESS_ADABAS, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif - SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE); - ByteString sStateLine; - sal_Bool bRead = sal_True; - sal_Bool bIsVersion = sal_False; - while ( pFileStream && bRead && !pFileStream->IsEof() ) - { - bRead = pFileStream->ReadLine(sStateLine); - if ( bRead ) - { - bIsVersion = sStateLine.GetToken(1,' ').Equals(_pVersion) != 0; - break; - } - } - return bIsVersion; -} -// ----------------------------------------------------------------------------- -void ODriver::checkAndInsertNewDevSpace(const ::rtl::OUString& sDBName, - const TDatabaseStruct& _rDBInfo) -{ - // %DBROOT%\pgm\getparam %2 DATA_CACHE_PAGES > %3 - String sWorkUrl(m_sDbWorkURL); - String sExt = String::CreateFromAscii(".st"); - ::utl::TempFile aCmdFile(String::CreateFromAscii("DevSpaces"),&sExt,&sWorkUrl); - aCmdFile.EnableKillingFile(); - - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - - (*pFileStream) << "getparam" -#if defined(WNT) - << ".exe" -#endif - << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) - << " DATA_CACHE_PAGES > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << sNewLine; - } - - oslProcess aApp; - osl_executeProcess(sCommandFile.pData, NULL, 0, - OPROCESS_ADABAS, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif - SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE); - rtl::OString sStateLine; - sal_Bool bRead = sal_True; - sal_Int32 nDataPages = 0; - while(pFileStream && bRead && !pFileStream->IsEof()) - { - bRead = pFileStream->ReadLine(sStateLine); - if(bRead) - { - nDataPages = sStateLine.toInt32(); - if(nDataPages && nDataPages < 100) - { - // the space isn't big enough anymore so we increment it - PutParam(sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA_CACHE_PAGES")),::rtl::OUString::valueOf(nDataPages)); - X_PARAM(sDBName,_rDBInfo.sControlUser,_rDBInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK"))); - } - } - } -} -// ----------------------------------------------------------------------------- -sal_Bool ODriver::isKernelVersion(const char* _pVersion) -{ - ::utl::TempFile aCmdFile(String::CreateFromAscii("KernelVersion")); - aCmdFile.EnableKillingFile(); - - String sPhysicalPath; - LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); - - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - - (*pFileStream) << "dbversion" - << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) - << sNewLine; - } - - oslProcess aApp; - osl_executeProcess(sCommandFile.pData, NULL, 0, - OPROCESS_ADABAS, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); - -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif - SvStream* pFileStream = aCmdFile.GetStream(STREAM_STD_READWRITE); - ByteString sStateLine; - sal_Bool bRead = sal_True; - sal_Bool bIsVersion = sal_True; - while ( pFileStream && bRead && !pFileStream->IsEof() ) - { - bRead = pFileStream->ReadLine(sStateLine); - if ( bRead ) - { - // convert a 11.02.00 to a 12.01.30 version - bIsVersion = sStateLine.GetToken(0).Equals(_pVersion) != 0; - break; - } - } - return bIsVersion; -} -// ----------------------------------------------------------------------------- -void ODriver::installSystemTables( const TDatabaseStruct& _aInfo) -{ -#if defined(WNT) - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% -b %m_sDbRoot%\env\TERMCHAR.ind - ::rtl::OUString aBatch = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b ")); - ::rtl::OUString sTemp2 = m_sDbRootURL + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")) - + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TERMCHAR.ind")); - String sTemp; - sal_Bool bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp); - aBatch += sTemp; - - XUTIL(aBatch,_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% DIAGNOSE TRIGGER OFF - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DIAGNOSE TRIGGER OFF")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - // xload -d %_DBNAME% -u %_SYSDBA_USER%,%_SYSDBA_PWD% -S NATIVE -b %m_sDbRoot%\env\DBS.ins %_DOMAINPWD% - { - sTemp2 = m_sDbRootURL - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")) - + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBS.ins")); - sTemp.Erase(); - bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp); - OSL_ENSURE(bOk,"File could be converted into file system path!"); - sTemp.AppendAscii(" "); - sTemp += String(_aInfo.sDomainPassword); - - LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp); - } - // xload -d %_DBNAME% -u DOMAIN,%_DOMAINPWD% -S NATIVE -b %m_sDbRoot%\env\XDD.ins - { - sTemp2 = m_sDbRootURL - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")) - + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XDD.ins")); - sTemp.Erase(); - bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp); - OSL_ENSURE(bOk,"File could be converted into file system path!"); - - LoadBatch(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOMAIN")),_aInfo.sDomainPassword,sTemp); - } - // xload -d %_DBNAME% -u %_SYSDBA_USER%,%_SYSDBA_PWD% -S NATIVE -b %m_sDbRoot%\env\QP.ins - { - sTemp2 = m_sDbRootURL - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")) - + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QP.ins")); - sTemp.Erase(); - bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp); - OSL_ENSURE(bOk,"File could be converted into file system path!"); - LoadBatch(_aInfo.sDBName,_aInfo.sSysUser,_aInfo.sSysPassword,sTemp); - } - // xload -d %_DBNAME% -u DOMAIN,%_DOMAINPWD% -S NATIVE -b %m_sDbRoot%\env\SPROC.ins - { - sTemp2 = m_sDbRootURL - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")) - + m_sDelimit - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SPROC.ins")); - sTemp.Erase(); - bOk = LocalFileHelper::ConvertURLToPhysicalName(sTemp2,sTemp); - OSL_ENSURE(bOk,"File could be converted into file system path!"); - - LoadBatch(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOMAIN")),_aInfo.sDomainPassword,sTemp); - } - - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% DIAGNOSE TRIGGER ON - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DIAGNOSE TRIGGER ON")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% SET NOLOG OFF - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET NOLOG OFF")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% SHUTDOWN QUICK - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SHUTDOWN QUICK")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% RESTART - XUTIL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTART")),_aInfo.sDBName,_aInfo.sControlUser,_aInfo.sControlPassword); - -#else // UNX - ::rtl::OUString sCommandFile = generateInitFile(); - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); - pFileStream->Seek(STREAM_SEEK_TO_END); - (*pFileStream) << "x_dbinst" - << " -d " - << ::rtl::OString(_aInfo.sDBName,_aInfo.sDBName.getLength(),gsl_getSystemTextEncoding()) - << " -u " - << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()) - << "," - << ::rtl::OString(_aInfo.sSysPassword,_aInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding()) - << " -w " - << ::rtl::OString(_aInfo.sDomainPassword,_aInfo.sDomainPassword.getLength(),gsl_getSystemTextEncoding()) - << " -b "; - - if ( isKernelVersion(ADABAS_KERNEL_11) ) - (*pFileStream) << "-i all"; - (*pFileStream) -#if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL) - << " >> /tmp/kstart.log" -#else - << " > /dev/null" -#endif - << sNewLine - << sNewLine; - pFileStream->Flush(); - } - // now execute the command - - oslProcess aApp; - osl_executeProcess(sCommandFile.pData, NULL, 0, - osl_Process_WAIT | osl_Process_HIDDEN, - NULL, m_sDbWorkURL.pData, NULL, 0, &aApp); -#if OSL_DEBUG_LEVEL < 2 - if(UCBContentHelper::Exists(sCommandFile)) - UCBContentHelper::Kill(sCommandFile); -#endif - -#endif //WNT,UNX -} -// ----------------------------------------------------------------------------- -void ODriver::convertOldVersion(const ::rtl::OUString& sDBName,const TDatabaseStruct& _rDbInfo) -{ - // first we have to check if this databse is a old version and we have to update the system tables - if ( !isVersion(sDBName,CURRENT_DB_VERSION) && isKernelVersion(CURRENT_DB_VERSION) ) - { - if ( !_rDbInfo.sControlUser.getLength() - || !_rDbInfo.sControlPassword.getLength()) - { - ::connectivity::SharedResources aResources; - const ::rtl::OUString sError( aResources.getResourceString(STR_DATABASE_NEEDS_CONVERTING) ); - ::dbtools::throwGenericSQLException(sError,*this); - } - String sCommandFile = m_sDbWorkURL; - sCommandFile += String::CreateFromAscii("/xparam.prt"); - if ( UCBContentHelper::Exists(sCommandFile) ) - UCBContentHelper::Kill(sCommandFile); - X_PARAM(sDBName,_rDbInfo.sControlUser,_rDbInfo.sControlPassword,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BCHECK"))); - - if ( UCBContentHelper::Exists(sCommandFile) ) - { - { - ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READ) ); - ByteString sStateLine; - sal_Bool bRead = sal_True; - static ByteString s_ErrorId("-21100"); - while ( pFileStream.get() && bRead && !pFileStream->IsEof() ) - { - bRead = pFileStream->ReadLine(sStateLine); - if ( bRead && s_ErrorId == sStateLine.GetToken(0,' ') ) - { - UCBContentHelper::Kill(sCommandFile); - ::rtl::OUString sError(::rtl::OUString::createFromAscii(sStateLine.GetBuffer())); - throw SQLException(sError,*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")),1000,Any()); - } - } - } - - UCBContentHelper::Kill(sCommandFile); - } - } -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - } // namespace adabas -}// namespace connectivity -// ----------------------------------------------------------------------------- - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BFunctions.cxx b/connectivity/source/drivers/adabas/BFunctions.cxx deleted file mode 100644 index 65172f5d479f..000000000000 --- a/connectivity/source/drivers/adabas/BFunctions.cxx +++ /dev/null @@ -1,256 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -//-------------------------------------------------------------------------- -#include "odbc/OFunctions.hxx" -#include <osl/process.h> - -// Implib-Definitionen fuer ODBC-DLL/shared library: - -namespace connectivity -{ - namespace adabas - { - T3SQLAllocHandle pODBC3SQLAllocHandle; -T3SQLConnect pODBC3SQLConnect; -T3SQLDriverConnect pODBC3SQLDriverConnect; -T3SQLBrowseConnect pODBC3SQLBrowseConnect; -T3SQLDataSources pODBC3SQLDataSources; -T3SQLDrivers pODBC3SQLDrivers; -T3SQLGetInfo pODBC3SQLGetInfo; -T3SQLGetFunctions pODBC3SQLGetFunctions; -T3SQLGetTypeInfo pODBC3SQLGetTypeInfo; -T3SQLSetConnectAttr pODBC3SQLSetConnectAttr; -T3SQLGetConnectAttr pODBC3SQLGetConnectAttr; -T3SQLSetEnvAttr pODBC3SQLSetEnvAttr; -T3SQLGetEnvAttr pODBC3SQLGetEnvAttr; -T3SQLSetStmtAttr pODBC3SQLSetStmtAttr; -T3SQLGetStmtAttr pODBC3SQLGetStmtAttr; -T3SQLPrepare pODBC3SQLPrepare; -T3SQLBindParameter pODBC3SQLBindParameter; -T3SQLSetCursorName pODBC3SQLSetCursorName; -T3SQLExecute pODBC3SQLExecute; -T3SQLExecDirect pODBC3SQLExecDirect; -T3SQLDescribeParam pODBC3SQLDescribeParam; -T3SQLNumParams pODBC3SQLNumParams; -T3SQLParamData pODBC3SQLParamData; -T3SQLPutData pODBC3SQLPutData; -T3SQLRowCount pODBC3SQLRowCount; -T3SQLNumResultCols pODBC3SQLNumResultCols; -T3SQLDescribeCol pODBC3SQLDescribeCol; -T3SQLColAttribute pODBC3SQLColAttribute; -T3SQLBindCol pODBC3SQLBindCol; -T3SQLFetch pODBC3SQLFetch; -T3SQLFetchScroll pODBC3SQLFetchScroll; -T3SQLGetData pODBC3SQLGetData; -T3SQLSetPos pODBC3SQLSetPos; -T3SQLBulkOperations pODBC3SQLBulkOperations; -T3SQLMoreResults pODBC3SQLMoreResults; -T3SQLGetDiagRec pODBC3SQLGetDiagRec; -T3SQLColumnPrivileges pODBC3SQLColumnPrivileges; -T3SQLColumns pODBC3SQLColumns; -T3SQLForeignKeys pODBC3SQLForeignKeys; -T3SQLPrimaryKeys pODBC3SQLPrimaryKeys; -T3SQLProcedureColumns pODBC3SQLProcedureColumns; -T3SQLProcedures pODBC3SQLProcedures; -T3SQLSpecialColumns pODBC3SQLSpecialColumns; -T3SQLStatistics pODBC3SQLStatistics; -T3SQLTablePrivileges pODBC3SQLTablePrivileges; -T3SQLTables pODBC3SQLTables; -T3SQLFreeStmt pODBC3SQLFreeStmt; -T3SQLCloseCursor pODBC3SQLCloseCursor; -T3SQLCancel pODBC3SQLCancel; -T3SQLEndTran pODBC3SQLEndTran; -T3SQLDisconnect pODBC3SQLDisconnect; -T3SQLFreeHandle pODBC3SQLFreeHandle; -T3SQLGetCursorName pODBC3SQLGetCursorName; -T3SQLNativeSql pODBC3SQLNativeSql; - - -sal_Bool LoadFunctions(oslModule pODBCso); -// ------------------------------------------------------------------------- -sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath) -{ - static sal_Bool bLoaded = sal_False; - static oslModule pODBCso = NULL; - - if (bLoaded) - return sal_True; - - rtl_uString* pPath = NULL; - ::rtl::OUString sTemp(RTL_CONSTASCII_USTRINGPARAM("DBROOT")); - if ( osl_getEnvironment(sTemp.pData,&pPath) == osl_Process_E_None && pPath ) - { - -#if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) || defined(MACOSX) - _rPath = ::rtl::OUString(pPath); - _rPath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/lib/")); -#endif - rtl_uString_release(pPath); - } - else - { - _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The variable DBROOT is not set.")); - return sal_False; - } - const sal_Char* pLibraryAsciiName = NULL; - -#if defined(WNT) - pLibraryAsciiName = "SQLOD32.DLL"; -#elif ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) - pLibraryAsciiName = "odbclib.so"; -#elif defined(MACOSX) - pLibraryAsciiName = "odbclib.dylib"; -#endif - if ( !pLibraryAsciiName ) - return sal_False; - - _rPath += ::rtl::OUString::createFromAscii( pLibraryAsciiName ); - pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); - if( !pODBCso) - return sal_False; - - - return bLoaded = LoadFunctions(pODBCso); -} -// ------------------------------------------------------------------------- - -sal_Bool LoadFunctions(oslModule pODBCso) -{ - - if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLAllocHandle")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLConnect")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDriverConnect")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBrowseConnect")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetInfo")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetTypeInfo")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetConnectAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetConnectAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetEnvAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetEnvAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetStmtAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetStmtAttr")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrepare")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindParameter")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetCursorName")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecute")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecDirect")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeParam")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumParams")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLParamData")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPutData")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLRowCount")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumResultCols")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeCol")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColAttribute")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindCol")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetch")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetchScroll")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetData")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetPos")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLMoreResults")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagRec")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumnPrivileges")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumns")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLForeignKeys")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrimaryKeys")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedureColumns")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedures")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSpecialColumns")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLStatistics")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTablePrivileges")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTables")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeStmt")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCloseCursor")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCancel")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLEndTran")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDisconnect")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeHandle")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL ) - return sal_False; - - return sal_True; -} -// ------------------------------------------------------------------------- - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BGroup.cxx b/connectivity/source/drivers/adabas/BGroup.cxx deleted file mode 100644 index 64582b42432b..000000000000 --- a/connectivity/source/drivers/adabas/BGroup.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "adabas/BGroup.hxx" -#include "adabas/BUsers.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include "adabas/BConnection.hxx" -#include <comphelper/types.hxx> - -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -// ------------------------------------------------------------------------- -OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection) : connectivity::sdbcx::OGroup(sal_True) - ,m_pConnection(_pConnection) -{ - construct(); - TStringVector aVector; - m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); -} -// ------------------------------------------------------------------------- -OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection, - const ::rtl::OUString& _Name - ) : connectivity::sdbcx::OGroup(_Name,sal_True) - ,m_pConnection(_pConnection) -{ - construct(); - refreshUsers(); -} -// ------------------------------------------------------------------------- -void OAdabasGroup::refreshUsers() -{ - if(!m_pConnection) - return; - - TStringVector aVector; - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL' AND GROUPNAME = '" )); - aSql += getName( ); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - - Reference< XResultSet > xResult = xStmt->executeQuery(aSql); - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - aVector.push_back(xRow->getString(1)); - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); - - if(m_pUsers) - m_pUsers->reFill(aVector); - else - m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx deleted file mode 100644 index 0211a0a7f5aa..000000000000 --- a/connectivity/source/drivers/adabas/BGroups.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BGroups.hxx" -#include "adabas/BGroup.hxx" -#include "adabas/BTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <comphelper/types.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; -// ------------------------------------------------------------------------- -sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName) -{ - return new OAdabasGroup(m_pConnection,_rName); -} -// ------------------------------------------------------------------------- -void OGroups::impl_refresh() throw(RuntimeException) -{ - m_pParent->refreshGroups(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OGroups::createDescriptor() -{ - // OAdabasGroup* pNew = - return new OAdabasGroup(m_pConnection); -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& /*descriptor*/ ) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USERGROUP " )); - ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - - aSql = aSql + aQuote + _rForName + aQuote; - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -// XDrop -void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USERGROUP " )); - ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - - aSql = aSql + aQuote + _sElementName + aQuote; - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); -} -// ------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BIndex.cxx b/connectivity/source/drivers/adabas/BIndex.cxx deleted file mode 100644 index 7374aded7c5f..000000000000 --- a/connectivity/source/drivers/adabas/BIndex.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BIndex.hxx" -#include "adabas/BIndexColumns.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include "adabas/BTable.hxx" -#include <comphelper/types.hxx> - -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -// ------------------------------------------------------------------------- -OAdabasIndex::OAdabasIndex( OAdabasTable* _pTable, - const ::rtl::OUString& _Name, - const ::rtl::OUString& _Catalog, - sal_Bool _isUnique, - sal_Bool _isPrimaryKeyIndex, - sal_Bool _isClustered - ) : connectivity::sdbcx::OIndex(_Name, - _Catalog, - _isUnique, - _isPrimaryKeyIndex, - _isClustered,sal_True) - ,m_pTable(_pTable) -{ - construct(); - refreshColumns(); -} -// ------------------------------------------------------------------------- -OAdabasIndex::OAdabasIndex(OAdabasTable* _pTable) - : connectivity::sdbcx::OIndex(sal_True) - ,m_pTable(_pTable) -{ - construct(); -} -// ----------------------------------------------------------------------------- - -void OAdabasIndex::refreshColumns() -{ - if(!m_pTable) - return; - - TStringVector aVector; - if(!isNew()) - { - Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(Any(), - m_pTable->getSchema(),m_pTable->getTableName(),sal_False,sal_False); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - ::rtl::OUString aColName; - while(xResult->next()) - { - if(xRow->getString(6) == m_Name) - { - aColName = xRow->getString(9); - if(!xRow->wasNull()) - aVector.push_back(aColName); - } - } - ::comphelper::disposeComponent(xResult); - } - } - if(m_pColumns) - m_pColumns->reFill(aVector); - else - m_pColumns = new OIndexColumns(this,m_aMutex,aVector); -} -// ----------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BIndexColumns.cxx b/connectivity/source/drivers/adabas/BIndexColumns.cxx deleted file mode 100644 index 7365d4c66581..000000000000 --- a/connectivity/source/drivers/adabas/BIndexColumns.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "adabas/BIndexColumns.hxx" -#include "connectivity/sdbcx/VIndexColumn.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include "adabas/BTable.hxx" -#include "adabas/BCatalog.hxx" -#include <comphelper/types.hxx> -#include <comphelper/property.hxx> - -using namespace connectivity::adabas; -using namespace connectivity::sdbcx; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -// ------------------------------------------------------------------------- -ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName) -{ - - Reference< XResultSet > xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getIndexInfo(Any(), - m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),sal_False,sal_False); - - sal_Bool bAsc = sal_True; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - ::rtl::OUString aD(RTL_CONSTASCII_USTRINGPARAM("D")); - while(xResult->next()) - { - if(xRow->getString(9) == _rName) - bAsc = xRow->getString(10) != aD; - } - ::comphelper::disposeComponent(xResult); - } - - xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(Any(), - m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getTableName(),_rName); - - ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - if(xRow->getString(4) == _rName) - { - sal_Int32 nType = xRow->getInt(5); - ::rtl::OUString sTypeName = xRow->getString(6); - sal_Int32 nPrec = xRow->getInt(7); - OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName); - - OIndexColumn* pRet = new OIndexColumn(bAsc, - _rName, - sTypeName, - xRow->getString(13), - xRow->getInt(11), - nPrec, - xRow->getInt(9), - nType, - sal_False,sal_False,sal_False,sal_True); - xRet = pRet; - break; - } - } - ::comphelper::disposeComponent(xResult); - } - - return xRet; -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OIndexColumns::createDescriptor() -{ - return new OIndexColumn(sal_True); -} -// ----------------------------------------------------------------------------- -void OIndexColumns::impl_refresh() throw(::com::sun::star::uno::RuntimeException) -{ - m_pIndex->refreshColumns(); -} -// ----------------------------------------------------------------------------- -ObjectType OIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor ) -{ - return cloneDescriptor( descriptor ); -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx deleted file mode 100644 index b338dfa8c435..000000000000 --- a/connectivity/source/drivers/adabas/BIndexes.cxx +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BIndexes.hxx" -#include "adabas/BIndex.hxx" -#include "adabas/BTable.hxx" -#include "connectivity/sdbcx/VIndex.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/IndexType.hpp> -#include <comphelper/types.hxx> -#include <comphelper/types.hxx> -#include "adabas/BCatalog.hxx" -#include "connectivity/dbexception.hxx" - - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OIndexes::createObject(const ::rtl::OUString& _rName) -{ - ::rtl::OUString aName,aQualifier; - sal_Int32 nLen = _rName.indexOf('.'); - if(nLen != -1) - { - aQualifier = _rName.copy(0,nLen); - aName = _rName.copy(nLen+1); - } - else - aName = _rName; - - - Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(Any(), - m_pTable->getSchema(),m_pTable->getTableName(),sal_False,sal_False); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - if(xRow->getString(6) == aName && (!aQualifier.getLength() || xRow->getString(5) == aQualifier )) - { - OAdabasIndex* pRet = new OAdabasIndex(m_pTable,aName,aQualifier,!xRow->getBoolean(4), - aName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSPRIMARYKEYINDEX")), - xRow->getShort(7) == IndexType::CLUSTERED); - xRet = pRet; - break; - } - } - ::comphelper::disposeComponent(xResult); - } - - return xRet; -} -// ------------------------------------------------------------------------- -void OIndexes::impl_refresh() throw(RuntimeException) -{ - m_pTable->refreshIndexes(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OIndexes::createDescriptor() -{ - return new OAdabasIndex(m_pTable); -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - if ( m_pTable->isNew() ) - ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(this)); - - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE " )); - ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - if(getBOOL(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) - aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNIQUE ")); - aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INDEX ")); - - - if(_rForName.getLength()) - { - aSql = aSql + aQuote + _rForName + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) - + aQuote + m_pTable->getSchema() + aQuote + sDot - + aQuote + m_pTable->getTableName() + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ( ")); - - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - sal_Int32 nCount = xColumns->getCount(); - for(sal_Int32 i=0;i<nCount;++i) - { - xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; - aSql = aSql + (getBOOL(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING))) - ? - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ASC")) - : - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DESC"))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - } - else - { - aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + sDot + aQuote + m_pTable->getTableName() + aQuote; - - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - if(xColumns->getCount() != 1) - throw SQLException(); - - xColumns->getByIndex(0) >>= xColProp; - - aSql = aSql + sDot + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; - } - - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -// XDrop -void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) -{ - if(!m_pTable->isNew()) - { - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _sElementName.indexOf('.'); - aSchema = _sElementName.copy(0,nLen); - aName = _sElementName.copy(nLen+1); - - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP INDEX " )); - ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - if (aSchema.getLength()) - (((aSql += aQuote) += aSchema) += aQuote) += sDot; - - (((aSql += aQuote) += aName) += aQuote) += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); - - (((aSql += aQuote) += m_pTable->getSchema()) += aQuote) += sDot; - ((aSql += aQuote) += m_pTable->getTableName()) += aQuote; - - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx deleted file mode 100644 index 97c38d818efa..000000000000 --- a/connectivity/source/drivers/adabas/BKeys.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BKeys.hxx" -#include "adabas/BTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <comphelper/types.hxx> -#include "adabas/BCatalog.hxx" -#include <comphelper/property.hxx> -#include <connectivity/TKeys.hxx> -#include <connectivity/dbtools.hxx> - - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef OKeysHelper OCollection_TYPE; - -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - if ( getTable()->isNew() ) - { - Reference< XPropertySet > xNewDescriptor( cloneDescriptor( descriptor ) ); - OKeysHelper::cloneDescriptorColumns( descriptor, xNewDescriptor ); - return xNewDescriptor; - } - - sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); - - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); - const ::rtl::OUString aQuote = getTable()->getConnection()->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - aSql += composeTableName( getTable()->getConnection()->getMetaData(), getTable(), ::dbtools::eInTableDefinitions, false, false, true ); - - if(nKeyType == KeyType::PRIMARY) - { - aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER PRIMARY KEY (")); - } - else if(nKeyType == KeyType::FOREIGN) - { - aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY (")); - } - else - throw SQLException(); - - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - - for(sal_Int32 i=0;i<xColumns->getCount();++i) - { - Reference< XPropertySet > xColProp; - xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - - sal_Int32 nUpdateRule = 0, nDeleteRule = 0; - ::rtl::OUString sReferencedName; - - if(nKeyType == KeyType::FOREIGN) - { - nDeleteRule = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE))); - - ::rtl::OUString aName,aSchema; - sReferencedName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); - sal_Int32 nLen = sReferencedName.indexOf('.'); - aSchema = sReferencedName.copy(0,nLen); - aName = sReferencedName.copy(nLen+1); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" REFERENCES ")) - + aQuote + aSchema + aQuote + sDot + aQuote + aName + aQuote; - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); - - for(sal_Int32 i=0;i<xColumns->getCount();++i) - { - Reference< XPropertySet > xColProp; - xColumns->getByIndex(i) >>= xColProp; - aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - - switch(nDeleteRule) - { - case KeyRule::CASCADE: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE ")); - break; - case KeyRule::RESTRICT: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT ")); - break; - case KeyRule::SET_NULL: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL ")); - break; - case KeyRule::SET_DEFAULT: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT ")); - break; - default: - ; - } - } - - Reference< XStatement > xStmt = getTable()->getConnection()->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - // find the name which the database gave the new key - ::rtl::OUString sNewName( _rForName ); - if(nKeyType == KeyType::FOREIGN) - { - const ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - ::rtl::OUString aSchema,aTable; - getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema; - getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= aTable; - Reference< XResultSet > xResult = getTable()->getMetaData()->getImportedKeys( getTable()->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) - ,aSchema - ,aTable); - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - ::rtl::OUString sName = xRow->getString(12); - if ( !m_pElements->exists(sName) ) // this name wasn't inserted yet so it must be te new one - { - descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sName)); - sNewName = sName; - break; - } - } - ::comphelper::disposeComponent(xResult); - } - } - - getTable()->addKey(sNewName,sdbcx::TKeyProperties(new sdbcx::KeyProperties(sReferencedName,nKeyType,nUpdateRule,nDeleteRule))); - return createObject( sNewName ); -} -// ------------------------------------------------------------------------- -::rtl::OUString OKeys::getDropForeignKey() const -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP FOREIGN KEY ")); -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BPreparedStatement.cxx b/connectivity/source/drivers/adabas/BPreparedStatement.cxx deleted file mode 100644 index c217f660d67b..000000000000 --- a/connectivity/source/drivers/adabas/BPreparedStatement.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BPreparedStatement.hxx" -#include "adabas/BResultSet.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include <connectivity/dbexception.hxx> - -using namespace connectivity; -using namespace connectivity::adabas; -using namespace connectivity::odbc; -//------------------------------------------------------------------------------ -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; - -OAdabasPreparedStatement::OAdabasPreparedStatement( OAdabasConnection* _pConnection,const ::rtl::OUString& sql) -: ::connectivity::odbc::OPreparedStatement( _pConnection,sql) -{ - m_aSelectColumns = _pConnection->createSelectColumns(sql); -} -// ----------------------------------------------------------------------------- -OResultSet* OAdabasPreparedStatement::createResulSet() -{ - return new OAdabasResultSet(m_aStatementHandle,this,m_aSelectColumns); -} -// ----------------------------------------------------------------------------- -void OAdabasPreparedStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/) -{ - ::dbtools::throwFeatureNotImplementedException( "bookmarks", *this ); - // adabas doesn't support bookmarks -} -// ----------------------------------------------------------------------------- -void OAdabasPreparedStatement::setResultSetConcurrency(sal_Int32 /*_par0*/) -{ - ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this ); -} -// ----------------------------------------------------------------------------- -void OAdabasPreparedStatement::setResultSetType(sal_Int32 /*_par0*/) -{ - ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this ); -} -// ----------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BResultSet.cxx b/connectivity/source/drivers/adabas/BResultSet.cxx deleted file mode 100644 index 4ce890994092..000000000000 --- a/connectivity/source/drivers/adabas/BResultSet.cxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BResultSet.hxx" -#include "adabas/BResultSetMetaData.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include "odbc/OTools.hxx" - -using namespace connectivity::adabas; -using namespace connectivity::odbc; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; - -// comment: all this movement methods are needed because adabas doesn't support a SQLGetData call when -// the cursor was moved with a call of SQLFetchScroll. So when this is fixed by adabas we can remove this damn thing. - - -sal_Bool SAL_CALL OAdabasResultSet::next( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - - if(m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO) - ++m_nRowPos; - - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasResultSet::first( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - // don't ask why ! - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - - bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO ); - if ( bRet ) - m_nRowPos = 1; - return bRet; -} -// ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OAdabasResultSet::last( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - - m_bEOF = sal_True; - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - // here I know definitely that I stand on the last record - return m_bLastRecord = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO); -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - if(bRet) - m_nRowPos = row; - return bRet; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - if(bRet) - m_nRowPos += row; - return bRet; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasResultSet::previous( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - m_nLastColumnPos = 0; - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); - if(bRet || m_nCurrentFetchState == SQL_NO_DATA) - --m_nRowPos; - return bRet; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OAdabasResultSet::refreshRow( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - // SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_OFF,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); - sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; - if(bRet) - { - m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_RETRIEVE_DATA,(SQLPOINTER)SQL_RD_ON,SQL_IS_UINTEGER); - m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - } - OTools::ThrowException(m_pStatement->getOwnConnection(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); -} -// ----------------------------------------------------------------------------- -Reference< XResultSetMetaData > SAL_CALL OAdabasResultSet::getMetaData( ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - - if(!m_xMetaData.is()) - m_xMetaData = new OAdabasResultSetMetaData(m_pStatement->getOwnConnection(),m_aStatementHandle,m_aSelectColumns); - return m_xMetaData; -} -// ----------------------------------------------------------------------------- - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BResultSetMetaData.cxx b/connectivity/source/drivers/adabas/BResultSetMetaData.cxx deleted file mode 100644 index 18605f519549..000000000000 --- a/connectivity/source/drivers/adabas/BResultSetMetaData.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" - -#include "adabas/BResultSetMetaData.hxx" -#include "adabas/BCatalog.hxx" -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/sdbc/XRow.hpp> - -using namespace com::sun::star::sdbc; -using namespace com::sun::star::uno; -using namespace connectivity::adabas; -using namespace connectivity; - -OAdabasResultSetMetaData::OAdabasResultSetMetaData(odbc::OConnection* _pConnection, SQLHANDLE _pStmt,const ::rtl::Reference<OSQLColumns>& _rSelectColumns ) -: OAdabasResultSetMetaData_BASE(_pConnection,_pStmt) -,m_aSelectColumns(_rSelectColumns) -{ -} -// ------------------------------------------------------------------------- -OAdabasResultSetMetaData::~OAdabasResultSetMetaData() -{ -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL OAdabasResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - sal_Int32 nType = OAdabasResultSetMetaData_BASE::getColumnType( column); - // special handling for float values which could be doubles - ::rtl::OUString sTypeName; - OAdabasCatalog::correctColumnProperties(getPrecision(column),nType,sTypeName); - - return nType; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL OAdabasResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - sal_Int32 nValue = 0; - sal_Bool bFound = sal_False; - if ( m_aSelectColumns.is() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() ) - bFound = (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nValue; - - if ( !bFound ) - nValue = getNumColAttrib(column,SQL_DESC_NULLABLE); - return nValue; -} -// ------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) -{ - if ( m_aSelectColumns.is() && column > 0 && column <= (sal_Int32)m_aSelectColumns->get().size() ) - { - sal_Bool bAutoIncrement = sal_False; - (m_aSelectColumns->get())[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT)) >>= bAutoIncrement; - return bAutoIncrement; - } - - return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE; -} -// ------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BStatement.cxx b/connectivity/source/drivers/adabas/BStatement.cxx deleted file mode 100644 index 6f5cf4028b90..000000000000 --- a/connectivity/source/drivers/adabas/BStatement.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BStatement.hxx" -#include "adabas/BResultSet.hxx" -#include <com/sun/star/lang/DisposedException.hpp> -#include <connectivity/dbexception.hxx> - - -using namespace connectivity::adabas; -using namespace connectivity::odbc; -//------------------------------------------------------------------------------ -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; -using namespace com::sun::star::container; -using namespace com::sun::star::io; -using namespace com::sun::star::util; - -typedef ::connectivity::odbc::OStatement OAdabasStatement_BASE; -// ----------------------------------------------------------------------------- -OResultSet* OAdabasStatement::createResulSet() -{ - return new OAdabasResultSet(m_aStatementHandle,this,m_aSelectColumns); -} -// ----------------------------------------------------------------------------- -void OAdabasStatement::setUsingBookmarks(sal_Bool /*_bUseBookmark*/) -{ - ::dbtools::throwFeatureNotImplementedException( "bookmarks", *this ); - // adabas doesn't support bookmarks -} -// ----------------------------------------------------------------------------- -void OAdabasStatement::setResultSetConcurrency(sal_Int32 /*_par0*/) -{ - ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetConcurrency", *this ); -} -// ----------------------------------------------------------------------------- -void OAdabasStatement::setResultSetType(sal_Int32 /*_par0*/) -{ - ::dbtools::throwFeatureNotImplementedException( "PreparedStatement:ResultSetType", *this ); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OAdabasStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - m_aSelectColumns = m_pOwnConnection->createSelectColumns(sql); - return OAdabasStatement_BASE::execute(sql); -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx deleted file mode 100644 index 512bfbd5ec11..000000000000 --- a/connectivity/source/drivers/adabas/BTable.cxx +++ /dev/null @@ -1,378 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BTable.hxx" -#include "adabas/BTables.hxx" -#include "adabas/BIndexes.hxx" -#include "adabas/BColumns.hxx" -#include "adabas/BKeys.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <cppuhelper/typeprovider.hxx> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <comphelper/sequence.hxx> -#include <comphelper/extract.hxx> -#include <comphelper/types.hxx> -#include "connectivity/dbtools.hxx" -#include "adabas/BCatalog.hxx" - - -using namespace ::comphelper; -using namespace connectivity::adabas; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OAdabasTable::OAdabasTable( sdbcx::OCollection* _pTables, - OAdabasConnection* _pConnection) - :OTable_TYPEDEF(_pTables,_pConnection,sal_True) - ,m_pConnection(_pConnection) -{ - construct(); -} -// ------------------------------------------------------------------------- -OAdabasTable::OAdabasTable( sdbcx::OCollection* _pTables, - OAdabasConnection* _pConnection, - const ::rtl::OUString& _Name, - const ::rtl::OUString& _Type, - const ::rtl::OUString& _Description , - const ::rtl::OUString& _SchemaName, - const ::rtl::OUString& _CatalogName - ) : OTableHelper( _pTables, - _pConnection, - sal_True, - _Name, - _Type, - _Description, - _SchemaName, - _CatalogName) - ,m_pConnection(_pConnection) -{ - construct(); -} -// ----------------------------------------------------------------------------- -sdbcx::OCollection* OAdabasTable::createColumns(const TStringVector& _rNames) -{ - return new OColumns(this,m_aMutex,_rNames); -} -// ----------------------------------------------------------------------------- -sdbcx::OCollection* OAdabasTable::createKeys(const TStringVector& _rNames) -{ - return new OKeys(this,m_aMutex,_rNames); -} -// ----------------------------------------------------------------------------- -sdbcx::OCollection* OAdabasTable::createIndexes(const TStringVector& _rNames) -{ - return new OIndexes(this,m_aMutex,_rNames); -} -//-------------------------------------------------------------------------- -Sequence< sal_Int8 > OAdabasTable::getUnoTunnelImplementationId() -{ - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} - -// com::sun::star::lang::XUnoTunnel -//------------------------------------------------------------------ -sal_Int64 OAdabasTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) -{ - return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - ? reinterpret_cast< sal_Int64 >( this ) - : OTable_TYPEDEF::getSomething(rId); -} -// ------------------------------------------------------------------------- -// XAlterTable -void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed( -#ifdef GCC - ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed -#else - rBHelper.bDisposed -#endif - ); - - if(m_pColumns && !m_pColumns->hasByName(colName)) - throw NoSuchElementException(colName,*this); - - - if(!isNew()) - { - beginTransAction(); - - try - { - // first we have to check what should be altered - Reference<XPropertySet> xProp; - m_pColumns->getByName(colName) >>= xProp; - // first check the types - sal_Int32 nOldType = 0,nNewType = 0,nOldPrec = 0,nNewPrec = 0,nOldScale = 0,nNewScale = 0; - - xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nOldType; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nNewType; - // and precsions and scale - xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nOldPrec; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))>>= nNewPrec; - xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nOldScale; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nNewScale; - - if(nOldType != nNewType || nOldPrec != nNewPrec || nOldScale != nNewScale) - alterColumnType(colName,descriptor); - - // second: check the "is nullable" value - sal_Int32 nOldNullable = 0,nNewNullable = 0; - xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nOldNullable; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)) >>= nNewNullable; - if(nNewNullable != nOldNullable) - alterNotNullValue(nNewNullable,colName); - - // third: check the default values - ::rtl::OUString sNewDefault,sOldDefault; - xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sOldDefault; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)) >>= sNewDefault; - - if(sOldDefault.getLength()) - { - if(sNewDefault.getLength() && sOldDefault != sNewDefault) - alterDefaultValue(sNewDefault,colName); - else if(!sNewDefault.getLength()) - dropDefaultValue(colName); - } - else if(!sOldDefault.getLength() && sNewDefault.getLength()) - addDefaultValue(sNewDefault,colName); - - // now we should look if the name of the column changed - ::rtl::OUString sNewColumnName; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName; - if(!sNewColumnName.equalsIgnoreAsciiCase(colName)) - { - const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "RENAME COLUMN " )) ; - sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name); - sSql += sDot + ::dbtools::quoteName(sQuote,colName); - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); - sSql += ::dbtools::quoteName(sQuote,sNewColumnName); - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } - } - m_pColumns->refresh(); - } - catch(const SQLException&) - { - rollbackTransAction(); - throw; - } - endTransAction(); - } - else - { - if(m_pColumns) - { - m_pColumns->dropByName(colName); - m_pColumns->appendByDescriptor(descriptor); - } - } - -} -// ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OAdabasTable::getName() throw(::com::sun::star::uno::RuntimeException) -{ - ::rtl::OUString sName = m_SchemaName; - if(m_SchemaName.getLength()) - { - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - sName += sDot; - } - sName += m_Name; - return sName; -} -// ----------------------------------------------------------------------------- -void OAdabasTable::alterColumnType(const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor) -{ - ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - sSql += OTables::getColumnSqlType(_xDescriptor); - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName) -{ - ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - - if(_nNewNullable == ColumnValue::NO_NULLS) - { - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL")); - } - else - { - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT NULL")); - } - - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) -{ - ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER ")) + _sNewDefault; - - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::dropDefaultValue(const ::rtl::OUString& _rColName) -{ - ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP DEFAULT")); - - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) -{ - ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ")) + _sNewDefault; - - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::beginTransAction() -{ - try - { - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS BEGIN")) ); - ::comphelper::disposeComponent(xStmt); - } - } - catch(const Exception&) - { - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::endTransAction() -{ - try - { - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS END")) ); - ::comphelper::disposeComponent(xStmt); - } - } - catch(const Exception&) - { - } -} -// ----------------------------------------------------------------------------- -void OAdabasTable::rollbackTransAction() -{ - try - { - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS ROLLBACK")) ); - ::comphelper::disposeComponent(xStmt); - } - } - catch(const Exception&) - { - } -} -// ----------------------------------------------------------------------------- -::rtl::OUString OAdabasTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ) -{ - ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); - const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" COLUMN ")) - + ::dbtools::quoteName(sQuote,_rsColumnName); - return sSql; -} -// ----------------------------------------------------------------------------- - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx deleted file mode 100644 index 8689ef8b87f7..000000000000 --- a/connectivity/source/drivers/adabas/BTables.cxx +++ /dev/null @@ -1,523 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BTables.hxx" -#include "adabas/BViews.hxx" -#include "adabas/BTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include "adabas/BCatalog.hxx" -#include "adabas/BConnection.hxx" -#include <comphelper/extract.hxx> -#include "connectivity/dbtools.hxx" -#include "connectivity/dbexception.hxx" -#include <cppuhelper/interfacecontainer.h> -#include <comphelper/types.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace ::cppu; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace dbtools; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName) -{ - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _rName.indexOf('.'); - aSchema = _rName.copy(0,nLen); - aName = _rName.copy(nLen+1); - - Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")); - - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - if(xResult->next()) // there can be only one table with this name - { - OAdabasTable* pRet = new OAdabasTable(this, static_cast<OAdabasCatalog&>(m_rParent).getConnection(), - aName,xRow->getString(4),xRow->getString(5),aSchema); - xRet = pRet; - } - ::comphelper::disposeComponent(xResult); - } - - return xRet; -} -// ------------------------------------------------------------------------- -void OTables::impl_refresh( ) throw(RuntimeException) -{ - static_cast<OAdabasCatalog&>(m_rParent).refreshTables(); -} -// ------------------------------------------------------------------------- -void OTables::disposing(void) -{ -m_xMetaData.clear(); - OCollection::disposing(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OTables::createDescriptor() -{ - return new OAdabasTable(this,static_cast<OAdabasCatalog&>(m_rParent).getConnection()); -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - createTable(descriptor); - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " )); - ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = pConnection->createStatement( ); - aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON TABLE ")); - ::rtl::OUString sSchema; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema; - if(sSchema.getLength()) - aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; - - aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '")) - + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - xStmt->execute(aSql); - - // columns - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - - aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON COLUMN ")); - if(sSchema.getLength()) - aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; - aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + sDot - + aQuote; - - for(sal_Int32 i=0;i<xColumns->getCount();++i) - { - ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); - if(xColProp.is()) - { - ::rtl::OUString aDescription = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))); - if(aDescription.getLength()) - { - ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '")) - + aDescription - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } - } - } - ::comphelper::disposeComponent(xStmt); -} -// ------------------------------------------------------------------------- -// XDrop -void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) -{ - Reference< XInterface > xObject( getObject( _nPos ) ); - sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); - if (!bIsNew) - { - OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = pConnection->createStatement( ); - - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _sElementName.indexOf('.'); - aSchema = _sElementName.copy(0,nLen); - aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " )); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - Reference<XPropertySet> xProp(xObject,UNO_QUERY); - sal_Bool bIsView; - if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))))) // here we have a view - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW ")); - else - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE ")); - - aSql += m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( ); - aSql += sDot; - aSql += m_xMetaData->getIdentifierQuoteString( ) + aName + m_xMetaData->getIdentifierQuoteString( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - // if no exception was thrown we must delete it from the views - if(bIsView) - { - OViews* pViews = static_cast<OViews*>(static_cast<OAdabasCatalog&>(m_rParent).getPrivateViews()); - if(pViews && pViews->hasByName(_sElementName)) - pViews->dropByNameImpl(_sElementName); - } - } -} -// ------------------------------------------------------------------------- -void OTables::createTable( const Reference< XPropertySet >& descriptor ) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " )); - ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - ::rtl::OUString sSchema; - - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema; - if(sSchema.getLength()) - aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; - else - descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getUserName(). - toAsciiUpperCase() - )); - - aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); - - // columns - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - - Any aTypeName; - sal_Int32 nCount = xColumns->getCount(); - if(!nCount) - ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(this)); - - for(sal_Int32 i=0;i<nCount;++i) - { - if(::cppu::extractInterface(xColProp,xColumns->getByIndex(i)) && xColProp.is()) - { - - aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - aSql += OTables::getColumnSqlType(xColProp); - aSql += OTables::getColumnSqlNotNullDefault(xColProp); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - } - - // keys - - Reference<XKeysSupplier> xKeySup(descriptor,UNO_QUERY); - - Reference<XIndexAccess> xKeys = xKeySup->getKeys(); - if(xKeys.is()) - { - sal_Bool bPKey = sal_False; - for( sal_Int32 key=0; key<xKeys->getCount(); ++key ) - { - if(::cppu::extractInterface(xColProp,xKeys->getByIndex(key)) && xColProp.is()) - { - - sal_Int32 nKeyType = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); - - if(nKeyType == KeyType::PRIMARY) - { - if(bPKey) - throw SQLException(); - - bPKey = sal_True; - xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); - xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); - if(!xColumns->getCount()) - throw SQLException(); - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PRIMARY KEY (")); - for( sal_Int32 column=0; column<xColumns->getCount(); ++column ) - { - if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) - aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - } - else if(nKeyType == KeyType::UNIQUE) - { - xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); - xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); - if(!xColumns->getCount()) - throw SQLException(); - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" UNIQUE (")); - for( sal_Int32 column=0; column<xColumns->getCount(); ++column ) - { - if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) - aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - } - else if(nKeyType == KeyType::FOREIGN) - { - sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELETERULE))); - - xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); - xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); - if(!xColumns->getCount()) - throw SQLException(); - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY ")); - ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); - sal_Int32 nLen = aRefTable.indexOf('.'); - aSchema = aRefTable.copy(0,nLen); - aName = aRefTable.copy(nLen+1); - - aSql += aQuote + aSchema + aQuote + sDot - + aQuote + aName + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); - - for ( sal_Int32 column=0; column<xColumns->getCount(); ++column ) - { - if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) - aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - - switch(nDeleteRule) - { - case KeyRule::CASCADE: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE ")); - break; - case KeyRule::RESTRICT: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT ")); - break; - case KeyRule::SET_NULL: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL ")); - break; - case KeyRule::SET_DEFAULT: - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT ")); - break; - default: - ; - } - } - } - } - } - - if(aSql.lastIndexOf(',') == (aSql.getLength()-1)) - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - else - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); - - OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = pConnection->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - if(getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))).getLength()) - setComments(descriptor); -} -// ----------------------------------------------------------------------------- -void OTables::appendNew(const ::rtl::OUString& _rsNewTable) -{ - insertElement(_rsNewTable,NULL); - - // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any()); - OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners); - while (aListenerLoop.hasMoreElements()) - static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getColumnSqlType(const Reference<XPropertySet>& _rxColProp) -{ - ::rtl::OUString sSql; - sal_Int32 nDataType = 0; - _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nDataType; - switch(nDataType) - { - case DataType::VARBINARY: - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VAR")); - /* run through*/ - case DataType::BINARY: - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")); - break; - default: - { - Any aTypeName = _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)); - if(aTypeName.hasValue() && getString(aTypeName).getLength()) - sSql += getString(aTypeName); - else - sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - } - } - - switch(nDataType) - { - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::FLOAT: - case DataType::REAL: - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); - break; - - case DataType::DECIMAL: - case DataType::NUMERIC: - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")) - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); - break; - case DataType::BINARY: - case DataType::VARBINARY: - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) - + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(") BYTE")); - break; - } - return sSql; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getColumnSqlNotNullDefault(const Reference<XPropertySet>& _rxColProp) -{ - OSL_ENSURE(_rxColProp.is(),"OTables::getColumnSqlNotNullDefault: Column is null!"); - ::rtl::OUString sSql; - ::rtl::OUString aDefault = getString(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); - if(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) - { - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL")); - if(aDefault.getLength()) - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WITH DEFAULT")); - } - else if(aDefault.getLength()) - { - sSql +=::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT '")) + aDefault; - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - } - return sSql; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getTypeString(const Reference< XPropertySet >& _rxColProp) -{ - ::rtl::OUString aValue; - switch(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) - { - case DataType::BIT: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN")); - break; - case DataType::TINYINT: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT")); - break; - case DataType::SMALLINT: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT")); - break; - case DataType::INTEGER: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT")); - break; - case DataType::FLOAT: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT")); - break; - case DataType::REAL: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REAL")); - break; - case DataType::DOUBLE: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); - break; - case DataType::NUMERIC: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); - break; - case DataType::DECIMAL: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); - break; - case DataType::CHAR: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")); - break; - case DataType::VARCHAR: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); - break; - case DataType::LONGVARCHAR: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG VARCHAR")); - break; - case DataType::DATE: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")); - break; - case DataType::TIME: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")); - break; - case DataType::TIMESTAMP: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); - break; - case DataType::BINARY: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR () BYTE")); - break; - case DataType::VARBINARY: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR () BYTE")); - break; - case DataType::LONGVARBINARY: - aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG BYTE")); - break; - } - return aValue; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject) -{ - OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!"); - ::rtl::OUString sName,sTemp; - _xObject->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sName; - if( sName.getLength() ) - { - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - sName += sDot; - } - - _xObject->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sTemp; - sName += sTemp; - - return sName; -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx deleted file mode 100644 index 42b72be0138d..000000000000 --- a/connectivity/source/drivers/adabas/BUser.cxx +++ /dev/null @@ -1,332 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include <sal/macros.h> -#include "adabas/BUser.hxx" -#include "adabas/BGroups.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include "adabas/BConnection.hxx" -#include "connectivity/dbtools.hxx" -#include "connectivity/dbexception.hxx" -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/sdbcx/PrivilegeObject.hpp> -#include "resource/adabas_res.hrc" - -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -// ------------------------------------------------------------------------- -OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection) : connectivity::sdbcx::OUser(sal_True) - ,m_pConnection(_pConnection) -{ - construct(); -} -// ------------------------------------------------------------------------- -OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection, - const ::rtl::OUString& _Name - ) : connectivity::sdbcx::OUser(_Name,sal_True) - ,m_pConnection(_pConnection) -{ - construct(); -} -// ------------------------------------------------------------------------- -void OAdabasUser::refreshGroups() -{ - if(!m_pConnection) - return; - - TStringVector aVector; - aVector.reserve(7); // we don't know the excatly count of users but this should fit the normal need - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '" )); - aSql += getName( ); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - - Reference< XResultSet > xResult = xStmt->executeQuery(aSql); - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - aVector.push_back(xRow->getString(1)); - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); - - if(m_pGroups) - m_pGroups->reFill(aVector); - else - m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this); -} -// ------------------------------------------------------------------------- -OUserExtend::OUserExtend( OAdabasConnection* _pConnection) : OAdabasUser(_pConnection) -{ - construct(); -} -// ------------------------------------------------------------------------- -typedef connectivity::sdbcx::OUser OUser_TYPEDEF; -void OUserExtend::construct() -{ - - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); -} -// ----------------------------------------------------------------------------- -cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const -{ - Sequence< Property > aProps; - describeProperties(aProps); - return new cppu::OPropertyArrayHelper(aProps); -} -// ------------------------------------------------------------------------- -cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper() -{ - return *OUserExtend_PROP::getArrayHelper(); -} -typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER; -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL OAdabasUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException) -{ - if ( objType != PrivilegeObject::TABLE ) - return 0; - - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - - sal_Int32 nRights,nRightsWithGrant; - getAnyTablePrivileges(objName,nRights,nRightsWithGrant); - return nRights; -} -// ----------------------------------------------------------------------------- -void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException) -{ - nRightsWithGrant = nRights = 0; - // first we need to create the sql stmt to select the privs - Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData(); - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - Reference<XStatement> xStmt = m_pConnection->createStatement(); - ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT REFTABLENAME,PRIVILEGES FROM DOMAIN.USR_USES_TAB WHERE REFOBJTYPE <> 'SYSTEM' AND DEFUSERNAME = '" )); - sSql += m_Name; - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND REFTABLENAME = '")); - sSql += sTable; - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - if(xStmt.is()) - { - Reference<XResultSet> xRes = xStmt->executeQuery(sSql); - if(xRes.is()) - { - Reference<XRow> xRow(xRes,UNO_QUERY); - if(xRow.is() && xRes->next()) - { - ::rtl::OUString sPrivs = xRow->getString(2); - - struct _priv_nam - { - const sal_Char* pAsciiName; - sal_Int32 nNumericValue; - } privileges[] = - { - { "INS", Privilege::INSERT }, - { "DEL", Privilege::DELETE }, - { "UPD", Privilege::UPDATE }, - { "ALT", Privilege::ALTER }, - { "SEL", Privilege::SELECT }, - { "REF", Privilege::REFERENCE } - }; - for ( size_t i = 0; i < SAL_N_ELEMENTS( privileges ); ++i ) - { - sal_Int32 nIndex = sPrivs.indexOf( ::rtl::OUString::createFromAscii( privileges[i].pAsciiName ) ); - if ( nIndex == -1 ) - continue; - - nRights |= privileges[i].nNumericValue; - if ( sPrivs.copy( nIndex + 2, 1 ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "+" ) ) ) - nRightsWithGrant |= privileges[i].nNumericValue; - } - } - ::comphelper::disposeComponent(xRes); - } - ::comphelper::disposeComponent(xStmt); - } -} -// ------------------------------------------------------------------------- -sal_Int32 SAL_CALL OAdabasUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException) -{ - if ( objType != PrivilegeObject::TABLE ) - return 0; - - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - - sal_Int32 nRights,nRightsWithGrant; - getAnyTablePrivileges(objName,nRights,nRightsWithGrant); - return nRightsWithGrant; -} -// ------------------------------------------------------------------------- -void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) -{ - if ( objType != PrivilegeObject::TABLE ) - m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_GRANTED,*this); - - ::osl::MutexGuard aGuard(m_aMutex); - ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); - if(sPrivs.getLength()) - { - ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("GRANT ")); - sGrant += sPrivs; - sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); - Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData(); - sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); - sGrant += m_Name; - - Reference<XStatement> xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - xStmt->execute(sGrant); - ::comphelper::disposeComponent(xStmt); - } -} -// ------------------------------------------------------------------------- -void SAL_CALL OAdabasUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException) -{ - if ( objType != PrivilegeObject::TABLE ) - m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_REVOKED,*this); - - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); - if(sPrivs.getLength()) - { - ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("REVOKE ")); - sGrant += sPrivs; - sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); - Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData(); - sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM ")); - sGrant += m_Name; - - Reference<XStatement> xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - xStmt->execute(sGrant); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -// XUser -void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - ::rtl::OUString sAlterPwd(RTL_CONSTASCII_USTRINGPARAM("ALTER PASSWORD \"")); - sAlterPwd += objPassword.toAsciiUpperCase(); - sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" TO \"")) ; - sAlterPwd += newPassword.toAsciiUpperCase(); - sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")) ; - - sal_Bool bDisposeConnection = sal_False; - Reference<XConnection> xConnection = m_pConnection; - if(m_pConnection->getMetaData()->getUserName() != m_Name) - { - OAdabasConnection* pNewConnection = new OAdabasConnection(m_pConnection->getDriverHandle(),m_pConnection->getDriver()); - xConnection = pNewConnection; - if(pNewConnection) - { - Sequence< PropertyValue> aSeq(2); - aSeq.getArray()[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")) ; - aSeq.getArray()[0].Value <<= m_Name; - aSeq.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")) ; - aSeq.getArray()[1].Value <<= objPassword; - pNewConnection->Construct(m_pConnection->getMetaData()->getURL(),aSeq); - } - bDisposeConnection = sal_True; - } - if(xConnection.is()) - { - Reference<XStatement> xStmt = xConnection->createStatement(); - if(xStmt.is()) - xStmt->execute(sAlterPwd); - ::comphelper::disposeComponent(xStmt); - if(bDisposeConnection) - ::comphelper::disposeComponent(xConnection); - } - else - ::dbtools::throwFunctionSequenceException(*this); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OAdabasUser::getPrivilegeString(sal_Int32 nRights) const -{ - ::rtl::OUString sPrivs; - if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT")); - - if((nRights & Privilege::DELETE) == Privilege::DELETE) - { - if(sPrivs.getLength()) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE")); - } - - if((nRights & Privilege::UPDATE) == Privilege::UPDATE) - { - if(sPrivs.getLength()) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE")); - } - - if((nRights & Privilege::ALTER) == Privilege::ALTER) - { - if(sPrivs.getLength()) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER")); - } - - if((nRights & Privilege::SELECT) == Privilege::SELECT) - { - if(sPrivs.getLength()) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT")); - } - - if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) - { - if(sPrivs.getLength()) - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES")); - } - - return sPrivs; -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx deleted file mode 100644 index 5ca28331d904..000000000000 --- a/connectivity/source/drivers/adabas/BUsers.cxx +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BUsers.hxx" -#include "adabas/BUser.hxx" -#include "adabas/BTable.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include "connectivity/sdbcx/IRefreshable.hxx" -#include <comphelper/types.hxx> -#include "connectivity/dbexception.hxx" -#include "connectivity/dbtools.hxx" -#include "resource/adabas_res.hrc" - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OUsers::createObject(const ::rtl::OUString& _rName) -{ - return new OAdabasUser(m_pConnection,_rName); -} -// ------------------------------------------------------------------------- -void OUsers::impl_refresh() throw(RuntimeException) -{ - m_pParent->refreshUsers(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OUsers::createDescriptor() -{ - OUserExtend* pNew = new OUserExtend(m_pConnection); - return pNew; -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USER " )); - ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - - ::rtl::OUString sUserName( _rForName ); - sUserName = sUserName.toAsciiUpperCase(); - descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sUserName)); - aSql += ::dbtools::quoteName(aQuote,sUserName) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PASSWORD ")) - + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD))); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RESOURCE NOT EXCLUSIVE")); - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - if(xStmt.is()) - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -// XDrop -void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) -{ - { - // first we have to check if this user is live relevaant for the database - // which means with out these users the database will miss more than one important system table - ::rtl::OUString sUsers( RTL_CONSTASCII_USTRINGPARAM( "SELECT USERMODE,USERNAME FROM DOMAIN.USERS WHERE USERNAME = '" )); - sUsers += _sElementName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - Reference< XStatement > xStmt = m_pConnection->createStatement(); - if(xStmt.is()) - { - Reference<XResultSet> xRes = xStmt->executeQuery(sUsers); - Reference<XRow> xRow(xRes,UNO_QUERY); - if(xRes.is() && xRow.is() && xRes->next()) // there can only be one user with this name - { - static const ::rtl::OUString sDbaUser( RTL_CONSTASCII_USTRINGPARAM( "DBA" )); - if(xRow->getString(1) == sDbaUser) - { - ::comphelper::disposeComponent(xStmt); - m_pConnection->throwGenericSQLException(STR_USER_NO_DELETE,static_cast< XDrop* >( this )); - } - } - ::comphelper::disposeComponent(xStmt); - } - } - - { - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USER " )); - ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); - aSql += ::dbtools::quoteName(aQuote,_sElementName); - - Reference< XStatement > xStmt = m_pConnection->createStatement( ); - if(xStmt.is()) - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} - -// ------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx deleted file mode 100644 index 4914c08f2902..000000000000 --- a/connectivity/source/drivers/adabas/BViews.cxx +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BViews.hxx" -#include "adabas/BTables.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <com/sun/star/sdbcx/CheckOption.hpp> -#include "adabas/BCatalog.hxx" -#include "adabas/BConnection.hxx" -#include <comphelper/extract.hxx> -#include "connectivity/dbtools.hxx" -#include "connectivity/dbexception.hxx" -#include <cppuhelper/interfacecontainer.h> -#include "connectivity/sdbcx/VView.hxx" -#include <comphelper/types.hxx> - -using namespace ::comphelper; - -using namespace ::cppu; -using namespace connectivity; -using namespace connectivity::adabas; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace dbtools; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -sdbcx::ObjectType OViews::createObject(const ::rtl::OUString& _rName) -{ - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _rName.indexOf('.'); - aSchema = _rName.copy(0,nLen); - aName = _rName.copy(nLen+1); - - ::rtl::OUString sStmt( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT * FROM DOMAIN.SHOW_VIEW WHERE " )); - if(aSchema.getLength()) - { - sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OWNER = '")); - sStmt += aSchema; - sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND ")); - } - sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEWNAME = '")); - sStmt += aName; - sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); - Reference<XConnection> xConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = xConnection->createStatement( ); - Reference< XResultSet > xResult = xStmt->executeQuery(sStmt); - - sdbcx::ObjectType xRet = NULL; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - if(xResult->next()) // there can be only one table with this name - { - connectivity::sdbcx::OView* pRet = new connectivity::sdbcx::OView(sal_True, - aName, - xConnection->getMetaData(), - CheckOption::NONE, - xRow->getString(3), - aSchema); - xRet = pRet; - } - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); - - return xRet; -} -// ------------------------------------------------------------------------- -void OViews::impl_refresh( ) throw(RuntimeException) -{ - static_cast<OAdabasCatalog&>(m_rParent).refreshTables(); -} -// ------------------------------------------------------------------------- -void OViews::disposing(void) -{ -m_xMetaData.clear(); - OCollection::disposing(); -} -// ------------------------------------------------------------------------- -Reference< XPropertySet > OViews::createDescriptor() -{ - Reference<XConnection> xConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - return new connectivity::sdbcx::OView(sal_True,xConnection->getMetaData()); -} -// ------------------------------------------------------------------------- -// XAppend -sdbcx::ObjectType OViews::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - createView(descriptor); - return createObject( _rForName ); -} -// ------------------------------------------------------------------------- -// XDrop -void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) -{ - if(m_bInDrop) - return; - - Reference< XInterface > xObject( getObject( _nPos ) ); - sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); - if (!bIsNew) - { - OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = pConnection->createStatement( ); - - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _sElementName.indexOf('.'); - aSchema = _sElementName.copy(0,nLen); - aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" )); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - - aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( ); - aSql = aSql + sDot; - aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aName + m_xMetaData->getIdentifierQuoteString( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} -// ----------------------------------------------------------------------------- -void OViews::dropByNameImpl(const ::rtl::OUString& elementName) -{ - m_bInDrop = sal_True; - OCollection_TYPE::dropByName(elementName); - m_bInDrop = sal_False; -} -// ----------------------------------------------------------------------------- -void OViews::createView( const Reference< XPropertySet >& descriptor ) -{ - ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " )); - ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); - const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - ::rtl::OUString sSchema,sCommand; - - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema; - if(sSchema.getLength()) - aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; - else - descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(sSchema = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getUserName())); - - aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS ")); - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; - aSql += sCommand; - - OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = pConnection->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - // insert the new view also in the tables collection - OTables* pTables = static_cast<OTables*>(static_cast<OAdabasCatalog&>(m_rParent).getPrivateTables()); - if(pTables) - { - ::rtl::OUString sName = sSchema; - sName += sDot; - sName += getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))); - pTables->appendNew(sName); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/Bservices.cxx b/connectivity/source/drivers/adabas/Bservices.cxx deleted file mode 100644 index aff502930d78..000000000000 --- a/connectivity/source/drivers/adabas/Bservices.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_connectivity.hxx" -#include "adabas/BDriver.hxx" -#include <cppuhelper/factory.hxx> - -using namespace connectivity::adabas; -using ::rtl::OUString; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::lang::XSingleServiceFactory; -using ::com::sun::star::lang::XMultiServiceFactory; - -typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* _pT - ); - -//--------------------------------------------------------------------------------------- -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - sal_Char const* pImplementationName - ) - : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - inline - sal_Bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); - } - catch(...) - { - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = 0; - if (pServiceManager) - { - ProviderRequest aReq(pServiceManager,pImplementationName); - - aReq.CREATE_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), - ODriver_CreateInstance, ::cppu::createSingleFactory) - ; - - if(aReq.xRet.is()) - aReq.xRet->acquire(); - - pRet = aReq.getProvider(); - } - - return pRet; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/adabas/adabas.component b/connectivity/source/drivers/adabas/adabas.component deleted file mode 100755 index 3c359c3d0217..000000000000 --- a/connectivity/source/drivers/adabas/adabas.component +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.sdbcx.adabas.ODriver"> - <service name="com.sun.star.sdbc.Driver"/> - <service name="com.sun.star.sdbcx.Driver"/> - </implementation> -</component> diff --git a/connectivity/source/drivers/adabas/adabas.mxp.map b/connectivity/source/drivers/adabas/adabas.mxp.map deleted file mode 100755 index d1251e372562..000000000000 --- a/connectivity/source/drivers/adabas/adabas.mxp.map +++ /dev/null @@ -1,146 +0,0 @@ -component_getFactory -__mh_dylib_header -___builtin_delete -___builtin_vec_delete -___builtin_vec_new -___check_eh_spec -___cp_pop_exception -___cp_push_exception -___eh_alloc -___get_eh_context -___pure_virtual -___rtti_class -___rtti_si -___rtti_user -___sjthrow -___start_cp_handler -___terminate -_terminate__Fv -dyld_stub_binding_helper -rest_world -save_world -___eh_rtime_match -__floatdisf -___builtin_new -___rtti_ptr -___tf9bad_alloc -__._10bad_typeid -__._8bad_cast -___get_eh_info -___is_pointer__FPv -___throw_type_match_rtti -___vt_10bad_typeid -___vt_8bad_cast -__keymgr_get_per_thread_data -__keymgr_set_per_thread_data -___tf9exception -___ti9exception -___vt_9exception -_what__C9exception -__._9bad_alloc -___vt_9bad_alloc -__._9type_info -___eq__C9type_infoRCB0 -___tf16__user_type_info -___tf9type_info -___ti9type_info -___vt_9type_info -_release__Q312connectivity6adabas7ODriver -_acquire__Q312connectivity6adabas7ODriver -___Q312connectivity6adabas7ODriver -_refreshUsers__Q312connectivity6adabas14OAdabasCatalog -_refreshGroups__Q312connectivity6adabas14OAdabasCatalog -_refreshViews__Q312connectivity6adabas14OAdabasCatalog -_refreshTables__Q312connectivity6adabas14OAdabasCatalog -__._Q312connectivity6adabas12OAdabasGroup -_refreshUsers__Q312connectivity6adabas12OAdabasGroup -__._Q312connectivity6adabas11OAdabasUser -__._Q312connectivity6adabas11OUserExtend -_construct__Q312connectivity6adabas11OUserExtend -___Q312connectivity6adabas11OAdabasUserPQ312connectivity6adabas17OAdabasConnection -__._Q312connectivity6adabas18UStringDescription -___Q312connectivity6adabas18UStringDescriptionPFv_PCc -__._Q312connectivity6adabas10OAdabasKey -_refreshColumns__Q312connectivity6adabas10OAdabasKey -__._Q312connectivity6adabas12OAdabasIndex -_refreshColumns__Q312connectivity6adabas12OAdabasIndex -__._Q312connectivity6adabas12OAdabasTable -_release__Q312connectivity6adabas12OAdabasTable -_acquire__Q312connectivity6adabas12OAdabasTable -_refreshForgeinKeys__Q312connectivity6adabas12OAdabasTableRQ24_STLt6vector2ZQ23rtl8OUStringZQ24_STLt9allocator1ZB2 -_refreshPrimaryKeys__Q312connectivity6adabas12OAdabasTableRQ24_STLt6vector2ZQ23rtl8OUStringZQ24_STLt9allocator1ZB2 -_refreshIndexes__Q312connectivity6adabas12OAdabasTable -_refreshKeys__Q312connectivity6adabas12OAdabasTable -_refreshColumns__Q312connectivity6adabas12OAdabasTable -_setComments__Q312connectivity6adabas7OTablesRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star5beans12XPropertySet -__._Q312connectivity6adabas23OAdabasDatabaseMetaData -__._Q312connectivity6adabas24OAdabasPreparedStatement -__._Q312connectivity6adabas16OAdabasStatement -__._Q312connectivity6adabas16OAdabasResultSet -_initBoundParam__Q312connectivity4odbc18OPreparedStatement -_setStream__Q312connectivity4odbc18OPreparedStatementlRCQ53com3sun4star3unot9Reference1ZQ53com3sun4star2io12XInputStreamln2 -_setBinary__Q312connectivity4odbc18OPreparedStatementllRCQ53com3sun4star3unot8Sequence1ZSc -_getLengthBuf__Q312connectivity4odbc18OPreparedStatementl -_allocBindBuf__Q312connectivity4odbc18OPreparedStatementll -_setChar__Q312connectivity4odbc18OPreparedStatementln2RCQ23rtl8OUString -_putParamData__Q312connectivity4odbc18OPreparedStatementl -_FreeParams__Q312connectivity4odbc18OPreparedStatement -_prepareStatement__Q312connectivity4odbc18OPreparedStatement -__._Q312connectivity4odbc18UStringDescription -___Q312connectivity4odbc18UStringDescriptionPFv_PCc -_disposing__Q312connectivity4odbc15OStatement_Base -_release__Q312connectivity4odbc15OStatement_Base -_acquire__Q312connectivity4odbc15OStatement_Base -__._Q312connectivity4odbc16OStatement_BASE2 -__._Q312connectivity4odbc10OStatement -_setFetchSize__Q312connectivity4odbc15OStatement_Basel -_setCursorName__Q312connectivity4odbc15OStatement_BaseRCQ23rtl8OUString -_setMaxRows__Q312connectivity4odbc15OStatement_Basel -_setMaxFieldSize__Q312connectivity4odbc15OStatement_Basel -_setQueryTimeOut__Q312connectivity4odbc15OStatement_Basel -_isUsingBookmarks__CQ312connectivity4odbc15OStatement_Base -_getFetchSize__CQ312connectivity4odbc15OStatement_Base -_getFetchDirection__CQ312connectivity4odbc15OStatement_Base -_getResultSetType__CQ312connectivity4odbc15OStatement_Base -_getResultSetConcurrency__CQ312connectivity4odbc15OStatement_Base -_getCursorName__CQ312connectivity4odbc15OStatement_Base -_getMaxRows__CQ312connectivity4odbc15OStatement_Base -_getMaxFieldSize__CQ312connectivity4odbc15OStatement_Base -_getQueryTimeOut__CQ312connectivity4odbc15OStatement_Base -_getStmtOption__CQ312connectivity4odbc15OStatement_Bases -_getRowCount__Q312connectivity4odbc15OStatement_Base -_lockIfNecessary__Q312connectivity4odbc15OStatement_BaseRCQ23rtl8OUString -_setWarning__Q312connectivity4odbc15OStatement_BaseRCQ53com3sun4star4sdbc10SQLWarning -_disposeResultSet__Q312connectivity4odbc15OStatement_Base -_getCharColAttrib__Q312connectivity4odbc18OResultSetMetaDatall -_getNumColAttrib__Q312connectivity4odbc18OResultSetMetaDatall -_getResultSetType__CQ312connectivity4odbc10OResultSet -_getResultSetConcurrency__CQ312connectivity4odbc10OResultSet -_getCursorName__CQ312connectivity4odbc10OResultSet -_isBookmarkable__CQ312connectivity4odbc10OResultSet -_setFetchSize__Q312connectivity4odbc10OResultSetl -_setFetchDirection__Q312connectivity4odbc10OResultSetl -_getFetchSize__CQ312connectivity4odbc10OResultSet -_getFetchDirection__CQ312connectivity4odbc10OResultSet -_fillRow__Q312connectivity4odbc10OResultSetl -_releaseBuffer__Q312connectivity4odbc10OResultSet -_allocBuffer__Q312connectivity4odbc10OResultSetUc -_jdbcTypeToOdbc__Q312connectivity4odbc6OToolsl -_getPropertySetInfo__Q312connectivity4odbc26ODatabaseMetaDataResultSet -_release__Q312connectivity4odbc26ODatabaseMetaDataResultSet -_acquire__Q312connectivity4odbc26ODatabaseMetaDataResultSet -_openSpecialColumns__Q312connectivity4odbc26ODatabaseMetaDataResultSetUcRCQ53com3sun4star3uno3AnyRCQ23rtl8OUStringn1lUc -_getResultSetType__CQ312connectivity4odbc26ODatabaseMetaDataResultSet -_getResultSetConcurrency__CQ312connectivity4odbc26ODatabaseMetaDataResultSet -_getCursorName__CQ312connectivity4odbc26ODatabaseMetaDataResultSet -_getFetchSize__CQ312connectivity4odbc26ODatabaseMetaDataResultSet -_getFetchDirection__CQ312connectivity4odbc26ODatabaseMetaDataResultSet -_getSupportedServiceNames_Static__Q312connectivity4odbc10ODBCDriver -_getImplementationName_Static__Q312connectivity4odbc10ODBCDriver -_LoadFunctions__12connectivityP10_oslModuleUc -_OpenConnection__Q312connectivity4odbc11OConnectionRCQ23rtl8OUStringlUc -___tf13bad_exception -___uncatch_exception -___eh_free -___tfv -___dynamic_cast diff --git a/connectivity/source/drivers/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu deleted file mode 100644 index b92067235e15..000000000000 --- a/connectivity/source/drivers/adabas/adabas.xcu +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************************** - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************ --> -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed"> - <node oor:name="sdbc:adabas:*" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbcx.adabas.ODriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Adabas D</value> - </prop> - <node oor:name="Properties"> - <node oor:name="ShutdownDatabase" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - <node oor:name="DataCacheSizeIncrement" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>20</value> - </prop> - </node> - <node oor:name="DataCacheSize" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:int"> - <value>20</value> - </prop> - </node> - <node oor:name="ControlUser" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value></value> - </prop> - </node> - <node oor:name="ControlPassword" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value></value> - </prop> - </node> - <node oor:name="CharSet" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value></value> - </prop> - </node> - <node oor:name="AddIndexAppendix" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="Features"> - <node oor:name="UseSQL92NamingConstraints" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="AppendTableAliasInSelect" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="DisplayVersionColumns" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="UseDOSLineEnds" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="BooleanComparisonMode" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="FormsCheckRequiredFields" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsTableCreation" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="Authentication" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:string"> - <value>UserPassword</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/drivers/adabas/adabas.xml b/connectivity/source/drivers/adabas/adabas.xml deleted file mode 100755 index a8740023988b..000000000000 --- a/connectivity/source/drivers/adabas/adabas.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version='1.0' encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name>adabas</module-name> - <component-description> - <author>Ocke Janssen</author> - <name>com.sun.star.comp.sdbcx.adabas.ODriver</name> - <description> - This is the implementation of the sdbc-adabas bridge. - </description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="final"/> - <supported-service>com.sun.star.sdbc.Driver</supported-service> - </component-description> - <project-build-dependency>cppuhelper</project-build-dependency> - <project-build-dependency>cppu</project-build-dependency> - <project-build-dependency>sal</project-build-dependency> - <runtime-module-dependency>cppuhelper</runtime-module-dependency> - <runtime-module-dependency>cppu</runtime-module-dependency> - <runtime-module-dependency>sal</runtime-module-dependency> - <runtime-module-dependency>osl</runtime-module-dependency> - <runtime-module-dependency>dbtools</runtime-module-dependency> - <runtime-module-dependency>comphelper</runtime-module-dependency> -</module-description> diff --git a/connectivity/source/drivers/adabas/exports.dxp b/connectivity/source/drivers/adabas/exports.dxp deleted file mode 100755 index 70033078921a..000000000000 --- a/connectivity/source/drivers/adabas/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk deleted file mode 100755 index bfc6a3dcfaac..000000000000 --- a/connectivity/source/drivers/adabas/makefile.mk +++ /dev/null @@ -1,114 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJINC=..$/.. -PRJNAME=connectivity -TARGET=adabas - -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ---------------------------------- -.IF "$(DBGUTIL_OJ)"!="" -ENVCFLAGS+=/FR$(SLO)$/ -.ENDIF - -.INCLUDE : $(PRJ)$/makefile.pmk -.INCLUDE : $(PRJ)$/version.mk - -.IF "$(SYSTEM_ODBC_HEADERS)" == "YES" -CFLAGS+=-DSYSTEM_ODBC_HEADERS -.ENDIF - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/BFunctions.obj \ - $(SLO)$/BConnection.obj \ - $(SLO)$/BDriver.obj \ - $(SLO)$/BCatalog.obj \ - $(SLO)$/BGroups.obj \ - $(SLO)$/BGroup.obj \ - $(SLO)$/BUser.obj \ - $(SLO)$/BUsers.obj \ - $(SLO)$/BKeys.obj \ - $(SLO)$/BColumns.obj \ - $(SLO)$/BIndex.obj \ - $(SLO)$/BIndexColumns.obj \ - $(SLO)$/BIndexes.obj \ - $(SLO)$/BTable.obj \ - $(SLO)$/BTables.obj \ - $(SLO)$/BViews.obj \ - $(SLO)$/Bservices.obj \ - $(SLO)$/BDatabaseMetaData.obj \ - $(SLO)$/BPreparedStatement.obj \ - $(SLO)$/BStatement.obj \ - $(SLO)$/BResultSetMetaData.obj \ - $(SLO)$/BResultSet.obj - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -# --- Library ----------------------------------- - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1OBJS=$(SLOFILES) -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(DBTOOLSLIB) \ - $(TOOLSLIB) \ - $(ODBCBASELIB) \ - $(UNOTOOLSLIB) \ - $(COMPHELPERLIB) - -.IF "$(ODBCBASELIB)" == "" -SHL1STDLIBS+=$(ODBCBASELIB) -.ENDIF - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - -# --- Targets ---------------------------------- - - -.INCLUDE : $(PRJ)$/target.pmk - -ALLTAR : $(MISC)/adabas.component - -$(MISC)/adabas.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - adabas.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt adabas.component |