diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 07:44:11 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 07:44:11 +0000 |
commit | 4e1e909fbd95eb8062b2ba408f3098c4e934a876 (patch) | |
tree | 124d4f11b66064fe5e5b6f98ed501aa670550dc2 /connectivity/source/drivers | |
parent | 3f431fbb65c58fa98862bffd5a61681f5a03e6f5 (diff) |
INTEGRATION: CWS dba16 (1.32.12); FILE MERGED
2004/10/11 13:22:36 oj 1.32.12.3: RESYNC: (1.32-1.33); FILE MERGED
2004/10/11 06:14:53 oj 1.32.12.2: #i32931# remove the weak interface, refcount handled by parent
2004/09/24 07:37:36 oj 1.32.12.1: #i31337# check if select columns exist otherwise throw exception
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r-- | connectivity/source/drivers/file/FStatement.cxx | 109 |
1 files changed, 58 insertions, 51 deletions
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index ffe141f13d50..975da13c6e0e 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FStatement.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: rt $ $Date: 2004-09-08 16:20:55 $ + * last change: $Author: rt $ $Date: 2004-10-22 08:44:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -307,52 +307,6 @@ void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) } // ------------------------------------------------------------------------- - -sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - 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 ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - construct(sql); - OResultSet* pResult = createResultSet(); - Reference< XResultSet > xRS = pResult; - initializeResultSet(pResult); - - pResult->OpenImpl(); - 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 ); - checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - - construct(sql); - OResultSet* pResult = createResultSet(); - Reference< XResultSet > xRS = pResult; - initializeResultSet(pResult); - pResult->OpenImpl(); - - return pResult->getRowCountResult(); -} -// ------------------------------------------------------------------------- Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -401,6 +355,53 @@ void SAL_CALL OStatement::release() throw() OStatement_BASE2::release(); } // ----------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + executeQuery(sql); + + return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; +} + +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + construct(sql); + OResultSet* pResult = createResultSet(); + Reference< XResultSet > xRS = pResult; + initializeResultSet(pResult); + + pResult->OpenImpl(); + return xRS; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + construct(sql); + OResultSet* pResult = createResultSet(); + Reference< XResultSet > xRS = pResult; + initializeResultSet(pResult); + pResult->OpenImpl(); + + return pResult->getRowCountResult(); +} + +// ----------------------------------------------------------------------------- void SAL_CALL OStatement_Base::disposing(void) { if(m_aEvaluateRow.isValid()) @@ -412,14 +413,15 @@ void SAL_CALL OStatement_Base::disposing(void) OStatement_BASE::disposing(); } // ----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException) { return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- -::com::sun::star::uno::Any SAL_CALL OStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) { - return OStatement_BASE2::queryInterface( rType); + Any aRet = OStatement_XStatement::queryInterface( rType); + return aRet.hasValue() ? aRet : OStatement_BASE2::queryInterface( rType); } // ----------------------------------------------------------------------------- OSQLAnalyzer* OStatement_Base::createAnalyzer() @@ -525,6 +527,11 @@ void OStatement_Base::construct(const ::rtl::OUString& sql) throw(SQLException, static_cast<XWeak*>(this), makeAny(m_aSQLIterator.getWarning())); + if ( m_aSQLIterator.getSelectColumns()->empty() ) + throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid. It contains no valid column names."), + static_cast<XWeak*>(this), + makeAny(m_aSQLIterator.getWarning())); + // at this moment we support only one table per select statement Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY); if(xTunnel.is()) |