47java_sql_CallableStatement::java_sql_CallableStatement( JNIEnv * pEnv,
java_sql_Connection& _rCon,
const OUString&
sql )
60 return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,
static_cast< css::sdbc::XRow*
>(
this),
static_cast< css::sdbc::XOutParameters*
>(
this));
75 static jmethodID mID(
nullptr);
83 static jmethodID mID(
nullptr);
90 static jmethodID mID(
nullptr);
91 jbyte (JNIEnv::*
const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallByteMethod;
92 return callMethodWithIntArg<jbyte>(pCallMethod,
"getByte",
"(I)B",mID,columnIndex);
96 ::osl::MutexGuard aGuard(
m_aMutex );
98 Sequence< sal_Int8 >
aSeq;
102 static jmethodID mID(
nullptr);
107 aSeq.realloc(
t.pEnv->GetArrayLength(out));
108 memcpy(
aSeq.getArray(),
t.pEnv->GetByteArrayElements(out,&
p),
aSeq.getLength());
109 t.pEnv->DeleteLocalRef(out);
117 static jmethodID mID(
nullptr);
119 return out ?
static_cast <css::util::Date
>(
java_sql_Date(
t.pEnv, out )) : css::util::Date();
125 static jmethodID mID(
nullptr);
126 double (JNIEnv::*
const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallDoubleMethod;
127 return callMethodWithIntArg<double>(pCallMethod,
"getDouble",
"(I)D",mID,columnIndex);
134 static jmethodID mID(
nullptr);
135 jfloat (JNIEnv::*
const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallFloatMethod;
136 return callMethodWithIntArg<jfloat>(pCallMethod,
"getFloat",
"(I)F",mID,columnIndex);
143 static jmethodID mID(
nullptr);
151 static jmethodID mID(
nullptr);
152 jlong (JNIEnv::*
const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
153 return callMethodWithIntArg<jlong>(pCallMethod,
"getLong",
"(I)J",mID,columnIndex);
160 static jmethodID mID(
nullptr);
170 static jmethodID mID(
nullptr);
171 jshort (JNIEnv::*
const pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallShortMethod;
172 return callMethodWithIntArg<jshort>(pCallMethod,
"getShort",
"(I)S",mID,columnIndex);
177 ::osl::MutexGuard aGuard(
m_aMutex );
181 static jmethodID mID(
nullptr);
189 static jmethodID mID(
nullptr);
192 return out ?
static_cast <css::util::Time
> (
java_sql_Time(
t.pEnv, out )) : css::util::Time();
199 static jmethodID mID(
nullptr);
202 return out ?
static_cast <css::util::DateTime
> (
java_sql_Timestamp(
t.pEnv, out )) : css::util::DateTime();
207 ::osl::MutexGuard aGuard(
m_aMutex );
215 static const char *
const cSignature =
"(IILjava/lang/String;)V";
216 static const char *
const cMethodName =
"registerOutParameter";
218 static jmethodID mID(
nullptr);
222 t.pEnv->CallVoidMethod(
object, mID, parameterIndex,sqlType,str.
get());
228 ::osl::MutexGuard aGuard(
m_aMutex );
235 static const char *
const cSignature =
"(III)V";
236 static const char *
const cMethodName =
"registerOutParameter";
238 static jmethodID mID(
nullptr);
240 t.pEnv->CallVoidMethod(
object, mID, parameterIndex,sqlType,
scale);
257 Reference< css::sdbc::XBlob > xBlob =
getBlob(columnIndex);
258 return xBlob.is() ? xBlob->getBinaryStream() : Reference< css::io::XInputStream >();
262 Reference< css::sdbc::XClob > xClob =
getClob(columnIndex);
263 return xClob.is() ? xClob->getCharacterStream() : Reference< css::io::XInputStream >();
270 static jmethodID mID(
nullptr);
280 static jmethodID mID(
nullptr);
289 static jmethodID mID(
nullptr);
299 static jmethodID mID(
nullptr);
302 return out==
nullptr ? nullptr :
new java_sql_Ref(
t.pEnv, out );
317 ::osl::MutexGuard aGuard(
m_aMutex );
321 if( !
t.pEnv ||
object )
325 static const char *
const cMethodName =
"prepareCall";
327 jobject out =
nullptr;
331 static jmethodID mID = [&]()
333 static const char *
const cSignature =
"(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
334 return t.pEnv->GetMethodID(
m_pConnection->getMyClass(), cMethodName, cSignature );
341 static const char *
const cSignature2 =
"(Ljava/lang/String;)Ljava/sql/CallableStatement;";
342 static jmethodID mID2 =
t.pEnv->GetMethodID(
m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,
"Unknown method id!");
344 out =
t.pEnv->CallObjectMethod(
m_pConnection->getJavaObject(), mID2, str.
get() );
350 object =
t.pEnv->NewGlobalRef( out );
IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement")
bool callBooleanMethod(const char *_pMethodName, jmethodID &_inout_MethodID) const
sal_Int32 callIntMethodWithIntArg_ThrowSQL(const char *_pMethodName, jmethodID &_inout_MethodID, sal_Int32 _nArgument) const
jobject callObjectMethodWithIntArg(JNIEnv *pEnv, const char *_pMethodName, const char *_pSignature, jmethodID &_inout_MethodID, sal_Int32 _nArgument) const
bool callBooleanMethodWithIntArg(const char *_pMethodName, jmethodID &_inout_MethodID, sal_Int32 _nArgument) const
OUString callStringMethodWithIntArg(const char *_pMethodName, jmethodID &_inout_MethodID, sal_Int32 _nArgument) const
static void ThrowLoggedSQLException(const ::comphelper::EventLogger &_rLogger, JNIEnv *pEnvironment, const css::uno::Reference< css::uno::XInterface > &_rxContext)
static jclass findMyClass(const char *_pClassName)
void obtainMethodId_throwSQL(JNIEnv *_pEnv, const char *_pMethodName, const char *_pSignature, jmethodID &_inout_MethodID) const
virtual jclass getMyClass() const override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual void createStatement(JNIEnv *_pEnv) override
virtual void SAL_CALL registerOutParameter(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString &typeName) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual void SAL_CALL registerNumericOutParameter(sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale) override
virtual sal_Bool SAL_CALL wasNull() override
virtual ~java_sql_CallableStatement() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual void SAL_CALL acquire() noexcept override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() noexcept override
java::sql::ConnectionLog m_aLogger
sal_Int32 m_nResultSetConcurrency
sal_Int32 m_nResultSetType
rtl::Reference< java_sql_Connection > m_pConnection
helper class to hold a local ref to a JNI object
mutable::osl::Mutex m_aMutex
Sequence< sal_Int8 > aSeq
jstring convertwchar_tToJavaString(JNIEnv *pEnv, const OUString &Temp)
void checkDisposed(bool _bThrow)