summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
commita6f52ce1a54abd7e8a135eaddf9baea1c5fdad9c (patch)
tree2d0ca2c923577ad07d580a4a6dd042d6c6ea25ca /connectivity
parenta4ec688d4933aac44011ce7ccb3184b9d9ca6c91 (diff)
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk1
-rw-r--r--connectivity/inc/connectivity/dbexception.hxx35
-rw-r--r--connectivity/inc/connectivity/standardsqlstate.hxx76
-rw-r--r--connectivity/qa/connectivity/tools/HsqlDatabase.java46
-rw-r--r--connectivity/qa/connectivity/tools/makefile.mk2
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx31
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx100
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx2
-rw-r--r--connectivity/source/inc/odbc/OBoundParam.hxx29
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx2
14 files changed, 160 insertions, 172 deletions
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk b/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
index b3d55f8e5c..3977a4869e 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
@@ -43,6 +43,7 @@ SECONDARY_PACKAGE = org$/hsqldb$/lib
.IF "$(SYSTEM_HSQLDB)" == "YES"
XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(HSQLDB_JAR)
+JARFILES+= $(HSQLDB_JAR)
.ELSE
JARFILES+= hsqldb.jar
.ENDIF
diff --git a/connectivity/inc/connectivity/dbexception.hxx b/connectivity/inc/connectivity/dbexception.hxx
index aba60111cc..ded1030be5 100644
--- a/connectivity/inc/connectivity/dbexception.hxx
+++ b/connectivity/inc/connectivity/dbexception.hxx
@@ -32,6 +32,7 @@
#define _DBHELPER_DBEXCEPTION_HXX_
#include <com/sun/star/sdbc/SQLException.hpp>
+#include "connectivity/standardsqlstate.hxx"
namespace com
{
@@ -56,40 +57,6 @@ namespace dbtools
{
//.........................................................................
-//----------------------------------------------------------------------------------
-/** standard SQLStates to be used with an SQLException
-
- Extend this list whenever you need a new state ...
-
- @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
-*/
-enum StandardSQLState
-{
- SQL_WRONG_PARAMETER_NUMBER, // 07001
- SQL_INVALID_DESCRIPTOR_INDEX, // 07009
- SQL_UNABLE_TO_CONNECT, // 08001
- SQL_NUMERIC_OUT_OF_RANGE, // 22003
- SQL_INVALID_DATE_TIME, // 22007
- SQL_INVALID_CURSOR_STATE, // 24000
- SQL_TABLE_OR_VIEW_EXISTS, // 42S01
- SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
- SQL_INDEX_ESISTS, // 42S11
- SQL_INDEX_NOT_FOUND, // 42S12
- SQL_COLUMN_EXISTS, // 42S21
- SQL_COLUMN_NOT_FOUND, // 42S22
- SQL_GENERAL_ERROR, // HY000
- SQL_INVALID_SQL_DATA_TYPE, // HY004
- SQL_OPERATION_CANCELED, // HY008
- SQL_FUNCTION_SEQUENCE_ERROR, // HY010
- SQL_INVALID_CURSOR_POSITION, // HY109
- SQL_INVALID_BOOKMARK_VALUE, // HY111
- SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
- SQL_FUNCTION_NOT_SUPPORTED, // IM001
- SQL_CONNECTION_DOES_NOT_EXIST, // 08003
-
- SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
-};
-
//==============================================================================
//= Special exception if cancel is pressed in DBA UI
//==============================================================================
diff --git a/connectivity/inc/connectivity/standardsqlstate.hxx b/connectivity/inc/connectivity/standardsqlstate.hxx
new file mode 100644
index 0000000000..b9c9d549d0
--- /dev/null
+++ b/connectivity/inc/connectivity/standardsqlstate.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: standardsqlstate.hxx,v $
+*
+* $Revision: 1.1.2.1 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_STANDARD_SQL_STATE_HXX
+#define CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //----------------------------------------------------------------------------------
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum StandardSQLState
+ {
+ SQL_WRONG_PARAMETER_NUMBER, // 07001
+ SQL_INVALID_DESCRIPTOR_INDEX, // 07009
+ SQL_UNABLE_TO_CONNECT, // 08001
+ SQL_NUMERIC_OUT_OF_RANGE, // 22003
+ SQL_INVALID_DATE_TIME, // 22007
+ SQL_INVALID_CURSOR_STATE, // 24000
+ SQL_TABLE_OR_VIEW_EXISTS, // 42S01
+ SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
+ SQL_INDEX_ESISTS, // 42S11
+ SQL_INDEX_NOT_FOUND, // 42S12
+ SQL_COLUMN_EXISTS, // 42S21
+ SQL_COLUMN_NOT_FOUND, // 42S22
+ SQL_GENERAL_ERROR, // HY000
+ SQL_INVALID_SQL_DATA_TYPE, // HY004
+ SQL_OPERATION_CANCELED, // HY008
+ SQL_FUNCTION_SEQUENCE_ERROR, // HY010
+ SQL_INVALID_CURSOR_POSITION, // HY109
+ SQL_INVALID_BOOKMARK_VALUE, // HY111
+ SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
+ SQL_FUNCTION_NOT_SUPPORTED, // IM001
+ SQL_CONNECTION_DOES_NOT_EXIST, // 08003
+
+ SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_STANDARD_SQL_STATE_HXX
diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java
index 113f3ee479..36e507c0ff 100644
--- a/connectivity/qa/connectivity/tools/HsqlDatabase.java
+++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java
@@ -33,6 +33,7 @@ package connectivity.tools;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.ElementExistException;
+import com.sun.star.container.XNameAccess;
import com.sun.star.frame.XStorable;
import com.sun.star.frame.XModel;
import com.sun.star.lang.XMultiServiceFactory;
@@ -45,12 +46,15 @@ import com.sun.star.sdbcx.XAppend;
import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.io.IOException;
+import com.sun.star.sdb.XDocumentDataSource;
import java.io.File;
import com.sun.star.util.CloseVetoException;
+import helper.URLHelper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
+import java.io.File;
/**
*
@@ -69,29 +73,51 @@ public class HsqlDatabase
// the default connection
XConnection m_connection;
- /** Creates a new instance of HsqlDatabase */
+ // --------------------------------------------------------------------------------------------------------
public HsqlDatabase( XMultiServiceFactory orb ) throws Exception
{
m_orb = orb;
createDBDocument();
}
+ // --------------------------------------------------------------------------------------------------------
+ public HsqlDatabase( XMultiServiceFactory orb, String _existingDocumentURL ) throws Exception
+ {
+ m_orb = orb;
+ createDBDocument( _existingDocumentURL );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private void createDBDocument( String _docURL ) throws Exception
+ {
+ m_databaseDocumentFile = _docURL;
+
+ XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
+ m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
+ XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( XDocumentDataSource.class,
+ dbContext.getByName( _docURL ) );
+
+ m_databaseDocument = dataSource.getDatabaseDocument();
+ m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+ }
+
+ /** creates an empty database document in a temporary location
+ */
private void createDBDocument() throws Exception
{
- m_databaseDocumentFile = new String();
- String str = File.createTempFile("testdb",".odb").getCanonicalPath();
- str = str.replaceAll(" ","%20");
- str = "file:///" +str;
- m_databaseDocumentFile = str.replace('\\','/');
+ File documentFile = File.createTempFile("testdb",".odb");
+ documentFile.deleteOnExit();
+ m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath( documentFile );
m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
XOfficeDatabaseDocument.class, m_orb.createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+
XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_databaseDocument.getDataSource() );
dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
XStorable storable = (XStorable)UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
- storable.storeAsURL(m_databaseDocumentFile,new PropertyValue[]{});
+ storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} );
}
/** returns a connection to the database
@@ -151,8 +177,8 @@ public class HsqlDatabase
m_connection = null;
// close document
- com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- m_databaseDocument );
+ com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
+ com.sun.star.util.XCloseable.class, m_databaseDocument );
if ( closeDoc != null )
{
try
@@ -188,7 +214,7 @@ public class HsqlDatabase
/** returns the underlying database document
*/
- XOfficeDatabaseDocument getDatabaseDocument()
+ public XOfficeDatabaseDocument getDatabaseDocument()
{
return m_databaseDocument;
}
diff --git a/connectivity/qa/connectivity/tools/makefile.mk b/connectivity/qa/connectivity/tools/makefile.mk
index 499db941f8..c85d5ddd54 100644
--- a/connectivity/qa/connectivity/tools/makefile.mk
+++ b/connectivity/qa/connectivity/tools/makefile.mk
@@ -44,7 +44,7 @@ all:
#----- compile .java files -----------------------------------------
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunnerLight.jar
# Do not use $/ with the $(FIND) command as for W32-4nt this leads to a backslash
# in a posix command. In this special case use / instead of $/
.IF "$(GUI)"=="OS2"
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index d3ce4a66c4..8e23afca81 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -142,7 +142,7 @@ namespace
if ( bCanAccess )
{
- // here we have two contents which's URLs differ by case only.
+ // here we have two contents whose URLs differ by case only.
// Now let's check if both really refer to the same object ....
Reference< XContent > xContent1 = aContent1.get();
Reference< XContent > xContent2 = aContent2.get();
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 911ad684c9..f1cf7408fe 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -366,7 +366,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
setParameter(parameterIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index aad78bf644..531e02fb1b 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -778,7 +778,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateValue(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 5dfa4c4f6e..d4f6ce4405 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -650,15 +650,17 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
+ Sequence< sal_Int8 > aSeq;
+ if ( x.is() )
+ x->readBytes( aSeq, length );
+ sal_Int32 actualLength = aSeq.getLength();
+
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());
+ jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength );
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
- args2[2].i = (sal_Int32)length;
+ args2[2].i = actualLength;
// temporaere Variable initialisieren
const char * cSignatureStream = "([BII)V";
// Java-Call absetzen
@@ -670,7 +672,7 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,length);
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
@@ -698,14 +700,17 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
+ Sequence< sal_Int8 > aSeq;
+ if ( x.is() )
+ x->readBytes( aSeq, length );
+ sal_Int32 actualLength = aSeq.getLength();
+
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());
+ jbyteArray pByteArray = t.pEnv->NewByteArray(actualLength);
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
- args2[2].i = (sal_Int32)length;
+ args2[2].i = (sal_Int32)actualLength;
// temporaere Variable initialisieren
const char * cSignatureStream = "([BII)V";
@@ -717,7 +722,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)length);
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
index f64e143dd7..d2dfb88ba5 100644
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ b/connectivity/source/drivers/mozab/MResultSet.cxx
@@ -1792,7 +1792,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateValue(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index 2093e65532..ed6b881212 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -62,10 +62,6 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-int OBoundParam::ASCII = 1;
-int OBoundParam::UNICODE = 2;
-int OBoundParam::BINARY = 3;
-
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement");
@@ -201,7 +197,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
// If the parameter index is -1, there is no
// more data required
- if (*paramIndex == -1)
+ if ( !paramIndex || ( *paramIndex == -1 ) )
needData = sal_False;
else
{
@@ -580,13 +576,13 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARCHAR,OBoundParam::ASCII);
+ setStream (parameterIndex, x, length, DataType::LONGVARCHAR);
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARBINARY,OBoundParam::BINARY);
+ setStream (parameterIndex, x, length, DataType::LONGVARBINARY);
}
// -------------------------------------------------------------------------
@@ -759,13 +755,8 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
return;
}
- // We'll transfer up to maxLen at a time
- sal_Int32 maxLen = MAX_PUT_DATA_LENGTH;
- sal_Int32 bufLen;
- sal_Int32 realLen;
- // sal_Int8* buf = new sal_Int8[maxLen];
- Sequence< sal_Int8 > buf(maxLen);
- sal_Bool endOfStream = sal_False;
+ // We'll transfer up to MAX_PUT_DATA_LENGTH at a time
+ Sequence< sal_Int8 > buf( MAX_PUT_DATA_LENGTH );
// Get the information about the input stream
@@ -776,78 +767,35 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
const ::rtl::OUString sError( aResources.getResourceString(STR_NO_INPUTSTREAM));
throw SQLException (sError, *this,::rtl::OUString(),0,Any());
}
- sal_Int32 inputStreamLen = boundParams[index - 1].getInputStreamLen ();
- sal_Int32 inputStreamType = boundParams[index - 1].getStreamType ();
+
+ sal_Int32 maxBytesLeft = boundParams[index - 1].getInputStreamLen ();
// Loop while more data from the input stream
+ sal_Int32 haveRead = 0;
try
{
- while (!endOfStream)
+ do
{
+ sal_Int32 toReadThisRound = ::std::min( MAX_PUT_DATA_LENGTH, maxBytesLeft );
// Read some data from the input stream
- bufLen = inputStream->readBytes(buf,maxLen);
+ haveRead = inputStream->readBytes( buf, toReadThisRound );
+ OSL_ENSURE( haveRead == buf.getLength(), "OPreparedStatement::putParamData: inconsistency!" );
- // -1 as the number of bytes read indicates that
- // there is no more data in the input stream
-
- if (bufLen == -1)
- {
-
- // Sanity check to ensure that all the data we said we
- // had was read. If not, raise an exception
-
- if (inputStreamLen != 0)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_INPUTSTREAM_WRONG_LEN));
- throw SQLException (sError, *this,::rtl::OUString(),0,Any());
- }
- endOfStream = sal_True;
+ if ( !haveRead )
+ // no more data in the stream - the given stream length was a maximum which could not be
+ // fulfilled by the stream
break;
- }
-
- // If we got more bytes than necessary, truncate
- // the buffer by re-setting the buffer length. Also,
- // indicate that we don't need to read any more.
-
- if (bufLen > inputStreamLen)
- {
- bufLen = inputStreamLen;
- endOfStream = sal_True;
- }
-
- realLen = bufLen;
-
- // For UNICODE streams, strip off the high sal_Int8 and set the
- // number of actual bytes present. It is assumed that
- // there are 2 bytes present for every UNICODE character - if
- // not, then that's not our problem
-
- if (inputStreamType == OBoundParam::UNICODE)
- {
- realLen = bufLen / 2;
-
- for (sal_Int32 ii = 0; ii < realLen; ii++)
- buf[ii] = buf[(ii * 2) + 1];
- }
// Put the data
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-
- N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen);
-
- // Decrement the number of bytes still needed
+ OSL_ENSURE( m_aStatementHandle, "OPreparedStatement::putParamData: StatementHandle is null!" );
+ N3SQLPutData ( m_aStatementHandle, buf.getArray(), buf.getLength() );
- inputStreamLen -= bufLen;
-
-
- // If there is no more data to be read, exit loop
-
- if (inputStreamLen == 0)
- endOfStream = sal_True;
+ // decrement the number of bytes still needed
+ maxBytesLeft -= haveRead;
}
+ while ( maxBytesLeft > 0 );
}
catch (const IOException& ex)
{
@@ -891,8 +839,7 @@ void OPreparedStatement::setStream (
sal_Int32 ParameterIndex,
const Reference< XInputStream>& x,
sal_Int32 length,
- sal_Int32 SQLtype,
- sal_Int32 streamType)
+ sal_Int32 SQLtype)
throw(SQLException)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -935,12 +882,7 @@ void OPreparedStatement::setStream (
(SDWORD*)lenBuf);
// Save the input stream
-
boundParams[ParameterIndex - 1].setInputStream (x, length);
-
- // Set the stream type
-
- boundParams[ParameterIndex - 1].setStreamType (streamType);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index eb5ab9f3d7..b5f0e5ace1 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -1097,7 +1097,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateBytes(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
index a3a81ec29d..7a4a6799fe 100644
--- a/connectivity/source/inc/odbc/OBoundParam.hxx
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -157,26 +157,6 @@ namespace connectivity
}
//--------------------------------------------------------------------
- // setStreamType
- // Sets the input stream type used to register an OUT parameter
- //--------------------------------------------------------------------
-
- void setStreamType (sal_Int32 type)
- {
- streamType = type;
- }
-
- //--------------------------------------------------------------------
- // getStreamType
- // Gets the input stream type used to register an OUT parameter
- //--------------------------------------------------------------------
-
- sal_Int32 getStreamType ()
- {
- return streamType;
- }
-
- //--------------------------------------------------------------------
// setOutputParameter
// Sets the flag indicating if this is an OUTPUT parameter
//--------------------------------------------------------------------
@@ -220,10 +200,6 @@ namespace connectivity
sal_Int32 sqlType; // Java SQL type used to
// register an OUT parameter
- sal_Int32 streamType; // Input stream type
- // (ASCII, BINARY, UNICODE)
-
-
sal_Bool outputParameter; // true for OUTPUT parameters
@@ -235,11 +211,6 @@ namespace connectivity
sal_Int32 pC2;
sal_Int32 pS1;
sal_Int32 pS2;// reserved for strings(UTFChars)
-
- public:
- static int ASCII;
- static int UNICODE;
- static int BINARY;
};
}
}
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
index 863b07f294..8a5bf3a4b6 100644
--- a/connectivity/source/inc/odbc/OPreparedStatement.hxx
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -92,7 +92,7 @@ namespace connectivity
void FreeParams();
void putParamData (sal_Int32 index) throw(::com::sun::star::sdbc::SQLException);
void setStream (sal_Int32 ParameterIndex,const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x,
- sal_Int32 length,sal_Int32 SQLtype,sal_Int32 streamType) throw(::com::sun::star::sdbc::SQLException);
+ sal_Int32 length,sal_Int32 SQLtype) throw(::com::sun::star::sdbc::SQLException);
sal_Int32 getParamLength ( sal_Int32 index);
sal_Int8* getLengthBuf (sal_Int32 index);
sal_Int8* getDataBuf (sal_Int32 index);