2013-05-10 18:21:30 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* the BSD license.
|
|
|
|
*
|
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of Sun Microsystems, Inc. nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
|
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
|
|
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "FResultSet.hxx"
|
|
|
|
#include "FResultSetMetaData.hxx"
|
2013-05-23 13:31:58 +00:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
2013-05-10 18:21:30 +00:00
|
|
|
#include <com/sun/star/sdbc/DataType.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
|
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
|
|
|
#include "propertyids.hxx"
|
2013-07-17 08:55:24 +02:00
|
|
|
#include <comphelper/sequence.hxx>
|
2013-05-10 18:21:30 +00:00
|
|
|
|
2013-07-17 08:55:24 +02:00
|
|
|
using namespace ::comphelper;
|
2013-05-10 18:21:30 +00:00
|
|
|
using namespace connectivity::firebird;
|
|
|
|
using namespace cppu;
|
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
using namespace com::sun::star::beans;
|
|
|
|
using namespace com::sun::star::sdbc;
|
|
|
|
using namespace com::sun::star::sdbcx;
|
|
|
|
using namespace com::sun::star::container;
|
|
|
|
using namespace com::sun::star::io;
|
|
|
|
using namespace com::sun::star::util;
|
|
|
|
|
2013-05-27 13:14:41 +00:00
|
|
|
/*
|
|
|
|
* Print the status, the SQLCODE, and exit.
|
|
|
|
* Also, indicate which operation the error occured on.
|
|
|
|
*/
|
2013-07-16 10:56:17 +02:00
|
|
|
static int pr_error (const ISC_STATUS* status, const char* operation)
|
2013-05-27 13:14:41 +00:00
|
|
|
{
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_WARN("connectivity.firebird", "=> OResultSet static pr_error().");
|
2013-05-27 13:14:41 +00:00
|
|
|
|
|
|
|
isc_print_status(status);
|
|
|
|
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_WARN("connectivity.firebird", "=> OResultSet static pr_error(). "
|
|
|
|
"PROBLEM ON " << operation << ". "
|
|
|
|
"SQLCODE: " << isc_sqlcode(status) << ".");
|
2013-05-27 13:14:41 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2013-05-23 13:31:58 +00:00
|
|
|
|
2013-05-10 18:21:30 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
|
|
|
|
::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
|
|
|
|
{
|
|
|
|
return ::rtl::OUString("com.sun.star.sdbcx.firebird.ResultSet");
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
|
|
|
|
{
|
|
|
|
Sequence< ::rtl::OUString > aSupported(2);
|
|
|
|
aSupported[0] = ::rtl::OUString("com.sun.star.sdbc.ResultSet");
|
|
|
|
aSupported[1] = ::rtl::OUString("com.sun.star.sdbcx.ResultSet");
|
|
|
|
return aSupported;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
|
|
|
|
{
|
|
|
|
Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
|
|
|
|
const ::rtl::OUString* pSupported = aSupported.getConstArray();
|
|
|
|
const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
|
|
|
|
for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
|
|
|
|
;
|
|
|
|
|
|
|
|
return pSupported != pEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2013-05-27 13:14:41 +00:00
|
|
|
OResultSet::OResultSet(OStatement_Base* pStmt)
|
2013-05-10 18:21:30 +00:00
|
|
|
: OResultSet_BASE(m_aMutex)
|
|
|
|
,OPropertySetHelper(OResultSet_BASE::rBHelper)
|
2013-07-16 10:56:17 +02:00
|
|
|
,m_pStatement(pStmt)
|
2013-05-10 18:21:30 +00:00
|
|
|
,m_aStatement((OWeakObject*)pStmt)
|
|
|
|
,m_xMetaData(NULL)
|
|
|
|
,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
|
|
|
|
,m_bWasNull(sal_True)
|
2013-05-23 13:31:58 +00:00
|
|
|
,m_row(-1)
|
2013-05-10 18:21:30 +00:00
|
|
|
{
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_INFO("connectivity.firebird", "=> OResultSet::OResultSet().");
|
|
|
|
|
2013-05-27 13:14:41 +00:00
|
|
|
isc_stmt_handle stmt = m_pStatement->getSTMTHandler();
|
|
|
|
XSQLDA *sqlda = m_pStatement->getOUTsqlda();
|
|
|
|
if (sqlda == NULL)
|
|
|
|
{
|
|
|
|
m_rowCount = 0;
|
|
|
|
m_fieldCount = 0;
|
|
|
|
} else {
|
|
|
|
m_rowCount = 0;
|
|
|
|
m_fieldCount = sqlda->sqld;
|
|
|
|
}
|
|
|
|
|
|
|
|
ISC_STATUS_ARRAY status; // status vector
|
|
|
|
ISC_STATUS retcode;
|
|
|
|
int j = 0;
|
|
|
|
while ((retcode = isc_dsql_fetch(status, &stmt, 1, sqlda)) == 0)
|
|
|
|
{
|
|
|
|
m_rowCount++;
|
|
|
|
|
|
|
|
TRow row(m_fieldCount);
|
|
|
|
XSQLVAR *var = NULL;
|
|
|
|
for (j=0, var = sqlda->sqlvar; j < m_fieldCount; j++, var++)
|
|
|
|
{
|
|
|
|
row[j] = OUString(var->sqldata, var->sqllen, RTL_TEXTENCODING_UTF8);
|
|
|
|
}
|
|
|
|
m_sqldata.push_back(row);
|
|
|
|
}
|
|
|
|
if (retcode != 100L)
|
|
|
|
{
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_INFO("connectivity.firebird", "=> OResultSet::OResultSet(). "
|
|
|
|
"Retcode: " << retcode);
|
2013-05-27 13:14:41 +00:00
|
|
|
if (pr_error(status, "fetch data"))
|
|
|
|
return;
|
|
|
|
}
|
2013-06-04 13:54:48 +00:00
|
|
|
if (isc_dsql_free_statement(status, &stmt, DSQL_close))
|
|
|
|
if (pr_error(status, "free statement"))
|
2013-05-27 15:00:29 +00:00
|
|
|
return;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
OResultSet::~OResultSet()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::disposing(void)
|
|
|
|
{
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_INFO("connectivity.firebird", "=> OResultSet::disposing().");
|
2013-05-27 21:06:48 +00:00
|
|
|
|
2013-05-10 18:21:30 +00:00
|
|
|
OPropertySetHelper::disposing();
|
|
|
|
|
|
|
|
::osl::MutexGuard aGuard(m_aMutex);
|
|
|
|
|
|
|
|
m_aStatement = NULL;
|
|
|
|
m_xMetaData = NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
Any aRet = OPropertySetHelper::queryInterface(rType);
|
|
|
|
if(!aRet.hasValue())
|
|
|
|
aRet = OResultSet_BASE::queryInterface(rType);
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
|
|
|
|
{
|
|
|
|
OTypeCollection aTypes(
|
|
|
|
::cppu::UnoType< Reference< ::com::sun::star::beans::XMultiPropertySet > >::get(),
|
|
|
|
::cppu::UnoType< Reference< ::com::sun::star::beans::XFastPropertySet > >::get(),
|
|
|
|
::cppu::UnoType< Reference< ::com::sun::star::beans::XPropertySet > >::get());
|
|
|
|
|
|
|
|
return concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
// find the first column with the name columnName
|
|
|
|
|
|
|
|
::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.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
|
|
|
|
break;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int8 nRet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
return Sequence< sal_Int8 >();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
Date nRet;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
double nRet = 0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
float nVal(0);
|
|
|
|
return nVal;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
sal_Int32 nRet=0;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_row +1;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return sal_Int64();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
if(!m_xMetaData.is())
|
|
|
|
m_xMetaData = new OResultSetMetaData(m_pStatement->getOwnConnection());
|
|
|
|
return m_xMetaData;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) typeMap;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return Any();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-27 13:14:41 +00:00
|
|
|
char *str = strdup(OUStringToOString(m_sqldata[m_row][columnIndex-1] , RTL_TEXTENCODING_UTF8 ).getStr());
|
2013-05-10 18:21:30 +00:00
|
|
|
|
2013-05-27 13:14:41 +00:00
|
|
|
sal_Int16 nRet= *str;
|
2013-05-10 18:21:30 +00:00
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2013-05-23 13:31:58 +00:00
|
|
|
checkColumnIndex( columnIndex );
|
|
|
|
checkRowIndex( sal_True /* must be on row */ );
|
2013-05-10 18:21:30 +00:00
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_sqldata[m_row][columnIndex-1];
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
Time nRet;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
DateTime nRet;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_row == -1;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_row >= m_rowCount;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_row == 0 && m_rowCount;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
return m_row >= 0 && m_row + 1 == m_rowCount;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
m_row = -1;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
2013-05-23 13:31:58 +00:00
|
|
|
|
|
|
|
m_row = m_rowCount;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-06-04 13:51:40 +03:00
|
|
|
SAL_INFO("connectivity.firebird", "=> OResultSet::close().");
|
2013-05-27 21:06:48 +00:00
|
|
|
|
2013-05-10 18:21:30 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
sal_Bool bRet = ( m_rowCount > 0 );
|
|
|
|
if( bRet )
|
|
|
|
m_row = 0;
|
|
|
|
return bRet;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
sal_Bool bRet = ( m_rowCount > 0 );
|
|
|
|
if( bRet )
|
|
|
|
m_row = m_rowCount -1;
|
|
|
|
return bRet;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
if( row > 0 )
|
|
|
|
{
|
|
|
|
m_row = row -1;
|
|
|
|
if( m_row > m_rowCount )
|
|
|
|
m_row = m_rowCount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_row = m_rowCount + row;
|
|
|
|
if( m_row < -1 )
|
|
|
|
m_row = -1;
|
|
|
|
}
|
|
|
|
return sal_True;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
m_row += row;
|
|
|
|
|
|
|
|
if( m_row > m_rowCount )
|
|
|
|
m_row = m_rowCount;
|
|
|
|
else if ( m_row < -1 )
|
|
|
|
m_row = -1;
|
|
|
|
return sal_True;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
sal_Bool bRet = ( m_row != -1 );
|
|
|
|
if( bRet )
|
|
|
|
m_row --;
|
|
|
|
return bRet;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return m_aStatement.get();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
m_row ++;
|
|
|
|
return m_row < m_rowCount;
|
2013-05-10 18:21:30 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
return m_bWasNull;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
// you only have to implement this if you want to insert new rows
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
// only when you allow updates
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
|
|
|
|
// only when you allow insert's
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
|
|
|
(void) length;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
|
|
|
(void) length;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) columnIndex;
|
|
|
|
(void) x;
|
|
|
|
(void) scale;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XRowLocate
|
|
|
|
Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
// if you don't want to support bookmark you must remove the XRowLocate interface
|
|
|
|
|
|
|
|
return Any();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) bookmark;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) bookmark;
|
|
|
|
(void) rows;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2013-07-16 10:56:17 +02:00
|
|
|
sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& aFirst, const Any& aSecond ) throw( SQLException, RuntimeException)
|
2013-05-10 18:21:30 +00:00
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) aFirst;
|
|
|
|
(void) aSecond;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return CompareBookmark::NOT_EQUAL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) bookmark;
|
2013-05-10 18:21:30 +00:00
|
|
|
throw SQLException();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// XDeleteRows
|
|
|
|
Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) rows;
|
2013-05-10 18:21:30 +00:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
|
|
|
|
|
|
|
|
return Sequence< sal_Int32 >();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
|
|
|
|
{
|
|
|
|
Sequence< Property > aProps(6);
|
|
|
|
Property* pProperties = aProps.getArray();
|
|
|
|
sal_Int32 nPos = 0;
|
|
|
|
DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
|
|
|
|
DECL_PROP0(FETCHDIRECTION, sal_Int32);
|
|
|
|
DECL_PROP0(FETCHSIZE, sal_Int32);
|
|
|
|
DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
|
|
|
|
DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
|
|
|
|
DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
|
|
|
|
|
|
|
|
return new OPropertyArrayHelper(aProps);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
IPropertyArrayHelper & OResultSet::getInfoHelper()
|
|
|
|
{
|
|
|
|
return *const_cast<OResultSet*>(this)->getArrayHelper();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool OResultSet::convertFastPropertyValue(
|
|
|
|
Any & rConvertedValue,
|
|
|
|
Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) rConvertedValue;
|
|
|
|
(void) rOldValue;
|
|
|
|
(void) rValue;
|
2013-05-10 18:21:30 +00:00
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ISBOOKMARKABLE:
|
|
|
|
case PROPERTY_ID_CURSORNAME:
|
|
|
|
case PROPERTY_ID_RESULTSETCONCURRENCY:
|
|
|
|
case PROPERTY_ID_RESULTSETTYPE:
|
|
|
|
throw ::com::sun::star::lang::IllegalArgumentException();
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FETCHDIRECTION:
|
|
|
|
case PROPERTY_ID_FETCHSIZE:
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::setFastPropertyValue_NoBroadcast(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue
|
|
|
|
)
|
|
|
|
throw (Exception)
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) rValue;
|
2013-05-10 18:21:30 +00:00
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ISBOOKMARKABLE:
|
|
|
|
case PROPERTY_ID_CURSORNAME:
|
|
|
|
case PROPERTY_ID_RESULTSETCONCURRENCY:
|
|
|
|
case PROPERTY_ID_RESULTSETTYPE:
|
|
|
|
throw Exception();
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FETCHDIRECTION:
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FETCHSIZE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void OResultSet::getFastPropertyValue(
|
|
|
|
Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const
|
|
|
|
{
|
2013-07-16 10:56:17 +02:00
|
|
|
(void) rValue;
|
2013-05-10 18:21:30 +00:00
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ISBOOKMARKABLE:
|
|
|
|
case PROPERTY_ID_CURSORNAME:
|
|
|
|
case PROPERTY_ID_RESULTSETCONCURRENCY:
|
|
|
|
case PROPERTY_ID_RESULTSETTYPE:
|
|
|
|
case PROPERTY_ID_FETCHDIRECTION:
|
|
|
|
case PROPERTY_ID_FETCHSIZE:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::acquire() throw()
|
|
|
|
{
|
|
|
|
OResultSet_BASE::acquire();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OResultSet::release() throw()
|
|
|
|
{
|
|
|
|
OResultSet_BASE::release();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2013-05-23 13:31:58 +00:00
|
|
|
void SAL_CALL OResultSet::checkColumnIndex(sal_Int32 index ) throw ( SQLException, RuntimeException )
|
|
|
|
{
|
|
|
|
if( index < 1 || index > m_fieldCount )
|
|
|
|
{
|
|
|
|
OUStringBuffer buf(128);
|
|
|
|
buf.appendAscii( "pq_resultset: index out of range (" );
|
|
|
|
buf.append( index );
|
|
|
|
buf.appendAscii( ", allowed range is 1 to " );
|
|
|
|
buf.append( m_fieldCount );
|
|
|
|
buf.appendAscii( ")" );
|
|
|
|
throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL OResultSet::checkRowIndex( sal_Bool mustBeOnValidRow )
|
|
|
|
{
|
|
|
|
OUStringBuffer buf( 128 );
|
|
|
|
buf.appendAscii( "pq_baseresultset: row index out of range, allowed is " );
|
|
|
|
if( mustBeOnValidRow )
|
|
|
|
{
|
|
|
|
if( m_row < 0 || m_row >= m_rowCount )
|
|
|
|
{
|
|
|
|
buf.appendAscii( "0 to " );
|
|
|
|
buf.append( ((sal_Int32)(m_rowCount -1)) );
|
|
|
|
buf.appendAscii( ", got " );
|
|
|
|
buf.append( m_row );
|
|
|
|
throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_row < -1 || m_row > m_rowCount )
|
|
|
|
{
|
|
|
|
buf.appendAscii( "-1 to " );
|
|
|
|
buf.append( m_rowCount );
|
|
|
|
buf.appendAscii( ", got " );
|
|
|
|
buf.append( m_row );
|
|
|
|
throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-10 18:21:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|