#85397# better error msg when no url is given

This commit is contained in:
Ocke Janssen 2001-07-04 09:54:31 +00:00
parent 001e3fcd31
commit 9a32e25cfb
7 changed files with 372 additions and 551 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: FConnection.cxx,v $
*
* $Revision: 1.28 $
* $Revision: 1.29 $
*
* last change: $Author: oj $ $Date: 2001-06-28 12:22:16 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -224,32 +224,9 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
}
catch(ContentCreationException&e)
{
SQLException aError;
aError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to create a content for the URL given."));
aError.SQLState = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
aError.ErrorCode = 0;
aError.Context = static_cast< XConnection* >(this);
SQLException aUrlError;
aUrlError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL: "));
aUrlError.Message += url;
aError.NextException <<= aUrlError;
if (e.Message.getLength())
{
aUrlError.NextException <<= SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCB message: ")) += e.Message, aError.Context, ::rtl::OUString(), 0, Any());
}
throw aError;
throwUrlNotValid(aFileName,e.Message);
}
// if (aFileStat.IsKind(FSYS_KIND_WILD))
// {
// m_aDirectoryName = (DirEntry(aFileName).GetPath()).GetFull();
// m_aFilenameExtension = DirEntry(aFileName).GetExtension();
//
// // nyi: Verschiedene Extensions (aufgrund des angegebenen Wildcard)
// // (bisher keine Wildcard in der Extension moeglich!)
// aWildcard = DirEntry(aFileName).GetName();
// } else
// set fields to fetch
Sequence< OUString > aProps(1);
OUString* pProps = aProps.getArray();
@ -272,25 +249,17 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
m_xDir = aParent.createDynamicCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY );
}
else
{
OSL_ENSURE(0,"OConnection::construct: ::ucb::Content isn't a folde nor a document! How that?!");
throw SQLException();
}
}
catch(Exception& e) // a execption is thrown when no file exists
{
SQLException aError;
aError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to create a content for the URL given."));
aError.SQLState = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
aError.ErrorCode = 0;
aError.Context = static_cast< XConnection* >(this);
if (e.Message.getLength())
aError.NextException <<= SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCB message: ")) += e.Message, aError.Context, ::rtl::OUString(), 0, Any());
throw aError;
throwUrlNotValid(aFileName,e.Message);
}
if(!m_xDir.is() || !m_xContent.is())
throw SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to create a content for the URL given.")),
*this,
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")),
0,
Any());
throwUrlNotValid(aFileName,::rtl::OUString());
if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND)
throw SQLException();
@ -563,6 +532,29 @@ Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId()
return pId->getImplementationId();
}
// -----------------------------------------------------------------------------
void OConnection::throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage)
{
SQLException aError;
aError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to create a content for the URL given."));
aError.SQLState = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
aError.ErrorCode = 0;
aError.Context = static_cast< XConnection* >(this);
SQLException aUrlError;
if(_rsUrl.getLength())
{
aUrlError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid URL: "));
aUrlError.Message += _rsUrl;
}
else
aUrlError.Message = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No URL supplied!"));
aError.NextException <<= aUrlError;
if (_rsMessage.getLength())
aUrlError.NextException <<= SQLException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UCB message: ")) += _rsMessage, aError.Context, ::rtl::OUString(), 0, Any());
throw aError;
}
// -----------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: CallableStatement.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: oj $ $Date: 2001-05-31 08:29:15 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -229,17 +229,14 @@ double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) t
jdouble out;
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv )
{
jvalue args[1];
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)D";
char * cMethodName = "getDouble";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallDoubleMethod( object, mID, args[0].i);
out = t.pEnv->CallDoubleMethod( object, mID, columnIndex);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -294,16 +291,13 @@ sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex )
jlong out;
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)J";
char * cMethodName = "getLong";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallLongMethod( object, mID, args[0].i );
out = t.pEnv->CallLongMethod( object, mID, columnIndex );
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -316,16 +310,13 @@ Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)Ljava/lang/Object;";
char * cMethodName = "getObject";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallObjectMethod( object, mID, args[0].i);
out = t.pEnv->CallObjectMethod( object, mID, columnIndex);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -339,16 +330,13 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex )
jshort out;
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)S";
char * cMethodName = "getShort";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallShortMethod( object, mID, args[0].i);
out = t.pEnv->CallShortMethod( object, mID, columnIndex);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -362,9 +350,6 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex )
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
::rtl::OUString aStr;
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)Ljava/lang/String;";
char * cMethodName = "getString";
@ -409,16 +394,13 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex )
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)Ljava/sql/Timestamp;";
char * cMethodName = "getTimestamp";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallObjectMethod( object, mID, args[0].i);
out = t.pEnv->CallObjectMethod( object, mID, columnIndex);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -432,11 +414,7 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv )
{
jvalue args[3];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].i = (sal_Int32)sqlType;
args[2].l = convertwchar_tToJavaString(t.pEnv,typeName);
// temporaere Variable initialisieren
char * cSignature = "(IILjava/lang/String;)V";
char * cMethodName = "registerOutParameter";
@ -444,9 +422,13 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].l);
jvalue args[1];
// Parameter konvertieren
args[0].l = convertwchar_tToJavaString(t.pEnv,typeName);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,args[0].l);
t.pEnv->DeleteLocalRef((jstring)args[0].l);
ThrowSQLException(t.pEnv,*this);
t.pEnv->DeleteLocalRef((jstring)args[2].l);
}
}
}
@ -455,11 +437,6 @@ void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv )
{
jvalue args[3];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].i = (sal_Int32)sqlType;
args[2].i = scale;
// temporaere Variable initialisieren
char * cSignature = "(III)V";
char * cMethodName = "registerOutParameter";
@ -467,7 +444,7 @@ void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].i);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,scale);
ThrowSQLException(t.pEnv,*this);
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: DatabaseMetaData.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: fs $ $Date: 2001-06-06 15:24:00 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -272,7 +272,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns(
args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
ThrowSQLException(t.pEnv,*this);
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
if(args[1].l)
@ -281,6 +281,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns(
t.pEnv->DeleteLocalRef((jstring)args[2].l);
if(args[3].l)
t.pEnv->DeleteLocalRef((jstring)args[3].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -293,25 +294,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[4];
sal_Int32 len = types.getLength();
if(len)
{
jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0);
const ::rtl::OUString* pBegin = types.getConstArray();
for(sal_Int32 i=0;i<len;i++,++pBegin)
{
jstring aT = convertwchar_tToJavaString(t.pEnv,*pBegin);
//jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i));
t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT);
}
args[3].l = pObjArray;
}else
args[3].l = 0;
// temporaere Variable initialisieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getTables";
@ -319,8 +302,26 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
jvalue args[4];
sal_Int32 len = types.getLength();
if(len)
{
jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0);
const ::rtl::OUString* pBegin = types.getConstArray();
for(sal_Int32 i=0;i<len;i++,++pBegin)
{
jstring aT = convertwchar_tToJavaString(t.pEnv,*pBegin);
//jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i));
t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT);
}
args[3].l = pObjArray;
}else
args[3].l = 0;
// temporaere Variable initialisieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
ThrowSQLException(t.pEnv,*this);
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
if(args[1].l)
@ -329,6 +330,8 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
t.pEnv->DeleteLocalRef((jstring)args[2].l);
//for(INT16 i=0;i<len;i++)
t.pEnv->DeleteLocalRef((jobjectArray)args[3].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -342,20 +345,21 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns(
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv )
{
jvalue args[4];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern);
args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getProcedureColumns";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[4];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern);
args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -365,6 +369,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns(
t.pEnv->DeleteLocalRef((jstring)args[2].l);
if(columnNamePattern.getLength())
t.pEnv->DeleteLocalRef((jstring)args[3].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -378,19 +383,20 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv )
{
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getProcedures";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -398,6 +404,8 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(procedureNamePattern.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -410,19 +418,20 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getVersionColumns";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -430,6 +439,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -673,19 +683,20 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getExportedKeys";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -693,6 +704,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -705,19 +717,20 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getImportedKeys";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -725,6 +738,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -737,19 +751,20 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getPrimaryKeys";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -757,6 +772,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -770,21 +786,22 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[5];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
args[3].z = unique;
args[4].z = approximate;
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;";
char * cMethodName = "getIndexInfo";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[5];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
args[3].z = unique;
args[4].z = approximate;
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z );
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -792,6 +809,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -805,20 +823,19 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getBestRowIdentifier";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema);
args[2].l = convertwchar_tToJavaString(t.pEnv,table);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -826,6 +843,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(table.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -838,11 +856,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
@ -850,8 +864,13 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[3];
// Parameter konvertieren
args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0;
args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern);
args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -859,6 +878,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
t.pEnv->DeleteLocalRef((jstring)args[1].l);
if(tableNamePattern.getLength())
t.pEnv->DeleteLocalRef((jstring)args[2].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -873,22 +893,23 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference(
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[6];
// Parameter konvertieren
args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0;
args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema);
args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable);
args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0;
args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema);
args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
char * cMethodName = "getCrossReference";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[6];
// Parameter konvertieren
args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0;
args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema);
args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable);
args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(foreignCatalog)) : 0;
args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema);
args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable);
out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l );
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
if(primaryCatalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
@ -902,6 +923,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference(
t.pEnv->DeleteLocalRef((jstring)args[4].l);
if(foreignTable.getLength())
t.pEnv->DeleteLocalRef((jstring)args[5].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -3246,7 +3268,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
args[3].l = pArray;
out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l);
ThrowSQLException(t.pEnv,*this);
if(catalog.hasValue())
t.pEnv->DeleteLocalRef((jstring)args[0].l);
if(schemaPattern.getLength())
@ -3255,6 +3277,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
t.pEnv->DeleteLocalRef((jstring)args[2].l);
if(args[3].l)
t.pEnv->DeleteLocalRef((jintArray)args[3].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
@ -3263,22 +3286,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
// -------------------------------------------------------------------------
Reference< XConnection > SAL_CALL java_sql_DatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
{
// jobject out(0);
// SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
// if( t.pEnv ){
// char * cSignature = "()Ljava/sql/Connection;";
// char * cMethodName = "getConnection";
// // Java-Call absetzen
// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
// if( mID )
// {
// out = t.pEnv->CallObjectMethod( object, mID);
// ThrowSQLException(t.pEnv,*this);
// } //mID
// } //t.pEnv
// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
// return out ? new java_sql_Connection( t.pEnv, out,this ) : 0;
return (Reference< XConnection >)m_pConnection;
return (Reference< XConnection >)m_pConnection;
}
// -------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: PreparedStatement.cxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: oj $ $Date: 2001-05-31 08:29:15 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -82,6 +82,12 @@
#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
#endif
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include "connectivity/dbtools.hxx"
#endif
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include "connectivity/dbexception.hxx"
#endif
using namespace connectivity;
using namespace ::com::sun::star::uno;
@ -134,6 +140,7 @@ void java_sql_PreparedStatement::saveClassRef( jclass pClass )
aRet = ::cppu::queryInterface( rType,
static_cast< XPreparedStatement*>(this),
static_cast< XParameters*>(this),
static_cast< XResultSetMetaDataSupplier*>(this),
static_cast< XPreparedBatchExecution*>(this));
return aRet;
}
@ -193,20 +200,20 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = parameterIndex;
args[1].l = convertwchar_tToJavaString(t.pEnv,x);
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/String;)V";
char * cMethodName = "setString";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = parameterIndex;
args[1].l = convertwchar_tToJavaString(t.pEnv,x);
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
t.pEnv->DeleteLocalRef((jstring)args[1].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
}
@ -214,22 +221,6 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
// jobject out(0);
// SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
// if( t.pEnv ){
//
// // temporaere Variable initialisieren
// char * cSignature = "()Ljava/sql/Connection;";
// char * cMethodName = "getConnection";
// // Java-Call absetzen
// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
// if( mID ){
// out = t.pEnv->CallObjectMethod( object, mID);
// ThrowSQLException(t.pEnv,*this);
// } //mID
// } //t.pEnv
// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
// return out==0 ? 0 : new java_sql_Connection( t.pEnv, out );
return (Reference< XConnection >)m_pConnection;
}
// -------------------------------------------------------------------------
@ -259,17 +250,13 @@ void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex,
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].z = x;
// temporaere Variable initialisieren
char * cSignature = "(IZ)V";
char * cMethodName = "setBoolean";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].z);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -281,17 +268,13 @@ void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].b = x;
// temporaere Variable initialisieren
char * cSignature = "(IB)V";
char * cMethodName = "setByte";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].b);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -303,17 +286,18 @@ void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, con
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = parameterIndex;
java_sql_Date aT(x);
args[1].l = aT.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Date;)V";
char * cMethodName = "setDate";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = parameterIndex;
java_sql_Date aT(x);
args[1].l = aT.getJavaObject();
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -327,17 +311,18 @@ void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, con
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
java_sql_Time aT(x);
args[1].l = aT.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Time;)V";
char * cMethodName = "setTime";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
java_sql_Time aT(x);
args[1].l = aT.getJavaObject();
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -350,17 +335,18 @@ void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
java_sql_Timestamp aT(x);
args[1].l = aT.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Timestamp;)V";
char * cMethodName = "setTimestamp";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
java_sql_Timestamp aT(x);
args[1].l = aT.getJavaObject();
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -368,24 +354,17 @@ void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex
} //t.pEnv
}
// -------------------------------------------------------------------------
void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].d = x;
// temporaere Variable initialisieren
char * cSignature = "(ID)V";
char * cMethodName = "setDouble";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].d);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -397,17 +376,13 @@ void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, fl
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].f = x;
// temporaere Variable initialisieren
char * cSignature = "(IF)V";
char * cMethodName = "setFloat";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].f);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -419,17 +394,13 @@ void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].i = (sal_Int32)x;
// temporaere Variable initialisieren
char * cSignature = "(II)V";
char * cMethodName = "setInt";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -441,17 +412,13 @@ void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].j = x;
// temporaere Variable initialisieren
char * cSignature = "(IJ)V";
char * cMethodName = "setLong";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].j);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -463,17 +430,13 @@ void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].i = (sal_Int32)sqlType;
// temporaere Variable initialisieren
char * cSignature = "(II)V";
char * cMethodName = "setNull";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -485,16 +448,16 @@ void SAL_CALL java_sql_PreparedStatement::setClob( sal_Int32 parameterIndex, con
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Clob;)V";
char * cMethodName = "setClob";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -507,16 +470,16 @@ void SAL_CALL java_sql_PreparedStatement::setBlob( sal_Int32 parameterIndex, con
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Blob;)V";
char * cMethodName = "setBlob";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -529,16 +492,16 @@ void SAL_CALL java_sql_PreparedStatement::setArray( sal_Int32 parameterIndex, co
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Array;)V";
char * cMethodName = "setArray";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -551,16 +514,17 @@ void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 parameterIndex, cons
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Ref;)V";
char * cMethodName = "setRef";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -573,16 +537,17 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/Object;II)V";
char * cMethodName = "setObject";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l,targetSqlType,scale);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
@ -595,17 +560,14 @@ void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterInde
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/Object;)V";
char * cMethodName = "setObject";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,0);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -615,23 +577,13 @@ void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterInde
void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].l = 0;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/Object;)V";
char * cMethodName = "setObject";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
} //t.pEnv
if(!::dbtools::implSetObject(this,parameterIndex,x))
{
::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Unknown type for parameter: ");
sMsg += ::rtl::OUString::valueOf(parameterIndex);
sMsg += ::rtl::OUString::createFromAscii(" !") ;
::dbtools::throwGenericSQLException(sMsg,*this);
}
}
// -------------------------------------------------------------------------
@ -639,17 +591,13 @@ void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sa
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
args[1].s = (sal_Int16)x;
// temporaere Variable initialisieren
char * cSignature = "(IS)V";
char * cMethodName = "setShort";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].s);
t.pEnv->CallVoidMethod( object, mID, parameterIndex,x);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -661,23 +609,24 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength());
t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray());
args[1].l = pByteArray;
// temporaere Variable initialisieren
char * cSignature = "(I[B)V";
char * cMethodName = "setBytes";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[2];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength());
t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray());
args[1].l = pByteArray;
t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l);
t.pEnv->DeleteLocalRef(pByteArray);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
t.pEnv->DeleteLocalRef(pByteArray);
} //t.pEnv
}
// -------------------------------------------------------------------------
@ -687,40 +636,39 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray(length);
Sequence< sal_Int8> aSeq;
x->readBytes(aSeq,length);
t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = (sal_Int32)length;
// temporaere Variable initialisieren
char * cSignatureStream = "([BII)V";
// Java-Call absetzen
jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream");
jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
//
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/io/InputStream;I)V";
char * cMethodName = "setCharacterStream";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,length);
ThrowSQLException(t.pEnv,*this);
{
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray(length);
Sequence< sal_Int8> aSeq;
if(x.is())
x->readBytes(aSeq,length);
t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = (sal_Int32)length;
// temporaere Variable initialisieren
char * cSignatureStream = "([BII)V";
// Java-Call absetzen
jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream");
jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,length);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
t.pEnv->DeleteLocalRef(aClass);
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
t.pEnv->DeleteLocalRef(aClass);
ThrowSQLException(t.pEnv,*this);
}
} //t.pEnv
}
// -------------------------------------------------------------------------
@ -729,41 +677,37 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
{
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray(length);
Sequence< sal_Int8> aSeq;
x->readBytes(aSeq,length);
t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = (sal_Int32)length;
// temporaere Variable initialisieren
char * cSignatureStream = "([BII)V";
// Java-Call absetzen
jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream");
jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
//
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)parameterIndex;
// temporaere Variable initialisieren
char * cSignature = "(ILjava/io/InputStream;I)V";
char * cMethodName = "setBinaryStream";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,(sal_Int32)length);
ThrowSQLException(t.pEnv,*this);
{
jvalue args2[3];
jbyteArray pByteArray = t.pEnv->NewByteArray(length);
Sequence< sal_Int8> aSeq;
x->readBytes(aSeq,length);
t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
args2[2].i = (sal_Int32)length;
// temporaere Variable initialisieren
char * cSignatureStream = "([BII)V";
// Java-Call absetzen
jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream");
jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)length);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
t.pEnv->DeleteLocalRef(aClass);
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
t.pEnv->DeleteLocalRef(aClass);
ThrowSQLException(t.pEnv,*this);
}
} //t.pEnv
}
// -------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: ResultSet.cxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: oj $ $Date: 2001-05-31 08:29:15 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -112,6 +112,12 @@
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include "connectivity/dbtools.hxx"
#endif
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include "connectivity/dbexception.hxx"
#endif
using namespace ::comphelper;
@ -197,19 +203,22 @@ sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& column
jint out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].l = convertwchar_tToJavaString(t.pEnv,columnName);
// temporaere Variable initialisieren
char * cSignature = "(Ljava/lang/String;)I";
char * cMethodName = "findColumn";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
jvalue args[1];
// Parameter konvertieren
args[0].l = convertwchar_tToJavaString(t.pEnv,columnName);
out = t.pEnv->CallIntMethod( object, mID, args[0].l );
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
t.pEnv->DeleteLocalRef((jstring)args[0].l);
ThrowSQLException(t.pEnv,*this);
} //mID
} //t.pEnv
return (sal_Int32)out;
@ -658,16 +667,13 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S
jobject out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)columnIndex;
// temporaere Variable initialisieren
char * cSignature = "(I)Ljava/sql/Timestamp;";
char * cMethodName = "getTimestamp";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallObjectMethod( object, mID, args[0].i);
out = t.pEnv->CallObjectMethod( object, mID, columnIndex);
ThrowSQLException(t.pEnv,*this);
// und aufraeumen
} //mID
@ -891,22 +897,6 @@ sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeEx
// -------------------------------------------------------------------------
Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLException, RuntimeException)
{
// jobject out(0);
// SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
// if( t.pEnv )
// {
// // temporaere Variable initialisieren
// char * cSignature = "()Ljava/sql/Statement;";
// char * cMethodName = "getStatement";
// // Java-Call absetzen
// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
// if( mID ){
// out = t.pEnv->CallObjectMethod( object, mID );
// ThrowSQLException(t.pEnv,*this);
// } //mID
// } //t.pEnv
// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
// return out==0 ? 0 : (::cppu::OWeakObject*)new java_sql_Statement( t.pEnv, out );
return m_aStatement.get();
}
// -------------------------------------------------------------------------
@ -1217,7 +1207,7 @@ void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool
{
// temporaere Variable initialisieren
char * cSignature = "(IZ)V";
char * cMethodName = "updateNull";
char * cMethodName = "updateBoolean";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
@ -1339,18 +1329,20 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r
SDBThreadAttach t;
if( t.pEnv )
{
jvalue args[1];
// Parameter konvertieren
args[0].l = convertwchar_tToJavaString(t.pEnv,x);
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/String)V";
char * cMethodName = "updateString";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
if( mID )
{
jvalue args[1];
// Parameter konvertieren
args[0].l = convertwchar_tToJavaString(t.pEnv,x);
t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l);
ThrowSQLException(t.pEnv,*this);
t.pEnv->DeleteLocalRef((jstring)args[0].l);
ThrowSQLException(t.pEnv,*this);
}
}
}
@ -1361,21 +1353,21 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co
SDBThreadAttach t;
if( t.pEnv )
{
jvalue args[1];
jbyteArray aArray = t.pEnv->NewByteArray(x.getLength());
t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray());
// Parameter konvertieren
args[0].l = aArray;
// temporaere Variable initialisieren
char * cSignature = "(I[B)V";
char * cMethodName = "updateBytes";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
if( mID )
{
jvalue args[1];
jbyteArray aArray = t.pEnv->NewByteArray(x.getLength());
t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray());
// Parameter konvertieren
args[0].l = aArray;
t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l);
ThrowSQLException(t.pEnv,*this);
t.pEnv->DeleteLocalRef((jbyteArray)args[0].l);
ThrowSQLException(t.pEnv,*this);
}
}
}
@ -1386,16 +1378,18 @@ void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com
SDBThreadAttach t;
if( t.pEnv )
{
jvalue args[1];
// Parameter konvertieren
java_sql_Date aD(x);
args[0].l = aD.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Date;)V";
char * cMethodName = "updateDate";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
if( mID )
{
jvalue args[1];
// Parameter konvertieren
java_sql_Date aD(x);
args[0].l = aD.getJavaObject();
t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l);
ThrowSQLException(t.pEnv,*this);
}
@ -1408,16 +1402,17 @@ void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com
SDBThreadAttach t;
if( t.pEnv )
{
jvalue args[1];
// Parameter konvertieren
java_sql_Time aD(x);
args[0].l = aD.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(ILjava/sql/Time;)V";
char * cMethodName = "updateTime";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
if( mID )
{
jvalue args[1];
// Parameter konvertieren
java_sql_Time aD(x);
args[0].l = aD.getJavaObject();
t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l);
ThrowSQLException(t.pEnv,*this);
}
@ -1430,16 +1425,17 @@ void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const
SDBThreadAttach t;
if( t.pEnv )
{
jvalue args[1];
java_sql_Timestamp aD(x);
// Parameter konvertieren
args[0].l = aD.getJavaObject();
// temporaere Variable initialisieren
char * cSignature = "(I;Ljava/sql/Timestamp;)V";
char * cMethodName = "updateTimestamp";
// Java-Call absetzen
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
if( mID )
{
jvalue args[1];
java_sql_Timestamp aD(x);
// Parameter konvertieren
args[0].l = aD.getJavaObject();
t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l);
ThrowSQLException(t.pEnv,*this);
}
@ -1452,6 +1448,7 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con
SDBThreadAttach t;
if( t.pEnv )
{
// TODO
jvalue args[1];
// Parameter konvertieren
args[0].l = 0;
@ -1491,116 +1488,21 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex,
// -------------------------------------------------------------------------
void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
SDBThreadAttach t;
if( t.pEnv )
if(!::dbtools::implUpdateObject(this,columnIndex,x))
{
jvalue args[1];
switch(x.getValueTypeClass())
{
case TypeClass_VOID:
args[0].l = NULL;
break;
case TypeClass_BOOLEAN:
{
sal_Bool f;
x >>= f;
updateBoolean(columnIndex,f);
}
break;
case TypeClass_BYTE:
{
sal_Int8 f;
x >>= f;
updateByte(columnIndex,f);
}
break;
case TypeClass_SHORT:
case TypeClass_UNSIGNED_SHORT:
{
sal_Int16 f;
x >>= f;
updateShort(columnIndex,f);
}
break;
case TypeClass_LONG:
case TypeClass_UNSIGNED_LONG:
{
sal_Int32 f;
x >>= f;
updateInt(columnIndex,f);
}
break;
case TypeClass_HYPER:
case TypeClass_UNSIGNED_HYPER:
{
sal_Int64 f;
x >>= f;
updateLong(columnIndex,f);
}
break;
case TypeClass_FLOAT:
{
float f;
x >>= f;
updateFloat(columnIndex,f);
}
break;
case TypeClass_DOUBLE:
updateDouble(columnIndex,comphelper::getDouble(x));
break;
case TypeClass_CHAR:
case TypeClass_STRING:
updateString(columnIndex,comphelper::getString(x));
break;
case TypeClass_ENUM:
default:
OSL_ENSURE(0,"UNKOWN TYPE for java_sql_ResultSet::updateObject");
}
return;
// Parameter konvertieren
// temporaere Variable initialisieren
char * cSignature = "(ILjava/lang/Object;)V";
char * cMethodName = "updateObject";
// Java-Call absetzen
// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
// if( mID ){
// t.pEnv->CallVoidMethodA( object, mID,columnIndex,args);
ThrowSQLException(t.pEnv,*this);
// switch(x.getValueTypeClass())
// {
// case TypeClass_CHAR:
// case TypeClass_STRING:
// t.pEnv->DeleteLocalRef((jobject)args[0].l);
// break;
// }
// }
::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Unknown type for column: ");
sMsg += ::rtl::OUString::valueOf(columnIndex);
sMsg += ::rtl::OUString::createFromAscii(" !") ;
::dbtools::throwGenericSQLException(sMsg,*this);
}
}
// -------------------------------------------------------------------------
void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
OSL_ENSURE(0,"java_sql_ResultSet::updateNumericObject: NYI");
// SDBThreadAttach t;
// if( t.pEnv )
// {
// jvalue args[1];
// // Parameter konvertieren
// args[0].l =
// // temporaere Variable initialisieren
// char * cSignature = "(I;Ljava/lang/Object;I)V";
// char * cMethodName = "updateObject";
// // Java-Call absetzen
// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
// if( mID ){
// t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,scale);
// ThrowSQLException(t.pEnv,*this);
// t.pEnv->DeleteLocalRef((jobject)args[0].l);
// }
// }
// OSL_ENSURE(0,"java_sql_ResultSet::updateNumericObject: NYI");
updateObject( columnIndex,x);
}
// -------------------------------------------------------------------------
//------------------------------------------------------------------------------
sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
@ -1614,7 +1516,9 @@ sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallIntMethod( object, mID);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv
return (sal_Int32)out;
@ -1633,7 +1537,9 @@ sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::s
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallIntMethod( object, mID);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv
return (sal_Int32)out;
@ -1651,7 +1557,9 @@ sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallIntMethod( object, mID);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv
return (sal_Int32)out;
@ -1669,7 +1577,9 @@ sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc:
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
out = t.pEnv->CallIntMethod( object, mID);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv
return (sal_Int32)out;
@ -1709,7 +1619,9 @@ void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::st
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID,_par0);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv
@ -1744,7 +1656,9 @@ void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::s
jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID ){
t.pEnv->CallVoidMethod( object, mID,_par0);
ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this);
// special case here most JDBC 1.x doesn't support this feature so we just clear the exception when they occured
if(t.pEnv->ExceptionOccurred())
t.pEnv->ExceptionClear();
} //mID
} //t.pEnv

View file

@ -2,9 +2,9 @@
*
* $RCSfile: ResultSetMetaData.cxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: oj $ $Date: 2001-05-31 08:29:15 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -170,9 +170,6 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column
jboolean out(sal_False);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)column;
// temporaere Variable initialisieren
char * cSignature = "(I)Z";
char * cMethodName = "isCaseSensitive";
@ -393,9 +390,6 @@ sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw
jboolean out(sal_False);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)column;
// temporaere Variable initialisieren
char * cSignature = "(I)Z";
char * cMethodName = "isSigned";
@ -414,9 +408,6 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column )
jint out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)column;
// temporaere Variable initialisieren
char * cSignature = "(I)I";
char * cMethodName = "getPrecision";
@ -436,9 +427,6 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) thro
jint out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)column;
// temporaere Variable initialisieren
char * cSignature = "(I)I";
char * cMethodName = "getScale";
@ -458,9 +446,6 @@ sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) th
jint out(0);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment gelöscht worden!");
if( t.pEnv ){
jvalue args[1];
// Parameter konvertieren
args[0].i = (sal_Int32)column;
// temporaere Variable initialisieren
char * cSignature = "(I)I";
char * cMethodName = "isNullable";

View file

@ -2,9 +2,9 @@
*
* $RCSfile: FConnection.hxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: oj $ $Date: 2001-06-28 12:22:36 $
* last change: $Author: oj $ $Date: 2001-07-04 10:54:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -142,6 +142,7 @@ namespace connectivity
sal_Bool m_bShowDeleted;
void throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage);
public:
OConnection(OFileDriver* _pDriver);