diff options
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r-- | connectivity/source/drivers/file/FCatalog.cxx | 136 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FColumns.cxx | 142 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FConnection.cxx | 451 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FDatabaseMetaData.cxx | 1327 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FDriver.cxx | 219 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FPreparedStatement.cxx | 473 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSet.cxx | 2297 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FResultSetMetaData.cxx | 201 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FStatement.cxx | 358 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FTable.cxx | 201 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FTables.cxx | 161 | ||||
-rw-r--r-- | connectivity/source/drivers/file/file.xml | 70 | ||||
-rw-r--r-- | connectivity/source/drivers/file/makefile.mk | 158 |
13 files changed, 6194 insertions, 0 deletions
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx new file mode 100644 index 000000000000..7e7a38415d8d --- /dev/null +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * $RCSfile: FCatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#include "file/FTables.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ +//#include "file/FEmptyCollection.hxx" +//#endif + +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 connectivity::file; +// ------------------------------------------------------------------------- +OFileCatalog::OFileCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) + ,m_pConnection(_pCon) + ,m_xMetaData(m_pConnection->getMetaData( )) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OFileCatalog::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE; + m_xMetaData = NULL; + OFileCatalog_BASE::disposing(); +} +// ------------------------------------------------------------------------- +void OFileCatalog::refreshTables() +{ + ::std::vector< ::rtl::OUString> aVector; + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("%"); + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(3)); + } + if(m_pTables) + delete m_pTables; + m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector); +} + +// ------------------------------------------------------------------------- +Any SAL_CALL OFileCatalog::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) || + rType == ::getCppuType((const Reference<XUsersSupplier>*)0) || + rType == ::getCppuType((const Reference<XViewsSupplier>*)0)) + return Any(); + + + typedef sdbcx::OCatalog OFileCatalog_BASE; + return OFileCatalog_BASE::queryInterface(rType); +} + diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx new file mode 100644 index 000000000000..a80367236e50 --- /dev/null +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: FColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#include "file/FColumns.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif + +using namespace connectivity::file; +using namespace connectivity; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +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; + +Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) +{ + + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), + m_pTable->getSchema(),m_pTable->getName(),_rName); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + { + if(xRow->getString(4) == _rName) + { + sdbcx::OColumn* pRet = new sdbcx::OColumn(_rName, + xRow->getString(6), + xRow->getString(13), + xRow->getInt(11), + xRow->getInt(7), + xRow->getInt(9), + xRow->getInt(5), + sal_False, + sal_False, + sal_False, + m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + xRet = pRet; + break; + } + } + } + + return xRet; +} + +// ------------------------------------------------------------------------- +void OColumns::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshColumns(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OColumns::createEmptyObject() +{ + sdbcx::OColumn* pRet = new sdbcx::OColumn(m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + Reference< XPropertySet > xRet = pRet; + return xRet; +} + + diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx new file mode 100644 index 000000000000..13295d74c3bb --- /dev/null +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -0,0 +1,451 @@ +/************************************************************************* + * + * $RCSfile: FConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#include "file/FDatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_RESOURCE_HRC_ +#include "Resource.hrc" +#endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#include "file/FDriver.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#include "file/FPreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ +#include <com/sun/star/container/XChild.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ +#include <com/sun/star/ucb/XContent.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_ +#include <com/sun/star/ucb/XContentIdentifier.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_ +#include <com/sun/star/frame/XConfigManager.hpp> +#endif +#ifndef _UCBHELPER_CONTENT_HXX +#include <ucbhelper/content.hxx> +#endif + +using namespace connectivity::file; + +//------------------------------------------------------------------------------ +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::ucb; +using namespace rtl; +// -------------------------------------------------------------------------------- +OConnection::OConnection(OFileDriver* _pDriver) + : OConnection_BASE(m_aMutex), + OSubComponent<OConnection>((::cppu::OWeakObject*)_pDriver), + m_pDriver(_pDriver), + m_bClosed(sal_False), + m_xMetaData(NULL) +{ + ModuleContext::AddRef(); +} +//----------------------------------------------------------------------------- +OConnection::~OConnection() +{ + if(!isClosed( )) + close(); + ModuleContext::ReleaseRef(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OConnection::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OConnection_BASE::release(); +} + +//----------------------------------------------------------------------------- +void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) +{ + osl_incrementInterlockedCount( &m_refCount ); + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetURL(aDSN, INetURLObject::ENCODE_ALL); + + + // String aFileName = aURL.PathToFileName(); + String aFileName = aURL.GetMainURL(); + + if(!aFileName.Len()) + aFileName = aDSN; + String aWildcard; + + if (aURL.GetProtocol() == INET_PROT_FILE) + { + // $Inst mu gesetzt sein + // sehr umstaendlicher weg, um an den Inimanager zu kommen + // aber ohne Arme(Sfx) keine Kekse + Reference< ::com::sun::star::frame::XConfigManager > xSofficeIni( + m_pDriver->getFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY); + + aFileName = xSofficeIni->substituteVariables(aDSN); + } + + ::rtl::OUString aExt; + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii("EXTENSTION")) + pBegin->Value >>= aExt; + } + + m_aFilenameExtension = aExt; + + ::ucb::Content aFile(aFileName,Reference< ::com::sun::star::ucb::XCommandEnvironment >()); + +// if (aFileStat.IsKind(FSYS_KIND_WILD)) +// { +// m_aDirectoryName = (DirEntry(aFileName).GetPath()).GetFull(); +// m_aFilenameExtension = DirEntry(aFileName).GetExtension(); +// +// // nyi: Verschiedene Extensions (aufgrund des angegebenen Wildcard) +// // (bisher keine Wildcard in der Extension moeglich!) +// aWildcard = DirEntry(aFileName).GetName(); +// } else + + // set fields to fetch + Sequence< OUString > aProps(1); + OUString* pProps = aProps.getArray(); + pProps[ 0 ] = OUString::createFromAscii( "Title" ); + + if (aFile.isFolder()) + { + m_xDir = aFile.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); + m_xContent = aFile.get(); + } + else if (aFile.isDocument()) + { + Reference<XContent> xParent(Reference<XChild>(aFile.get(),UNO_QUERY)->getParent(),UNO_QUERY); + Reference<XContentIdentifier> xIdent = xParent->getIdentifier(); + m_xContent = xParent; + + ::ucb::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >()); + m_xDir = aParent.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); + } + else + throw SQLException(); + + if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND) + throw SQLException(); + + osl_decrementInterlockedCount( &m_refCount ); +} +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.file.Connection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OStatement* pStmt = new OStatement(this); + + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo); + pStmt->construct(sql); + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + return NULL; +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sql; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_bAutoCommit = autoCommit; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bAutoCommit; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return OConnection_BASE::rBHelper.bDisposed; +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODatabaseMetaData(this); + + return m_xMetaData; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_bReadOnly = readOnly; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bReadOnly; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return ::rtl::OUString(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// -------------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return NULL; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ +} +// -------------------------------------------------------------------------------- +// XCloseable +void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// -------------------------------------------------------------------------------- +// XWarningsSupplier +Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +//------------------------------------------------------------------------------ +void OConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + // m_aTables.disposing(); + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_aStatements.clear(); + + m_bClosed = sal_True; + m_xMetaData = NULL; + m_xDir = NULL; + + dispose_ChildImpl(); + OConnection_BASE::disposing(); +} +//------------------------------------------------------------------------------ +::com::sun::star::uno::Reference< XTablesSupplier > OConnection::createCatalog() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Reference< XTablesSupplier > xTab = m_xCatalog; + if(!m_xCatalog.get().is()) + { + OFileCatalog *pCat = new OFileCatalog(this); + xTab = pCat; + m_xCatalog = xTab; + } + return xTab; +} + + diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx new file mode 100644 index 000000000000..393273b485c4 --- /dev/null +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -0,0 +1,1327 @@ +/************************************************************************* + * + * $RCSfile: FDatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#include "file/FDatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FDatabaseMetaDataResultSet.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_SEARCHRECURSION_HPP_ +#include <com/sun/star/ucb/SearchRecursion.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_SEARCHCOMMANDARGUMENT_HPP_ +#include <com/sun/star/ucb/SearchCommandArgument.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif + +using namespace com::sun::star::ucb; +using namespace connectivity::file; +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; + +ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) + : m_pConnection(_pCon) +{ + m_pConnection->acquire(); +} +// ------------------------------------------------------------------------- +ODatabaseMetaData::~ODatabaseMetaData() +{ + if (m_pConnection) + m_pConnection->release(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openTypeInfo(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openCatalogs(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aVal; + return aVal; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openSchemas(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openColumnPrivileges(catalog,schema,table,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTablesMap(); +#if 0 + ORows aRows; + + Reference<XContent> xContent = m_pConnection->getContent(); + + Sequence<RuleTerm> aRules(1); + aRules[0].Property = OUString::createFromAscii( "Title" ); + aRules[0].Operand <<= tableNamePattern; + aRules[0].Operator = + aRules[0].CaseSensitive + aRules[0].RegularExpression = sal_False; + + SearchCriterium aCrit(aRules); + + SearchInfo aInfo; + aInfo.Recursion = 0; + aInfo.IncludeBase = sal_False; + aInfo.RespectFolderViewRestrictions = sal_False; + aInfo.RespectDocViewRestrictions = sal_False; + aInfo.FollowIndirections = sal_False; + + Sequence<Property> aProps(1); + aProps[0].Name = OUString::createFromAscii( "Title" ); + aProps[0].Type = ::getCppuType((OUString*)0); + + SearchCommandArgument aArg(aInfo,aProps); + + String aFilenameExtension = m_pConnection->getExtension(); + + + pDir->SetSort(FSYS_SORT_NAME | FSYS_SORT_ASCENDING | FSYS_SORT_END); + pDir->Update(); + + ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + for (sal_uInt16 nDirPos = 0; nDirPos < pDir->Count(); nDirPos++) + { + ORow aRow(3); + if (aFilenameExtension.Len()) + { + if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) + aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); + } + else // keine extension, dann selbst filtern + { + do + { + DirEntry aEntry = (*pDir)[nDirPos]; + if (!(*pDir)[nDirPos].GetExtension().Len()) + { + if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) + aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); + break; + } + else + nDirPos++; + } while ((unsigned int)nDirPos < pDir->Count()); + } + aRow.push_back(makeAny(aTable)); + aRow.push_back(Any()); + aRows.push_back(aRow); + } + + pResult->setRows(aRows); +#endif + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openProcedures(catalog,schemaPattern,procedureNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openVersionColumns(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return STRING_MAXLEN; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 1; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openExportedKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openImportedKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openPrimaryKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openIndexInfo(catalog,schema,table,unique,approximate); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openBestRowIdentifier(catalog,schema,table,scope,nullable); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openTablePrivileges(catalog,schemaPattern,tableNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openForeignKeys(primaryCatalog,primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable, +// foreignCatalog, foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::createFromAscii("\""); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTableTypes(); + ORows aRows; + ORow aRow; + aRow.push_back(Any()); + aRow.push_back(makeAny(::rtl::OUString::createFromAscii("TABLE"))); + aRows.push_back(aRow); + pResult->setRows(aRows); + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::valueOf((sal_Int32)1); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::valueOf((sal_Int32)0); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + return sal_True; + break; + case ResultSetType::SCROLL_INSENSITIVE: + break; + case ResultSetType::SCROLL_SENSITIVE: + break; + } + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx new file mode 100644 index 000000000000..254fd36a9238 --- /dev/null +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * $RCSfile: FDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#include "file/FDriver.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::file; +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; +// -------------------------------------------------------------------------------- +OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + : ODriver_BASE(m_aMutex) + ,m_xFactory(_rxFactory) +{ +} +// -------------------------------------------------------------------------------- +void OFileDriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_xConnections.clear(); + + ODriver_BASE::disposing(); +} + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.driver.file.Driver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + return aSNS; +} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL OFileDriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL OFileDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL OFileDriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OConnection* pCon = new OConnection(this); + pCon->construct(url,info); + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)) + { + return sal_True; + } + return sal_False; +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OFileDriver::getMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// -------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------- +// XDataDefinitionSupplier +Reference< XTablesSupplier > SAL_CALL OFileDriver::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(); + + OConnection* pConnection = NULL; + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == (OConnection*)connection.get()) + { + pConnection = (OConnection*)connection.get(); + break; + } + } + + Reference< XTablesSupplier > xTab = NULL; + if(pConnection) + xTab = pConnection->createCatalog(); + return xTab; +} + +//------------------------------------------------------------------ +Any SAL_CALL OFileDriver::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this)); + if(aRet.hasValue()) + return aRet; + return ODriver_BASE::queryInterface(rType); +} +// -------------------------------------------------------------------------------- +Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + return getDataDefinitionByConnection(connect(url,info)); +} + + diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx new file mode 100644 index 000000000000..20203d7b643c --- /dev/null +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -0,0 +1,473 @@ +/************************************************************************* + * + * $RCSfile: FPreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#include "file/FPreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::file; +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::util; + +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbc.driver.file.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo) + : OStatement_BASE2( _pConnection ) + ,m_pResultSet(NULL) +{ +} +// ------------------------------------------------------------------------- +void OPreparedStatement::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException) +{ + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + m_pResultSet = new OResultSet(this,m_aSQLIterator); + if(m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || + m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE) + m_pResultSet->describeParameter(); + m_aRow = new OValueVector(); + m_xRS = m_pResultSet; + + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XResultSetMetaDataSupplier*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) +{ + if(m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_aSQLIterator.getSelectColumns().getBody(),m_aSQLIterator.getTables().begin()->first); + return m_xMetaData; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) +{ + m_xRS = NULL; + clearMyResultSet(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +{ + sal_Bool hasResultSet = sal_False; + SQLWarning warning; + sal_Bool needData = sal_False; + + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +{ + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return m_pResultSet->getRowCountResult(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > rs = m_pResultSet; + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return rs; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back((sal_Int32)x); + else + (*m_aRow)[parameterIndex] = (sal_Int32)x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aData)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aData); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aVal)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aVal); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aVal)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aVal); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} + +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back((double)x); + else + (*m_aRow)[parameterIndex] = (double)x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex > m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) +{ + // Get the buffer needed for the length + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(OFileValue()); + else + (*m_aRow)[parameterIndex].setNull(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + // For each known SQL Type, call the appropriate + // set routine + + switch (sqlType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + (*m_aRow)[parameterIndex] = *(::rtl::OUString*) x.getValue(); + break; + case DataType::BIT: + (*m_aRow)[parameterIndex] = *(sal_Bool*) x.getValue(); + break; + + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + (*m_aRow)[parameterIndex] = *(sal_Int32*)x.getValue(); + break; + + case DataType::BIGINT: + case DataType::REAL: + case DataType::FLOAT: + case DataType::DOUBLE: + (*m_aRow)[parameterIndex] = *(double*)x.getValue(); + break; + + case DataType::BINARY: + break; + + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + break; + + case DataType::DATE: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(Date*) x.getValue()); + break; + + case DataType::TIME: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(Time*)x.getValue()); + break; + + case DataType::TIMESTAMP: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(DateTime*)x.getValue()); + break; + + default: + { + ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("Unknown SQL Type for PreparedStatement.setObject (SQL Type="); + aVal += ::rtl::OUString::valueOf(sqlType); + throw SQLException( aVal,*this,::rtl::OUString(),0,Any()); + } + + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(OFileValue()); + else + (*m_aRow)[parameterIndex].setNull(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + // setObject (parameterIndex, x, sqlType, 0); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + setInt(parameterIndex,x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) +{ + m_aRow->clear(); +} + + diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx new file mode 100644 index 000000000000..ee25dfe374a3 --- /dev/null +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -0,0 +1,2297 @@ +/************************************************************************* + * + * $RCSfile: FResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SQLC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#include "dbase/DIndexIter.hxx" +#endif +#ifndef _ITERATOR_ +#include <iterator> +#endif +using namespace connectivity; +using namespace connectivity::file; +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; + +// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen: +#if defined (WIN) +#define MAX_KEYSET_SIZE 0x3ff0 // Etwas weniger als ein Segment, damit + // noch Platz fuer Memory Debug-Informationen +#else +#define MAX_KEYSET_SIZE 0x40000 // 256K +#endif +//------------------------------------------------------------------------------ +IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet"); +// ------------------------------------------------------------------------- +OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterator) : OResultSet_BASE(m_aMutex) + ,connectivity::OSimplePropertyContainer(OResultSet_BASE::rBHelper) + ,m_aStatement((OWeakObject*)pStmt) + ,m_nRowPos(-1) + ,m_bLastRecord(sal_False) + ,m_bEOF(sal_False) + ,m_xDBMetaData(pStmt->getConnection()->getMetaData()) + ,m_xMetaData(NULL) + ,m_aSQLIterator(_aSQLIterator) + ,m_pTable(NULL) + ,m_nRowCountResult(-1) + ,m_nFilePos(0) + ,m_nLastVisitedPos(-1) + ,m_pParseTree(pStmt->getParseTree()) + ,m_pFileSet(NULL) + ,m_pEvaluationKeySet(NULL) + ,m_pSortIndex(NULL) + ,m_aAssignValues(NULL) +{ + osl_incrementInterlockedCount( &m_refCount ); + + + for (int jj = 0; jj < sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber); jj++) + { + nOrderbyColumnNumber[jj] = SQL_COLUMN_NOTFOUND; + bOrderbyAscending[jj] = TRUE; + } + construct(); + osl_decrementInterlockedCount( &m_refCount ); +} + +// ------------------------------------------------------------------------- +OResultSet::~OResultSet() +{ +} +// ------------------------------------------------------------------------- +void OResultSet::construct() +{ + registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +} +// ------------------------------------------------------------------------- +void OResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + m_aStatement = NULL; + m_xMetaData = NULL; + m_pParseTree = NULL; + if(m_pTable) + { + m_pTable->release(); + m_pTable = NULL; + } + DELETEZ(m_pFileSet); + DELETEZ(m_pEvaluationKeySet); + DELETEZ(m_pSortIndex); + + m_aRow->clear(); + m_aEvaluateRow->clear(); + m_aAssignValues->clear(); + m_xParamColumns->clear(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getInt32(); +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return Sequence< sal_Int8 >(); +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + + return DateConversion::toDate((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + +double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getDouble(); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return sal_Int64(); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_xColumns.getBody(),m_aSQLIterator.getTables().begin()->first); + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getInt32(); +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} + +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return DateConversion::toTime((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return DateConversion::toDateTime((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bEOF; +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(first()) + previous(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(last()) + next(); + m_bEOF = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_FIRST,1,sal_True); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // here I know definitely that I stand on the last record + return Move(OFileTable::FILE_LAST,1,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_ABSOLUTE,row,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_RELATIVE,row,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + --m_nRowPos; + return sal_True; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 0; +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::evaluate() +{ + sal_Bool bRet = sal_True; + while(!m_aSQLAnalyzer.evaluateRestriction()) + { + if(m_pEvaluationKeySet) + { + if(m_aEvaluateIter == m_pEvaluationKeySet->end()) + return sal_False; + bRet = m_pTable->seekRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),m_nRowPos); + ++m_aEvaluateIter; + } + else + bRet = m_pTable->seekRow(OFileTable::FILE_NEXT,1,m_nRowPos); + if(bRet) + { + if(m_pEvaluationKeySet) + { + bRet = m_pTable->fetchRow(m_aEvaluateRow,m_pTable->getTableColumns().getBody(),sal_True); + evaluate(); + + } + else + bRet = m_pTable->fetchRow(m_aRow,m_xColumns.getBody(),sal_True); + } + } + + return bRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pTable) + return sal_False; + + return Move(OFileTable::FILE_NEXT,1,sal_True); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bWasNull; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); + throw RuntimeException(); +} +// ----------------------------------------------------------------------- +void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); + OSL_ENSHURE(0,"OResultSet::updateNumericObject: NYI"); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper* OResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper & OResultSet::getInfoHelper() +{ + return *const_cast<OResultSet*>(this)->getArrayHelper(); +} + +//------------------------------------------------------------------ +BOOL OResultSet::ExecuteRow(OFileTable::FilePosition eFirstCursorPosition, + INT32 nFirstOffset, + BOOL bRebind, + BOOL bEvaluate, + BOOL bRetrieveData) +{ + + // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... + OFileTable::FilePosition eCursorPosition = eFirstCursorPosition; + INT32 nOffset = nFirstOffset; + UINT32 nLoopCount = 0; + +again: + + // protect from reading over the end when someboby is inserting while we are reading + // this method works only for dBase at the moment !!!! + if (eCursorPosition == OFileTable::FILE_NEXT && m_nFilePos == m_nLastVisitedPos) + { + return sal_False; + } + + if (!m_pTable->seekRow(eCursorPosition, nOffset, m_nFilePos)) + { + return sal_False; + } + + if (!bEvaluate) // Laeuft keine Auswertung, dann nur Ergebniszeile fuellen + { + m_pTable->fetchRow(m_aRow,m_pTable->getTableColumns().getBody(), bRetrieveData); + + // if (bShowDeleted && m_aRow->isDeleted()) + // m_aRow->setState(ROW_DELETED); + } + else + { + m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + + if (m_aSQLAnalyzer.hasRestriction() && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Stzen + !m_aSQLAnalyzer.evaluateRestriction()) // Auswerten der Bedingungen + { // naechsten Satz auswerten + // aktuelle Zeile loeschen im Keyset + OSL_ENSHURE(!m_pFileSet || + // !m_pFileSet->IsFrozen() || + eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!"); + + if (m_pEvaluationKeySet) + { + ++m_aEvaluateIter; + if (m_pEvaluationKeySet->end() != m_aEvaluateIter) + nOffset = (*m_aEvaluateIter); + else + { + return sal_False; + } + } + else if (m_pFileSet) + { + OSL_ENSHURE(//!m_pFileSet->IsFrozen() && + eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!"); + eCursorPosition = OFileTable::FILE_NEXT; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_FIRST || + eCursorPosition == OFileTable::FILE_NEXT || + eCursorPosition == OFileTable::FILE_ABSOLUTE) + { + eCursorPosition = OFileTable::FILE_NEXT; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_LAST || + eCursorPosition == OFileTable::FILE_PRIOR) + { + eCursorPosition = OFileTable::FILE_PRIOR; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_RELATIVE) + { + eCursorPosition = (nOffset >= 0) ? OFileTable::FILE_NEXT : OFileTable::FILE_PRIOR; + } + else + { + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + return sal_False; + } + // Nochmal probieren ... + goto again; + } + } + // Evaluate darf nur gesetzt sein, + // wenn der Keyset weiter aufgebaut werden soll + if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && + (m_pFileSet || m_pSortIndex) && bEvaluate) + { + if (m_pSortIndex) + { + OFILEKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); + if (!m_pSortIndex->AddKeyValue(pKeyValue)) + { + // Ueberwachung auf Ueberschreitung der Index-Kapazitaet: + } + } + else if (m_pFileSet) + { + // OSL_ENSHURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!"); + sal_uInt32 nBookmarkValue = Abs((sal_Int32)(*m_aEvaluateRow)[0]); + m_pFileSet->push_back(nBookmarkValue); + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE) + { + sal_Bool bOK = sal_True; + if (bEvaluate) + { + // jetzt die eigentliche Ergebniszeile Lesen + bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + } + + if (bOK) + { + // Nur die zu aendernden Werte uebergeben: + if(!m_pTable->UpdateRow(m_aAssignValues.getBody(),m_aEvaluateRow,Reference<XIndexAccess>(m_xColNames,UNO_QUERY))) + return sal_False; + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE) + { + sal_Bool bOK = sal_True; + if (bEvaluate) + { + bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + } + if (bOK) + { + if(!m_pTable->DeleteRow(m_xColumns.getBody())) + return sal_False; + } + } + return sal_True; +} + +//------------------------------------------------------------------- +BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData) +{ + +IgnoreDeletedRows: + + INT32 nTempPos = m_nRowPos; + // exclusiver zugriff auf die Tabelle + // NAMESPACE_VOS(OGuard)* pGuard = m_pTable->Lock(); + + if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT) + { + if (m_pFileSet == NULL) // kein Index verfuegbar + { + // Normales FETCH + ExecuteRow(eCursorPosition,nOffset,TRUE,FALSE,bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else + { + switch(eCursorPosition) + { + case OFileTable::FILE_NEXT: + m_nRowPos++; + break; + case OFileTable::FILE_PRIOR: + if (m_nRowPos >= 0) + m_nRowPos--; + break; + case OFileTable::FILE_FIRST: + m_nRowPos = 0; + break; + case OFileTable::FILE_LAST: + // OSL_ENSHURE(IsRowCountFinal(), "Fehler im Keyset!"); // mu eingefroren sein, sonst Fehler beim SQLCursor + m_nRowPos = m_pFileSet->size() - 1; + break; + case OFileTable::FILE_RELATIVE: + m_nRowPos += nOffset; + break; + case OFileTable::FILE_ABSOLUTE: + m_nRowPos = nOffset - 1; + break; + case OFileTable::FILE_BOOKMARK: + m_nRowPos = nOffset - 1; + break; + } + + // OffRange? + // Der FileCursor ist auerhalb des gueltigen Bereichs, wenn + // a.) m_nRowPos < 1 + // b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size() + if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != OFileTable::FILE_BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->size() )) // && m_pFileSet->IsFrozen() + { + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + goto Error; + } + else + { + if (m_nRowPos < (INT32)m_pFileSet->size()) + { + // Fetch ueber Index + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_pFileSet)[m_nRowPos],TRUE,FALSE,bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else // Index mu weiter aufgebaut werden + { + // Zunaechst auf die letzte bekannte Zeile setzen + if (m_pFileSet->size()) + { + m_aFileSetIter = m_pFileSet->end()-1; + // m_pFileSet->SeekPos(m_pFileSet->size()-1); + m_pTable->seekRow(OFileTable::FILE_BOOKMARK, *m_aFileSetIter, m_nFilePos); + } + sal_Bool bOK = sal_True; + // Ermitteln der Anzahl weiterer Fetches + while (bOK && m_nRowPos >= (INT32)m_pFileSet->size()) + { + if (m_pEvaluationKeySet) + { + if (m_nRowPos >= (INT32)m_pEvaluationKeySet->size()) + return sal_False; + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + else if (m_nRowPos == 0) + { + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData); + } + else + { + ++m_aEvaluateIter; + bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData); + } + } + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE, bRetrieveData); + } + + if (bOK) + { + // jetzt nochmal die Ergebnisse lesen + m_pTable->fetchRow(m_aRow, m_pTable->getTableColumns().getBody(), bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else if (!m_pFileSet->isFrozen()) // keinen gueltigen Satz gefunden + { + //m_pFileSet->Freeze(); + m_pFileSet->setFrozen(); + + DELETEZ(m_pEvaluationKeySet); + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + goto Error; + } + } + } + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT) + { + // Fetch des COUNT(*) + switch (eCursorPosition) + { + case OFileTable::FILE_NEXT: + m_nRowPos++; + break; + case OFileTable::FILE_PRIOR: + m_nRowPos--; + break; + case OFileTable::FILE_FIRST: + m_nRowPos = 0; + break; + case OFileTable::FILE_LAST: + m_nRowPos = 0; + break; + case OFileTable::FILE_RELATIVE: + m_nRowPos += nOffset; + break; + case OFileTable::FILE_BOOKMARK: + case OFileTable::FILE_ABSOLUTE: + m_nRowPos = nOffset - 1; + break; + } + + if (m_nRowPos == 0) + { + // COUNT(*) in Ergebnisrow packen + // (muss die erste und einzige Variable in der Row sein) + if (m_aRow->size() == 2) + { + (*m_aRow)[1] = m_nRowCountResult; + (*m_aRow)[0] = sal_Int32(1); + } + } + else + { + goto Error; + } + } + else + // Fetch nur bei SELECT moeglich! + return sal_False; + + if(m_aRow->isDeleted()) + goto IgnoreDeletedRows; + return sal_True; + +Error: + // steht der Cursor vor dem ersten Satz + // dann wird die position beibehalten + if (nTempPos == -1) + m_nRowPos = nTempPos; + else + { + switch(eCursorPosition) + { + case OFileTable::FILE_PRIOR: + case OFileTable::FILE_FIRST: + m_nRowPos = -1; + break; + case OFileTable::FILE_LAST: + case OFileTable::FILE_NEXT: + case OFileTable::FILE_ABSOLUTE: + case OFileTable::FILE_RELATIVE: + if (nOffset > 0) + m_nRowPos = (m_pFileSet) ? m_pFileSet->size() : -1; + else if (nOffset < 0) + m_nRowPos = -1; + break; + case OFileTable::FILE_BOOKMARK: + m_nRowPos = nTempPos; // vorherige Position + } + } + // delete pGuard; + // rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ? // keine Anzeige von gelschten Stzen + // OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE; + return sal_False; +} +// ------------------------------------------------------------------------- +OFILEKeyValue* OResultSet::GetOrderbyKeyValue(OValueRow _rRow) +{ + UINT32 nBookmarkValue = Abs((sal_Int32)(*_rRow)[0]); + + OFILEKeyValue* pKeyValue = new OFILEKeyValue((UINT32)nBookmarkValue); + for (int i = 0; i < sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber); i++) + { + if (nOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) break; + + OFileValue xKey = (*_rRow)[nOrderbyColumnNumber[i]]; + switch (xKey.getType()) + { + case ::com::sun::star::sdbc::DataType::VARCHAR: + case ::com::sun::star::sdbc::DataType::CHAR: + pKeyValue->SetKey(i,(rtl::OUString)xKey); + break; + default: + pKeyValue->SetKey(i,(double)xKey); + break; + } + } + return pKeyValue; +} +OFILESortIndex * OFILESortIndex::pCurrentIndex; +CharSet OFILESortIndex::eCurrentCharSet; +//------------------------------------------------------------------ +OFILESortIndex::OFILESortIndex(const OKeyType eKeyType2[], // Genau 3 Eintraege! + const BOOL bAscending2[], // Genau 3 Eintraege! + INT32 nMaxNumberOfRows, CharSet eSet) // Obere Schranke fuer die Anzahl indizierbarer Zeilen + : nMaxCount(nMaxNumberOfRows), + nCount(0), + bFrozen(FALSE), eCharSet(eSet) +{ + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + eKeyType[j] = eKeyType2[j]; + bAscending[j] = bAscending2[j]; + } + +#if defined MAX_KEYSET_SIZE + // Zur Sicherheit Maximalgroesse nochmal pruefen: + if (nMaxCount > MAX_KEYSET_SIZE) + { + DBG_WARNING("OFILESortIndex::OFILESortIndex: nMaxNumberOfRows zur Zeit auf <16K beschraenkt!"); + nMaxCount = MAX_KEYSET_SIZE; + } +#endif + + ppKeyValueArray = new OFILEKeyValuePtr[nMaxCount]; + + for (INT32 i = 0; i < nMaxCount; i++) + ppKeyValueArray[i] = NULL; +} + +//------------------------------------------------------------------ +OFILESortIndex::~OFILESortIndex() +{ + +// Nicht mehr noetig - wird durch Freeze() erledigt ... +// for (INT32 i = 0; i < nCount; i++) { +// delete ppKeyValueArray[i]; +// } + + __DELETE(nMaxCount) ppKeyValueArray; +} + + +//------------------------------------------------------------------ +BOOL OFILESortIndex::AddKeyValue(OFILEKeyValue * pKeyValue) +{ + if (nCount < nMaxCount) + { + if (bFrozen) // wenn der Index schon eingefroren + // dann wird der Key einfach ans Ende gehaengt + { + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + INT32 nValue = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + ppKeyValueArray[nCount++] = (OFILEKeyValuePtr) nValue; + } + else + ppKeyValueArray[nCount++] = pKeyValue; + return TRUE; + } + else + return FALSE; +} + + +//------------------------------------------------------------------ +void OFILESortIndex::Freeze() +{ + OSL_ENSHURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); + + // Kritischer Bereich: Hinterlegung von this in statischer Variable. + // Zugriff auf diese Variable von der OFILECompare-Funktion aus. + // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, + // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung + // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr + // eigenes Datensegment. + pCurrentIndex = this; + eCurrentCharSet = eCharSet; + + // Sortierung: + if (eKeyType[0] != SQL_ORDERBYKEY_NONE) + // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: + qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); + + + // Ende des kritischen Bereiches + pCurrentIndex = NULL; + + // Wert auslesen, KeyValue loeschen und in den void * den Value + // reinschreiben (uebler Trick mit Typecast!) + for (INT32 i = 0; i < nCount; i++) + { + OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; + + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + INT32 nValue = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + ppKeyValueArray[i] = (OFILEKeyValuePtr) nValue; + } + + bFrozen = TRUE; +} + +//------------------------------------------------------------------ +INT32 OFILESortIndex::GetValue(INT32 nPos) const +{ + OSL_ENSHURE(nPos > 0,"OFILESortIndex::GetValue: nPos == 0"); + OSL_ENSHURE(nPos <= nCount,"OFILESortIndex::GetValue: Zugriff ausserhalb der Array-Grenzen"); + +// OSL_ENSHURE(ppKeyValueArray[nPos-1] != NULL,"OFILESortIndex::GetValue: interner Fehler: kein KeyValue an dieser Stelle"); +// return ppKeyValueArray[nPos-1]->GetValue(); + + if (!bFrozen) + { + if (eKeyType[0] == SQL_ORDERBYKEY_NONE) // wenn keine Sortierung vorliegt + // darf auf die Values schon vorher zugegriffen werden + return ppKeyValueArray[nPos-1]->GetValue(); + else + { + OSL_ASSERT("OFILESortIndex::GetValue: Invalid use of index!"); + return 0; + } + } + else + return (INT32) ppKeyValueArray[nPos-1]; // Trick: nach Freeze sind hier nur noch Values, keine KeyValue-Strukturen mehr! + +} + +//------------------------------------------------------------------ +OKeySet* OFILESortIndex::CreateKeySet() +{ + + OSL_ENSHURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); + + // Kritischer Bereich: Hinterlegung von this in statischer Variable. + // Zugriff auf diese Variable von der OFILECompare-Funktion aus. + // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, + // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung + // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr + // eigenes Datensegment. + pCurrentIndex = this; + eCurrentCharSet = eCharSet; + + // Sortierung: + if (eKeyType[0] != SQL_ORDERBYKEY_NONE) + // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: + qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); + + + // Ende des kritischen Bereiches + pCurrentIndex = NULL; + + + OKeySet* pKeySet = new OKeySet(nCount); + OKeySet::iterator aIter = pKeySet->begin(); + for (INT32 i = 0; i < nCount; i++,++aIter) + { + OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; + + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + (*aIter) = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + } + bFrozen = TRUE; + pKeySet->setFrozen(); + return pKeySet; +} + +//------------------------------------------------------------------ +int +#if defined(WIN) || defined(WNT) +__cdecl +#endif +#if defined(ICC) && defined(OS2) +_Optlink +#endif +connectivity::file::OFILEKeyCompare(const void * elem1, const void * elem2) +{ + const OFILESortIndex * pIndex = OFILESortIndex::pCurrentIndex; + const OFILEKeyValue * pKeyValue1 = (OFILEKeyValue *) * (OFILEKeyValue **) elem1; + const OFILEKeyValue * pKeyValue2 = (OFILEKeyValue *) * (OFILEKeyValue **) elem2; + + // Ueber die (max.) drei ORDER BY-Columns iterieren. Abbruch des Vergleiches, wenn Ungleichheit erkannt + // oder alle Columns gleich. + for (UINT16 i = 0; i < SQL_ORDERBYKEYS && pIndex->eKeyType[i] != SQL_ORDERBYKEY_NONE; i++) + { + const int nGreater = (pIndex->bAscending[i]) ? 1 : -1; + const int nLess = - nGreater; + + // Vergleich (je nach Datentyp): + switch (pIndex->eKeyType[i]) + { + case SQL_ORDERBYKEY_STRING: + { + INT32 nRes = pKeyValue1->GetKeyString(i)->compareTo(*pKeyValue2->GetKeyString(i)); + if (nRes < 0) + return nLess; + else if (nRes > 0) + return nGreater; + } + break; + case SQL_ORDERBYKEY_DOUBLE: + { + double d1 = pKeyValue1->GetKeyDouble(i); + double d2 = pKeyValue2->GetKeyDouble(i); + + if (d1 < d2) + return nLess; + else if (d1 > d2) + return nGreater; + } + break; + } + } + + // Wenn wir bis hierher gekommen sind, waren alle Werte gleich: + return 0; +} +//------------------------------------------------------------------ +BOOL OResultSet::OpenImpl() +{ + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + OSL_ENSHURE(xTabs.begin() != xTabs.end(),"NO table in statement!"); + + OSQLTable xTable = xTabs.begin()->second; + m_xColumns = m_aSQLIterator.getSelectColumns(); + + m_xColNames = xTable->getColumns(); + + Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); + + m_aRow = new OValueVector(xNames->getCount()); + m_aEvaluateRow = new OValueVector(xNames->getCount()); + // m_aParameterRow = new OValueVector(); + m_aAssignValues = new OAssignValues(); + + if(!m_xParamColumns.isValid()) + m_xParamColumns = new OSQLColumns(); + + m_aSQLAnalyzer.clean(); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTable,UNO_QUERY); + if(xTunnel.is()) + { + m_pTable = (OFileTable*)xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()); + if(m_pTable) + m_pTable->acquire(); + } + + GetAssignValues(); // assign values and describe parameter columns + m_aSQLAnalyzer.setParameterColumns(m_xParamColumns); + anylizeSQL(); + // m_aSQLAnalyzer.describeParam(m_xParamColumns); + + + // now check which columns are bound + OValueVector::iterator aRowIter = m_aRow->begin(); + ::utl::UStringMixEqual aCase(m_xDBMetaData->storesMixedCaseQuotedIdentifiers()); + sal_Int32 i=0; + Reference<XFastPropertySet> xProp; + ++aRowIter; + for(OSQLColumns::iterator aIter = m_xColumns->begin();aIter != m_xColumns->end();++aIter,++i,++aRowIter) + { + xNames->getByIndex(i) >>= xProp; + try + { + aRowIter->setBound(aCase(connectivity::getString(xProp->getFastPropertyValue(PROPERTY_ID_NAME)),connectivity::getString((*aIter)->getFastPropertyValue(PROPERTY_ID_REALNAME)))); + sal_Int32 nType; + xProp->getFastPropertyValue(PROPERTY_ID_TYPE) >>= nType; + aRowIter->setType(nType); + } + catch(...) + { + } + } + + + + + // Parameter substituieren (AssignValues und Kriterien): + if (m_xParamColumns->size()) + { + // Zunchst AssignValues + USHORT nParaCount=0; // gibt die aktuelle Anzahl der bisher gesetzen Parameter an + + // Nach zu substituierenden Parametern suchen: + UINT16 nCount = m_aAssignValues.isValid() ? m_aAssignValues->size() : 1; // 1 ist wichtig fr die Kriterien + for (UINT16 j = 1; j < nCount; j++) + { +// if ((*m_aAssignValues)[j].isNull()) +// continue; + + UINT32 nParameter = (*m_aAssignValues).getParameterIndex(j); + if (nParameter == SQL_NO_PARAMETER) + continue; // dieser AssignValue ist kein Parameter + + ++nParaCount; // ab hier ist der Parameter gueltig + // Parameter ersetzen. Wenn Parameter nicht verfuegbar, + // Value auf NULL setzen. + (*m_aAssignValues)[j] = (*m_aParameterRow)[(UINT16)nParameter]; + } + + if (m_aParameterRow.isValid() && nParaCount < m_aParameterRow->size()) + m_aSQLAnalyzer.bindParameterRow(m_aParameterRow); + } + + // Neuen Index aufbauen: + DELETEZ(m_pFileSet); + DELETEZ(m_pEvaluationKeySet); + + // if (!aEvaluateRow.Is()) + { + // aEvaluateRow = new ODbRow(*aFileColumns, FALSE); + // (*aEvaluateRow)[0] = new ODbVariant(); + + // Row zur Auswertung binden, wenn Preprocessing erfolg, dann bereits ein Keyset + m_pEvaluationKeySet = m_aSQLAnalyzer.bindResultRow(m_aEvaluateRow); // Werte im Code des Compilers setzen + // (Verbindung zur ResultRow herstellen) + } + + // An den Anfang positionieren + m_nRowPos = -1; + m_nFilePos = 0; + m_nRowCountResult = -1; + + // exclusiver zugriff auf die Tabelle + // NAMESPACE_VOS(OGuard)* pGuard = pTable->Lock(); + m_nLastVisitedPos = m_pTable->getCurrentLastPos(); + + UINT32 nLoopCount = 0; + switch(m_aSQLIterator.getStatementType()) + { + case SQL_STATEMENT_SELECT: + { + INT32 nMaxRowCount = m_pTable->getCurrentLastPos(); + + BOOL bDistinct = FALSE; + BOOL bWasSorted = FALSE; + OSQLParseNode *pDistinct = m_pParseTree->getChild(1); + if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT ) + { + if(!IsSorted()) + { + nOrderbyColumnNumber[0] = 1; + bOrderbyAscending[0] = FALSE; + } + else + bWasSorted = TRUE; + bDistinct = TRUE; + } + // Ohne Restriction und Sortierung RowCount bekannt. + // if (!HasRestriction() && !IsSorted() && bShowDeleted) + // SetRowCount(MaxRowCount()); + + OSL_ENSHURE(sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber) == SQL_ORDERBYKEYS,"Maximale Anzahl der ORDER BY Columns muss derzeit genau 3 sein!"); + OKeyType eKeyType[SQL_ORDERBYKEYS]; + aRowIter = m_aRow->begin(); + for (int i = 0; i < SQL_ORDERBYKEYS; i++) + { + if (nOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) + eKeyType[i] = SQL_ORDERBYKEY_NONE; + else + { + switch (aRowIter->getType()) + { + case DataType::CHAR: + case DataType::VARCHAR: + eKeyType[i] = SQL_ORDERBYKEY_STRING; + break; + + case DataType::OTHER: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BIT: + eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; + break; + + // Andere Typen sind nicht implementiert (und damit immer FALSE) + default: + eKeyType[i] = SQL_ORDERBYKEY_NONE; + OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); + break; + } + (*m_aEvaluateRow)[nOrderbyColumnNumber[i]].setBound(sal_True); + } + } + + // Nur wenn Sortierung gewuenscht, ueber alle Datensaetze iterieren und + // dabei den "Key", nach dem sortiert werden soll, in den Index eintragen: + if (IsSorted()) + { + if (!m_aSQLAnalyzer.hasRestriction() && nOrderbyColumnNumber[1] == SQL_COLUMN_NOTFOUND) + { + // Ist nur ein Feld fuer die Sortierung angegeben + // Und diese Feld ist indiziert, dann den Index ausnutzen + Reference<XIndexesSupplier> xIndexSup(xTable,UNO_QUERY); + Reference<XIndexAccess> xIndexes; + if(xIndexSup.is()) + { + xIndexes = Reference<XIndexAccess>(xIndexSup->getIndexes(),UNO_QUERY); + Reference<XFastPropertySet> xColProp; + xNames->getByIndex(nOrderbyColumnNumber[0]) >>= xColProp; + // iterate through the indexes to find the matching column + for(sal_Int32 i=0;i<xIndexes->getCount();++i) + { + Reference<XColumnsSupplier> xIndex; + xIndexes->getByIndex(i) >>= xIndex; + Reference<XNameAccess> xIndexCols = xIndex->getColumns(); + if(xIndexCols->hasByName(connectivity::getString(xColProp->getFastPropertyValue(PROPERTY_ID_NAME)))) + { + m_pFileSet = new OKeySet(); + + Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); + if(xTunnel.is()) + { + dbase::ODbaseIndex* pIndex = (dbase::ODbaseIndex*)xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelImplementationId()); + if(pIndex) + { + dbase::OIndexIterator* pIter = pIndex->createIterator(NULL,NULL); + + if (pIter) + { + sal_uInt32 nRec = pIter->First(); + while (nRec != SQL_COLUMN_NOTFOUND) + { + if (bOrderbyAscending[0]) + m_pFileSet->push_back(nRec); + else + m_pFileSet->insert(m_pFileSet->begin(),nRec); + nRec = pIter->Next(); + } + m_pFileSet->setFrozen(); + // m_bFileSetFrozen = sal_True; + // if(!bDistinct) + // SetRowCount(pFileSet->count()); + goto DISTINCT; + } + + delete pIter; + } + } + } + } + } + } + + m_pSortIndex = new OFILESortIndex(eKeyType, + bOrderbyAscending, + nMaxRowCount,RTL_TEXTENCODING_MS_1252); + + sal_Bool bOK = sal_True; + if (m_pEvaluationKeySet) + { + if (m_pEvaluationKeySet->size()) + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + + } + while (bOK) + { + if (m_pEvaluationKeySet) + { + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE); + ++m_aEvaluateIter; + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + } + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE); + } + + // Sortiertes Keyset erzeugen + DELETEZ(m_pEvaluationKeySet); + m_pFileSet = m_pSortIndex->CreateKeySet(); + // if(!bDistinct) + // SetRowCount(pFileSet->count()); + DELETEZ(m_pSortIndex); + // Nun kann ueber den Index sortiert zugegriffen werden. + } + + if (!m_pFileSet) + { + m_pFileSet = new OKeySet(); + + if (!m_aSQLAnalyzer.hasRestriction()) + // jetzt kann das Keyset schon gefuellt werden! + // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n + // abgelegt werden! + { + for (sal_uInt32 i = 0; i < m_pTable->getCurrentLastPos(); i++) + m_pFileSet->push_back(i + 1); + } + } + OSL_ENSHURE(m_pFileSet,"Kein KeySet vorhanden! :-("); +DISTINCT: if(bDistinct && m_pFileSet) // sicher ist sicher + { + OValueRow aSearchRow;//(m_aRow); + // ODbRowRef aSearchRow = new ODbRow(*aFileRow); // nach dieser wird gesucht + // const ODbRow &rSearchRow = *aSearchRow, + // &rFileRow = *aFileRow; + INT32 nPos; + UINT16 nMaxRow = m_pFileSet->size(); + if (nMaxRow) + { +#if DEBUG + INT32 nFound=0; +#endif + vector<BOOL> nWasAllwaysFound(nMaxRow,FALSE); + INT32 nPrev_i; + for(INT32 j= nMaxRow-1;j >= 0;j--) + { + nPos = (*m_pFileSet)[j]; // aktuell zu lschender Key + if(!nWasAllwaysFound[j] && nPos) // nur falls noch nicht nach dieser Row gesucht wurde + { + ExecuteRow(OFileTable::FILE_BOOKMARK,nPos,TRUE,FALSE); + aSearchRow = m_aRow; + // jetzt den Rest nach doppelten durchsuchen + INT32 nKey; + nPrev_i = j; + for(INT32 i = j-1; i >= 0 ;i--) + { + nKey = (*m_pFileSet)[i]; + ExecuteRow(OFileTable::FILE_BOOKMARK,nKey ,TRUE,FALSE); + if(!nWasAllwaysFound[i] && aSearchRow == m_aRow) + { + // gefunden + // Key an der Stelle 0 setzen. + (*m_pFileSet)[nPrev_i] = 0; + // und altes i merken + nPrev_i = i; + nPos = nKey; // auf naechste gltige Position setzen + nWasAllwaysFound[i] = TRUE; + + } + } + } +#if DEBUG + else + nFound++; +#endif + } + vector<INT32>::iterator aIter = m_pFileSet->end()-1; + while(aIter != m_pFileSet->begin()) + { + if(!(*aIter)) + m_pFileSet->erase(aIter); + aIter--; + } + if (!bWasSorted) + { + nOrderbyColumnNumber[0] = SQL_COLUMN_NOTFOUND; + sort(m_pFileSet->begin(),m_pFileSet->end()); + } + } + // SetRowCount(m_pFileSet->count()); + } + } break; + + case SQL_STATEMENT_SELECT_COUNT: + case SQL_STATEMENT_UPDATE: + case SQL_STATEMENT_DELETE: + // waehrend der Bearbeitung die Anzahl der bearbeiteten Rows zaehlen: + m_nRowCountResult = 0; + // Vorlaeufig einfach ueber alle Datensaetze iterieren und + // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + { + + sal_Bool bOK = sal_True; + if (m_pEvaluationKeySet) + { + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + + } + while (bOK) + { + if (m_pEvaluationKeySet) + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE); + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE); + + if (bOK) + { + m_nRowCountResult++; + if(m_pEvaluationKeySet) + { + ++m_aEvaluateIter; + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + } + } + } + + // Ergebnis von COUNT(*) in nRowCountResult merken. + // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser + // Anfrage = 1! + DELETEZ(m_pEvaluationKeySet); + } + // SetRowCount(1); + break; + case SQL_STATEMENT_INSERT: + m_nRowCountResult = 0; + + if(!m_pTable->InsertRow(m_aAssignValues, TRUE,Reference<XIndexAccess>(m_xColNames,UNO_QUERY))) + { + m_nFilePos = 0; + return sal_False; + } + + m_nRowCountResult = 1; + break; + } + + // FilePos zuruecksetzen + m_nFilePos = 0; + + return sal_True; +} +//------------------------------------------------------------------ +void OResultSet::anylizeSQL() +{ + // start analysing the statement + m_aSQLAnalyzer.setOrigColumns(m_xColNames); + m_aSQLAnalyzer.start(m_pParseTree); + + const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree(); + if(pOrderbyClause) + { + OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree"); + + for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++) + { + OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0); + if(!SQL_ISRULE(pColumnRef,column_ref)) + { + // aStatus.SetStatementTooComplex(); + return; + } + OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1); + setOrderbyColumn((UINT16)m,pColumnRef,pAscendingDescending); + } + } +} + + +//------------------------------------------------------------------ +void OResultSet::setOrderbyColumn(UINT16 nOrderbyColumnNo, + OSQLParseNode* pColumnRef, + OSQLParseNode* pAscendingDescending) +{ + if (nOrderbyColumnNo >= (sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber))) + { + // aStatus.SetStatementTooComplex(); + return; + } + + String aColumnName; + if (pColumnRef->count() == 1) + aColumnName = pColumnRef->getChild(0)->getTokenValue(); + else if (pColumnRef->count() == 3) + { + // Nur die Table Range-Variable darf hier vorkommen: +// if (!(pColumnRef->getChild(0)->getTokenValue() == aTableRange)) +// { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_INVALID_RANGE_VAR))), +// 0, String() ); + // return; + // } + aColumnName = pColumnRef->getChild(2)->getTokenValue(); + } + else + { + // aStatus.SetStatementTooComplex(); + return; + } + + Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY); + if(!xColLocate.is()) + return; + // Alles geprueft und wir haben den Namen der Column. + // Die wievielte Column ist das? + nOrderbyColumnNumber[nOrderbyColumnNo] = xColLocate->findColumn(aColumnName)-1; + + // Ascending or Descending? + bOrderbyAscending[nOrderbyColumnNo] = (SQL_ISTOKEN(pAscendingDescending,DESC)) ? + FALSE : TRUE; +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OResultSet::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 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +//------------------------------------------------------------------ +void OResultSet::GetAssignValues() +{ + if (m_pParseTree == NULL) + { + // aStatus.SetInvalidStatement(); + return; + } + + if (SQL_ISRULE(m_pParseTree,select_statement)) + // Keine zu setzenden Werte bei SELECT + return; + else if (SQL_ISRULE(m_pParseTree,insert_statement)) + { + // Row fuer die zu setzenden Werte anlegen (Referenz durch new) + m_aAssignValues = new OAssignValues(Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount()); + + // Liste der Columns-Namen, die in der column_commalist vorkommen (mit ; getrennt): + ::std::vector<String> aColumnNameList; + + OSL_ENSHURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pOptColumnCommalist = m_pParseTree->getChild(3); + OSL_ENSHURE(pOptColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Fehler im Parse Tree"); + if (pOptColumnCommalist->count() == 0) + { + const Sequence< ::rtl::OUString>& aNames = m_xColNames->getElementNames(); + const ::rtl::OUString* pBegin = aNames.getConstArray(); + aColumnNameList.insert(aColumnNameList.begin(),::std::vector<String>::const_iterator(pBegin),::std::vector<String>::const_iterator(pBegin + aNames.getLength())); + } + else + { + OSL_ENSHURE(pOptColumnCommalist->count() == 3,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pColumnCommalist = pOptColumnCommalist->getChild(1); + OSL_ENSHURE(pColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pColumnCommalist->count() > 0,"OResultSet: Fehler im Parse Tree"); + + // Alle Columns in der column_commalist ... + for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) + { + OSQLParseNode * pCol = pColumnCommalist->getChild(i); + OSL_ENSHURE(pCol != NULL,"OResultSet: Fehler im Parse Tree"); + aColumnNameList.push_back(pCol->getTokenValue()); + } + } + if(!aColumnNameList.size()) + throw SQLException(); + + // Werte ... + OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4); + OSL_ENSHURE(pValuesOrQuerySpec != NULL,"OResultSet: pValuesOrQuerySpec darf nicht NULL sein!"); + OSL_ENSHURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)"); + OSL_ENSHURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0"); + + // nur "VALUES" ist erlaubt ... + if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES)) + throw SQLException(); + + OSL_ENSHURE(pValuesOrQuerySpec->count() == 2,"OResultSet: pValuesOrQuerySpec->count() != 2"); + + // Liste von Werten + OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(1); + OSL_ENSHURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!"); + OSL_ENSHURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0"); + + String aColumnName; + OSQLParseNode * pRow_Value_Const; + xub_StrLen nIndex=0; + for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++) + { + pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor + if(pRow_Value_Const->count() == 3) // '(' row_value_const_list ')' + { + pRow_Value_Const = pRow_Value_Const->getChild(1); // row_value_const_list + OSL_ENSHURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); + if(pRow_Value_Const->count() == 0) + { + if(pRow_Value_Const->count() == (aColumnNameList.size()-1)) + ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife + else + { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))), +// 0, String() ); + throw SQLException(); + } + } + else + { + if(pRow_Value_Const->count() == aColumnNameList.size()) + { + for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j) + ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++); + } + else + { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))), +// 0, String() ); + throw SQLException(); + } + + } + } + else + { + // aStatus.SetStatementTooComplex(); + throw SQLException(); + } + } + } + else if (SQL_ISRULE(m_pParseTree,update_statement_positioned) || + SQL_ISRULE(m_pParseTree,update_statement_searched)) + { + m_aAssignValues = new OAssignValues(Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount()); + + OSL_ENSHURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pAssignmentCommalist = m_pParseTree->getChild(3); + OSL_ENSHURE(pAssignmentCommalist != NULL,"OResultSet: pAssignmentCommalist == NULL"); + OSL_ENSHURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0"); + + // Alle Zuweisungen (Kommaliste) bearbeiten ... + ::std::vector< String> aList(1); + for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++) + { + OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i); + OSL_ENSHURE(pAssignment != NULL,"OResultSet: pAssignment == NULL"); + OSL_ENSHURE(SQL_ISRULE(pAssignment,assignment),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pAssignment->count() == 3,"OResultSet: pAssignment->count() != 3"); + + OSQLParseNode * pCol = pAssignment->getChild(0); + OSL_ENSHURE(pCol != NULL,"OResultSet: pCol == NULL"); + + OSQLParseNode * pComp = pAssignment->getChild(1); + OSL_ENSHURE(pComp != NULL,"OResultSet: pComp == NULL"); + OSL_ENSHURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != SQL_NODE_COMPARISON"); + if (pComp->getTokenValue().GetChar(0) != '=') + { + // aStatus.SetInvalidStatement(); + throw SQLException(); + } + + OSQLParseNode * pVal = pAssignment->getChild(2); + OSL_ENSHURE(pVal != NULL,"OResultSet: pVal == NULL"); + aList[0] = pCol->getTokenValue(); + ParseAssignValues(aList,pVal,0); + } + + } +} +// ------------------------------------------------------------------------- +void OResultSet::ParseAssignValues(const ::std::vector< String>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex) +{ + OSL_ENSHURE(nIndex <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()"); + String aColumnName(aColumnNameList[nIndex]); + OSL_ENSHURE(aColumnName.Len() > 0,"OResultSet: Column-Name nicht gefunden"); + OSL_ENSHURE(pRow_Value_Constructor_Elem != NULL,"OResultSet: pRow_Value_Constructor_Elem darf nicht NULL sein!"); + + if (pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_STRING || + pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_INTNUM || + pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_APPROXNUM) + { + // Wert setzen: + SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue()); + } + else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL)) + { + // NULL setzen + SetAssignValue(aColumnName, String(), TRUE); + } + else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter)) + { + // Parameter hinzufuegen, Typ ... entsprechend der Column, der der Wert zugewiesen wird + Reference<XFastPropertySet> xCol; + m_xColNames->getByName(aColumnName) >>= xCol; + sal_Int32 nParameter = -1; + if(m_xParamColumns.isValid()) + { + OSQLColumns::const_iterator aIter = find(m_xParamColumns->begin(),m_xParamColumns->end(),aColumnName,::utl::UStringMixEqual(m_pTable->isCaseSensitive())); + if(aIter != m_xParamColumns->end()) + nParameter = m_xParamColumns->size() - (m_xParamColumns->end() - aIter) +1;// +1 because the rows start at 1 + } + if(nParameter == -1) + nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol); + // Nr. des Parameters in der Variablen merken: + SetAssignValue(aColumnName, String(), TRUE, nParameter); + } + else + { + // aStatus.SetStatementTooComplex(); + throw SQLException(); + } +} +//------------------------------------------------------------------ +void OResultSet::SetAssignValue(const String& aColumnName, + const String& aValue, + BOOL bSetNull, + UINT32 nParameter) +{ + Reference<XFastPropertySet> xCol; + m_xColNames->getByName(aColumnName) >>= xCol; + sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName); + // Kommt diese Column ueberhaupt in der Datei vor? + + if (!xCol.is()) + { + // Diese Column gibt es nicht! +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S0022"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_COLUMN_NOT_FOUND))), +// 0, String() ); + throw SQLException(); + } + + // Value an die Row mit den zuzuweisenden Werten binden: + // const ODbVariantRef& xValue = (*aAssignValues)[pFileColumn->GetId()]; + + // Alles geprueft und wir haben den Namen der Column. + // Jetzt eine Value allozieren, den Wert setzen und die Value an die Row binden. + if (bSetNull) + (*m_aAssignValues)[nId].setNull(); + else + { + switch (getINT32(xCol->getFastPropertyValue(PROPERTY_ID_TYPE))) + { + // Kriterium je nach Typ als String oder double in die Variable packen ... + case DataType::CHAR: + case DataType::VARCHAR: + (*m_aAssignValues)[nId] = aValue; + // Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde + break; + + case DataType::BIT: + { + // nyi: gemischte Gross-/Kleinschreibung??? + if (aValue.EqualsIgnoreCaseAscii("TRUE") || aValue.GetChar(0) == '1') + (*m_aAssignValues)[nId] = sal_True; + else if (aValue.EqualsIgnoreCaseAscii("FALSE") || aValue.GetChar(0) == '0') + (*m_aAssignValues)[nId] = sal_False; + else + { + // aStatus.Set(SQL_STAT_ERROR); // nyi: genauer! + throw SQLException(); + } + } + break; + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + { + (*m_aAssignValues)[nId] = aValue.ToDouble(); +// try +// { +// double n = xValue->toDouble(); +// xValue->setDouble(n); +// } +// catch ( ... ) +// { +// aStatus.SetDriverNotCapableError(); +// } + } break; + default: + throw SQLException(); + } + } + + // Parameter-Nr. merken (als User Data) + // SQL_NO_PARAMETER = kein Parameter. + m_aAssignValues->setParameterIndex(nId,nParameter); + // ((ODbAssignRow*)aAssignValues.getBodyPtr())->setAssignedIndex(pFileColumn->GetId(), nParameter); +} + +//------------------------------------------------------------------ +UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XFastPropertySet>& _xCol) +{ + + // Nr. des neu hinzuzufuegenden Parameters: + UINT32 nParameter = m_xParamColumns->size()+1; + + OSL_ENSHURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter"); + OSL_ENSHURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree"); + OSQLParseNode * pMark = pParameter->getChild(0); + + String aParameterName; + if (SQL_ISPUNCTUATION(pMark,"?")) + aParameterName = '?'; + else if (SQL_ISPUNCTUATION(pMark,":")) + aParameterName = pParameter->getChild(1)->getTokenValue(); + else if (SQL_ISPUNCTUATION(pMark,"[")) + aParameterName = pParameter->getChild(1)->getTokenValue(); + else + { + OSL_ASSERT("OResultSet: Fehler im Parse Tree"); + } + + // Parameter-Column aufsetzen: + sal_Int32 eType = DataType::VARCHAR; + UINT32 nPrecision = 255; + UINT16 nScale = 0; + sal_Int32 nNullable = ColumnValue::NULLABLE; + + if (_xCol.is()) + { + // Typ, Precision, Scale ... der angegebenen Column verwenden, + // denn dieser Column wird der Wert zugewiesen bzw. mit dieser + // Column wird der Wert verglichen. + eType = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_TYPE)); + nPrecision = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)); + nScale = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_SCALE)); + nNullable = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_ISNULLABLE));; + } + + Reference<XFastPropertySet> xParaColumn; + sdbcx::OColumn* pRet = new sdbcx::OColumn(aParameterName + ,::rtl::OUString() + ,::rtl::OUString() + ,nNullable + , nPrecision + ,nScale + ,eType + ,sal_False + ,sal_False + ,sal_False + ,m_aSQLIterator.isCaseSensitive()); + xParaColumn = pRet; + m_xParamColumns->push_back(xParaColumn); + return nParameter; +} +// ------------------------------------------------------------------------- +void OResultSet::describeParameter() +{ + ::std::vector< OSQLParseNode*> aParseNodes; + scanParameter(m_pParseTree,aParseNodes); + if(aParseNodes.size()) + { + m_xParamColumns = new OSQLColumns(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + OSQLTable xTable = xTabs.begin()->second; + + String aTabName,aTmp,aColName,aParameterName; + ::std::vector< OSQLParseNode*>::iterator aIter = aParseNodes.begin(); + for(;aIter != aParseNodes.end();++aIter) + { + BOOL bNotFound(TRUE); + OSQLParseNode* pParseNode = *aIter; + pParseNode = pParseNode->getParent(); + pParseNode = pParseNode->getChild(0); + + m_aSQLIterator.getColumnRange(pParseNode,aColName,aTabName); + Reference<XFastPropertySet> xCol; + xTable->getColumns()->getByName(aColName) >>= xCol; + m_xParamColumns->push_back(xCol); + } + } +} +//------------------------------------------------------------------ +void OResultSet::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes) +{ + DBG_ASSERT(pParseNode != NULL,"SdbCursor: interner Fehler: ungueltiger ParseNode"); + + // Parameter Name-Regel gefunden? + if (SQL_ISRULE(pParseNode,parameter)) + { + DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); + DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); + + _rParaNodes.push_back(pParseNode); + // Weiterer Abstieg nicht erforderlich + return; + } + + // Weiter absteigen im Parse Tree + for (UINT32 i = 0; i < pParseNode->count(); i++) + scanParameter(pParseNode->getChild(i),_rParaNodes); +} + + diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx new file mode 100644 index 000000000000..d595da005387 --- /dev/null +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: FResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity; +using namespace connectivity::file; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_PRECISION)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + return m_rColumns.size(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + Any aName(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_REALNAME)); + return aName.hasValue() ? getString(aName) : getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_NAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return m_aTableName; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPENAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_NAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getBOOL(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getBOOL(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_ISAUTOINCREMENT)); +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_PRECISION)); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_SCALE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_ISNULLABLE)); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx new file mode 100644 index 000000000000..8dfbb1fd9521 --- /dev/null +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -0,0 +1,358 @@ +/************************************************************************* + * + * $RCSfile: FStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif + +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#define THROW_SQL(x) \ + OTools::ThrowException(x,m_aStatementHandle,SQL_HANDLE_STMT,*this) + +using namespace connectivity::file; +using namespace connectivity; +//------------------------------------------------------------------------------ +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; +//------------------------------------------------------------------------------ +OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex) + ,connectivity::OSimplePropertyContainer(OStatement_BASE::rBHelper) + ,rBHelper(OStatement_BASE::rBHelper) + ,m_pConnection(_pConnection) + ,m_pParseTree(NULL) + ,m_aSQLIterator(_pConnection->createCatalog()->getTables(),_pConnection->getMetaData(),NULL) +{ + m_pConnection->acquire(); + + sal_Int32 nAttrib = 0; + + registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_MAXFIELDSIZE, PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_MAXROWS, PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_QUERYTIMEOUT, PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_ESCAPEPROCESSING, PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); + + registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +} +//------------------------------------------------------------------------------ +void OStatement_Base::disposeResultSet() +{ + // free the cursor if alive + Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + m_xResultSet = Reference< XResultSet>(); +} +//------------------------------------------------------------------------------ +void OStatement_BASE2::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + disposeResultSet(); + + if (m_pConnection) + m_pConnection->release(); + + dispose_ChildImpl(); + OStatement_Base::disposing(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OStatement_BASE2::release() throw(RuntimeException) +{ + relase_ChildImpl(); +} +//----------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +void OStatement_Base::reset() throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + clearWarnings (); + + if (m_xResultSet.get().is()) + clearMyResultSet(); +} +//-------------------------------------------------------------------- +// clearMyResultSet +// If a ResultSet was created for this Statement, close it +//-------------------------------------------------------------------- + +void OStatement_Base::clearMyResultSet () throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference<XCloseable> xCloseable; + if(::utl::query_interface(m_xResultSet.get(),xCloseable)) + xCloseable->close(); + m_xResultSet = Reference< XResultSet>(); +} +//-------------------------------------------------------------------- +// setWarning +// Sets the warning +//-------------------------------------------------------------------- + +void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = ex; +} + +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // ::rtl::OString aSql(::rtl::OUStringToOString(sql,osl_getThreadTextEncoding())); + Reference< XResultSet > xRS = executeQuery(sql); + + return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; +} + +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSet > xRS = NULL; + + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + OResultSet* pResult = new OResultSet(this,m_aSQLIterator); + pResult->OpenImpl(); + xRS = pResult; + + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + + + // Execute the statement. If execute returns true, a result + // set exists. + return xRS; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSet > xRS = NULL; + + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + OResultSet* pResult = new OResultSet(this,m_aSQLIterator); + pResult->OpenImpl(); + xRS = pResult; + return pResult->getRowCountResult(); + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + return 0; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return makeAny(m_aLastWarning); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = SQLWarning(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() +{ + return *const_cast<OStatement_Base*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement"); + diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx new file mode 100644 index 000000000000..9036acdde05c --- /dev/null +++ b/connectivity/source/drivers/file/FTable.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: FTable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#include "file/FColumns.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif + +using namespace connectivity::file; +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; + +OFileTable::OFileTable(OConnection* _pConnection) : OTable_TYPEDEF(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()) + ,m_pConnection(_pConnection) + ,m_nFilePos(0) + ,m_nBufferSize(0) + ,m_pBuffer(NULL) +{ + construct(); + ::std::vector< ::rtl::OUString> aVector; + m_pColumns = new OColumns(this,m_aMutex,aVector); + m_aColumns = new OSQLColumns(); +} +// ------------------------------------------------------------------------- +OFileTable::OFileTable( OConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description , + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName + ) : OTable_TYPEDEF(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(), + _Name, + _Type, + _Description, + _SchemaName, + _CatalogName) + ,m_pConnection(_pConnection) + ,m_nFilePos(0) + ,m_nBufferSize(0) + ,m_pBuffer(NULL) +{ + m_aColumns = new OSQLColumns(); + construct(); + // refreshColumns(); +} +// ------------------------------------------------------------------------- +void OFileTable::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), + m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(4)); + } + + if(m_pColumns) + delete m_pColumns; + m_pColumns = new OColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OFileTable::refreshKeys() +{ +} +// ------------------------------------------------------------------------- +void OFileTable::refreshIndexes() +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || + rType == ::getCppuType((const Reference<XRename>*)0) || + rType == ::getCppuType((const Reference<XAlterTable>*)0) || + rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) || + rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) + return Any(); + + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + + return OTable_TYPEDEF::queryInterface(rType); +} +// ------------------------------------------------------------------------- +void SAL_CALL OFileTable::disposing(void) +{ + OTable::disposing(); + ::osl::MutexGuard aGuard(m_aMutex); + m_xMetaData = NULL; + delete m_pBuffer; + m_pBuffer = NULL; +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OFileTable::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 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + + diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx new file mode 100644 index 000000000000..6150ed228b39 --- /dev/null +++ b/connectivity/source/drivers/file/FTables.cxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $RCSfile: FTables.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#include "file/FTables.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ +//#include "file/FEmptyCollection.hxx" +//#endif + +using namespace connectivity::file; +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; + +namespace starutil = ::com::sun::star::util; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > 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::createFromAscii("%"); +// // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); +// // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE"); +// +// Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), +// aSchema,aName,aTypes); + + Reference< XNamed > xRet = NULL; +// if(xResult.is()) +// { +// Reference< XRow > xRow(xResult,UNO_QUERY); +// if(xResult->next()) // there can be only one table with this name +// { +// OFileTable* pRet = new OFileTable(static_cast<OFileCatalog&>(m_rParent).getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(), +// static_cast<OFileCatalog&>(m_rParent).getConnection(), +// aName,xRow->getString(4),xRow->getString(5),aSchema); +// xRet = pRet; +// } +// } +// + return xRet; +} +// ------------------------------------------------------------------------- +void OTables::impl_refresh( ) throw(RuntimeException) +{ + static_cast<OFileCatalog&>(m_rParent).refreshTables(); +} +// ------------------------------------------------------------------------- +void OTables::disposing(void) +{ + m_xMetaData = NULL; + OCollection::disposing(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OTables::createEmptyObject() +{ + return Reference< XPropertySet >(); +} +//------------------------------------------------------------------ +Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XColumnLocate>*)0) || + rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0) || + rType == ::getCppuType((const Reference<XAppend>*)0) || + rType == ::getCppuType((const Reference<XDrop>*)0)) + return Any(); + + typedef sdbcx::OCollection OTables_BASE; + return OTables_BASE::queryInterface(rType); +} + diff --git a/connectivity/source/drivers/file/file.xml b/connectivity/source/drivers/file/file.xml new file mode 100644 index 000000000000..253bccb84c4c --- /dev/null +++ b/connectivity/source/drivers/file/file.xml @@ -0,0 +1,70 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.ODBCDriver </Name> + +<Description> + This is the implementation of the sdbc-odbc bridge. +</Description> + +<ModuleName> odbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + + diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk new file mode 100644 index 000000000000..6497fcde76d3 --- /dev/null +++ b/connectivity/source/drivers/file/makefile.mk @@ -0,0 +1,158 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=file + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + com.sun.star.lang.XServiceInfo + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/FConnection.obj \ + $(SLO)$/FValue.obj \ + $(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \ + $(SLO)$/FDatabaseMetaDataResultSet.obj \ + $(SLO)$/FResultSetMetaData.obj \ + $(SLO)$/FColumns.obj \ + $(SLO)$/FTables.obj \ + $(SLO)$/FTable.obj \ + $(SLO)$/FCatalog.obj \ + $(SLO)$/FResultSet.obj \ + $(SLO)$/FStatement.obj \ + $(SLO)$/FPreparedStatement.obj \ + $(SLO)$/FDatabaseMetaData.obj \ + $(SLO)$/FDriver.obj + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + |