diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-12-19 15:50:08 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-12-19 15:50:08 +0000 |
commit | 059e9e2de888fb7179366fa8d90fead357c04d93 (patch) | |
tree | a521e1891e9ba072b8d3facc698bf84225ba6828 /connectivity | |
parent | f67d0ca3adc6ac3bf103a071cb0952e4be9683dd (diff) |
INTEGRATION: CWS kaddrbook (1.1.2); FILE ADDED
2005/12/02 20:19:13 ebischoff 1.1.2.11: Issue number:
Submitted by:
Reviewed by:
Making "Revision date" a "version" field. Such fields are not displayed, by default.
2005/11/30 13:56:38 kendy 1.1.2.10: #i54170#
SISSL/LGPL -> LGPL for the KDE AddressBook files.
2005/11/25 10:39:32 ebischoff 1.1.2.9: Changing type of reference to the meta data
2005/11/22 14:38:54 ebischoff 1.1.2.8: Using new cast syntax
2005/10/12 16:42:20 ebischoff 1.1.2.7: Fixed a bug
2005/09/12 12:10:05 ebischoff 1.1.2.6: Raising unsupported function exceptions when using XParameters interface
2005/09/02 13:50:50 ebischoff 1.1.2.5: Cleanup
2005/09/02 02:42:02 ebischoff 1.1.2.4: Simplifying
2005/09/01 17:11:30 ebischoff 1.1.2.3: Simplifying the statements classes
2005/08/31 14:31:07 ebischoff 1.1.2.2: Continuing with code review
2005/08/29 08:43:51 ebischoff 1.1.2.1: Initial checkin of KDE address book driver
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/kab/KPreparedStatement.cxx | 352 |
1 files changed, 352 insertions, 0 deletions
diff --git a/connectivity/source/drivers/kab/KPreparedStatement.cxx b/connectivity/source/drivers/kab/KPreparedStatement.cxx new file mode 100644 index 000000000000..c56574d57d27 --- /dev/null +++ b/connectivity/source/drivers/kab/KPreparedStatement.cxx @@ -0,0 +1,352 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: KPreparedStatement.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2005-12-19 16:50:08 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 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 + * + ************************************************************************/ + +#include "KPreparedStatement.hxx" + +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _DBHELPER_DBEXCEPTION_HXX_ +#include <connectivity/dbexception.hxx> +#endif + +using namespace connectivity::kab; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::util; + +IMPLEMENT_SERVICE_INFO(KabPreparedStatement, "com.sun.star.sdbc.drivers.KabPreparedStatement", "com.sun.star.sdbc.PreparedStatement"); +// ------------------------------------------------------------------------- +void KabPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) +{ + // no parameters allowed in this implementation + throw SQLException(); +} +// ------------------------------------------------------------------------- +void KabPreparedStatement::setKabFields() const throw(SQLException) +{ + ::vos::ORef<connectivity::OSQLColumns> xColumns; // selected columns + KabResultSetMetaData *pMeta; // meta information - holds the list of KAddressBook fields + + xColumns = m_aSQLIterator.getSelectColumns(); + if (!xColumns.isValid()) + { + ::dbtools::throwGenericSQLException( + ::rtl::OUString::createFromAscii("Invalid selection of columns"), + NULL); + } + m_xMetaData->setKabFields(xColumns); +} +// ------------------------------------------------------------------------- +KabPreparedStatement::KabPreparedStatement( + KabConnection* _pConnection, + const ::rtl::OUString& sql) + : KabPreparedStatement_BASE(_pConnection), + m_bPrepared(sal_False), + m_sSqlStatement(sql) +{ +} +// ------------------------------------------------------------------------- +KabPreparedStatement::~KabPreparedStatement() +{ +} +// ------------------------------------------------------------------------- +Reference< XResultSetMetaData > SAL_CALL KabPreparedStatement::getMetaData() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + if (!m_xMetaData.is()) + { + m_xMetaData = new KabResultSetMetaData(getOwnConnection()); + setKabFields(); + } + Reference< XResultSetMetaData > xMetaData = m_xMetaData.get(); + return xMetaData; +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::close() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + // Reset last warning message + try { + clearWarnings (); + KabCommonStatement::close(); + } + catch (SQLException &) { + // If we get an error, ignore + } + + // Remove this Statement object from the Connection object's + // list +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL KabPreparedStatement::execute() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + Reference< XResultSet> xRS = KabCommonStatement::executeQuery(m_sSqlStatement); + + return xRS.is(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL KabPreparedStatement::executeUpdate() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + // same as in statement with the difference that this statement also can contain parameter + return 0; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL KabPreparedStatement::getConnection() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + return (Reference< XConnection >) m_pConnection; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL KabPreparedStatement::executeQuery() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + + Reference< XResultSet > rs = KabCommonStatement::executeQuery(m_sSqlStatement); + + return rs; +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setLong(sal_Int32 parameterIndex, sal_Int64 aVal) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setFloat(sal_Int32 parameterIndex, float x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setDouble(sal_Int32 parameterIndex, double x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setBytes(sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setDate(sal_Int32 parameterIndex, const Date& aData) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setTime(sal_Int32 parameterIndex, const Time& aVal) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setTimestamp(sal_Int32 parameterIndex, const DateTime& aVal) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setBinaryStream(sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setCharacterStream(sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setObject(sal_Int32 parameterIndex, const Any& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale) throw(SQLException, RuntimeException) +{ + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setRef(sal_Int32 parameterIndex, const Reference< XRef >& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setBlob(sal_Int32 parameterIndex, const Reference< XBlob >& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setClob(sal_Int32 parameterIndex, const Reference< XClob >& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::setArray(sal_Int32 parameterIndex, const Reference< XArray >& x) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabCommonStatement_BASE::rBHelper.bDisposed); + +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabPreparedStatement::clearParameters() throw(SQLException, RuntimeException) +{ +::dbtools::throwFunctionNotSupportedException(::rtl::OUString::createFromAscii("Not Implemented"), NULL); +} +// ------------------------------------------------------------------------- +void KabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + switch (nHandle) + { + case PROPERTY_ID_RESULTSETCONCURRENCY: + break; + case PROPERTY_ID_RESULTSETTYPE: + break; + case PROPERTY_ID_FETCHDIRECTION: + break; + case PROPERTY_ID_USEBOOKMARKS: + break; + default: + KabCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue); + } +} |