/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
jclass java_sql_Statement_Base::getMyClass() const
{ // the class must be fetched only once, therefore static if( !theClass )
theClass = findMyClass("java/sql/Statement"); return theClass;
}
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
createStatement(t.pEnv);
m_sSqlStatement = sql; static jmethodID mID(nullptr); return callIntMethodWithStringArg("executeUpdate",mID,sql);
}
Reference< css::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base::getResultSet( )
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
createStatement(t.pEnv); static jmethodID mID(nullptr);
jobject out = callResultSetMethod(t.env(),"getResultSet",mID);
// WARNING: the caller becomes the owner of the returned pointer return out==nullptr ? nullptr : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this );
}
sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( )
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
createStatement(t.pEnv); static jmethodID mID(nullptr);
sal_Int32 out = callIntMethod_ThrowSQL("getUpdateCount", mID);
m_aLogger.log( LogLevel::FINER, STR_LOG_UPDATE_COUNT, out ); return out;
}
Any SAL_CALL java_sql_Statement_Base::getWarnings( )
{
SDBThreadAttach t;
createStatement(t.pEnv); static jmethodID mID(nullptr);
jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); // WARNING: the caller becomes the owner of the returned pointer if( out )
{
java_sql_SQLWarning_BASE warn_base( t.pEnv, out ); return Any( static_cast< css::sdbc::SQLException >(
java_sql_SQLWarning(warn_base,getXWeak())));
}
sal_Bool java_sql_Statement_Base::convertFastPropertyValue(
Any & rConvertedValue,
Any & rOldValue,
sal_Int32 nHandle, const Any& rValue )
{ try
{ switch(nHandle)
{ case PROPERTY_ID_QUERYTIMEOUT: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); case PROPERTY_ID_MAXFIELDSIZE: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); case PROPERTY_ID_MAXROWS: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows()); case PROPERTY_ID_CURSORNAME: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); case PROPERTY_ID_RESULTSETCONCURRENCY: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); case PROPERTY_ID_RESULTSETTYPE: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); case PROPERTY_ID_FETCHDIRECTION: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); case PROPERTY_ID_FETCHSIZE: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); case PROPERTY_ID_ESCAPEPROCESSING: return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEscapeProcessing ); case PROPERTY_ID_USEBOOKMARKS: // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); default:
;
}
} catch(const css::lang::IllegalArgumentException&)
{ throw;
} catch(const css::uno::Exception&)
{
DBG_UNHANDLED_EXCEPTION("connectivity.jdbc");
} returnfalse;
}
void java_sql_Statement_Base::setFastPropertyValue_NoBroadcast(
sal_Int32 nHandle, const Any& rValue
)
{ switch(nHandle)
{ case PROPERTY_ID_QUERYTIMEOUT:
setQueryTimeOut(comphelper::getINT32(rValue)); break; case PROPERTY_ID_MAXFIELDSIZE:
setMaxFieldSize(comphelper::getINT32(rValue)); break; case PROPERTY_ID_MAXROWS:
setMaxRows(comphelper::getINT32(rValue)); break; case PROPERTY_ID_CURSORNAME:
setCursorName(comphelper::getString(rValue)); break; case PROPERTY_ID_RESULTSETCONCURRENCY:
setResultSetConcurrency(comphelper::getINT32(rValue)); break; case PROPERTY_ID_RESULTSETTYPE:
setResultSetType(comphelper::getINT32(rValue)); break; case PROPERTY_ID_FETCHDIRECTION:
setFetchDirection(comphelper::getINT32(rValue)); break; case PROPERTY_ID_FETCHSIZE:
setFetchSize(comphelper::getINT32(rValue)); break; case PROPERTY_ID_ESCAPEPROCESSING:
setEscapeProcessing( ::comphelper::getBOOL( rValue ) ); break; case PROPERTY_ID_USEBOOKMARKS: // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); default:
;
}
}
void java_sql_Statement_Base::getFastPropertyValue(
Any& rValue,
sal_Int32 nHandle
) const
{
java_sql_Statement_Base* THIS = const_cast<java_sql_Statement_Base*>(this); try
{ switch(nHandle)
{ case PROPERTY_ID_QUERYTIMEOUT:
rValue <<= THIS->getQueryTimeOut(); break; case PROPERTY_ID_MAXFIELDSIZE:
rValue <<= THIS->getMaxFieldSize(); break; case PROPERTY_ID_MAXROWS:
rValue <<= THIS->getMaxRows(); break; case PROPERTY_ID_CURSORNAME:
rValue <<= THIS->getCursorName(); break; case PROPERTY_ID_RESULTSETCONCURRENCY:
rValue <<= THIS->getResultSetConcurrency(); break; case PROPERTY_ID_RESULTSETTYPE:
rValue <<= THIS->getResultSetType(); break; case PROPERTY_ID_FETCHDIRECTION:
rValue <<= THIS->getFetchDirection(); break; case PROPERTY_ID_FETCHSIZE:
rValue <<= THIS->getFetchSize(); break; case PROPERTY_ID_ESCAPEPROCESSING:
rValue <<= m_bEscapeProcessing; break; case PROPERTY_ID_USEBOOKMARKS: default:
;
}
} catch(const Exception&)
{
}
}
jclass java_sql_Statement::theClass = nullptr;
java_sql_Statement::~java_sql_Statement()
{}
jclass java_sql_Statement::getMyClass() const
{ // the class must be fetched only once, therefore static if( !theClass )
theClass = findMyClass("java/sql/Statement"); return theClass;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.