[176396] ODA 3.2 API Changes Implementation and others (see http://wiki.eclipse.org/Galileo_DTP_ODA_API_Changes_Spec)
diff --git a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/META-INF/MANIFEST.MF b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/META-INF/MANIFEST.MF
index d49d2c9..4124bd3 100644
--- a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/META-INF/MANIFEST.MF
@@ -11,6 +11,6 @@
Export-Package: org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample,
org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample.impl
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.datatools.connectivity.oda;bundle-version="[3.1.0,4.0.0)",
- org.eclipse.datatools.connectivity.oda.profile;bundle-version="[3.0.4,4.0.0)"
+ org.eclipse.datatools.connectivity.oda;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.datatools.connectivity.oda.profile;bundle-version="[3.0.7,4.0.0)"
Eclipse-LazyStart: true
diff --git a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Connection.java b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Connection.java
index bc7bfb3..76d678c 100644
--- a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Connection.java
+++ b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Connection.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2008 Actuate Corporation.
+ * Copyright (c) 2008, 2009 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,6 +20,8 @@
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
+import com.ibm.icu.util.ULocale;
+
/**
* Implementation class of IConnection for an ODA runtime driver.
*/
@@ -105,5 +107,13 @@
{
// do nothing; assumes no transaction support needed
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IConnection#setLocale(com.ibm.icu.util.ULocale)
+ */
+ public void setLocale( ULocale locale ) throws OdaException
+ {
+ // do nothing; assumes no locale support
+ }
}
diff --git a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Query.java b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Query.java
index 6575e1f..f5c3ba5 100644
--- a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Query.java
+++ b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/Query.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2008 Actuate Corporation.
+ * Copyright (c) 2008, 2009 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,6 +24,7 @@
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
+import org.eclipse.datatools.connectivity.oda.spec.QuerySpecification;
/**
* Implementation class of IQuery for an ODA runtime driver.
@@ -37,6 +38,7 @@
public class Query implements IQuery
{
private int m_maxRows;
+ private String m_preparedText;
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#prepare(java.lang.String)
@@ -44,6 +46,7 @@
public void prepare( String queryText ) throws OdaException
{
// TODO Auto-generated method stub
+ m_preparedText = queryText;
}
/*
@@ -60,6 +63,7 @@
public void close() throws OdaException
{
// TODO Auto-generated method stub
+ m_preparedText = null;
}
/*
@@ -266,8 +270,27 @@
// TODO Auto-generated method stub
// only applies to input parameter
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setObject(java.lang.String, java.lang.Object)
+ */
+ public void setObject( String parameterName, Object value )
+ throws OdaException
+ {
+ // TODO Auto-generated method stub
+ // only applies to named input parameter
+ }
/* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setObject(int, java.lang.Object)
+ */
+ public void setObject( int parameterId, Object value ) throws OdaException
+ {
+ // TODO Auto-generated method stub
+ // only applies to input parameter
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setNull(java.lang.String)
*/
public void setNull( String parameterName ) throws OdaException
@@ -312,7 +335,6 @@
*/
public void setSortSpec( SortSpec sortBy ) throws OdaException
{
- // TODO Auto-generated method stub
// only applies to sorting, assumes not supported
throw new UnsupportedOperationException();
}
@@ -322,9 +344,47 @@
*/
public SortSpec getSortSpec() throws OdaException
{
- // TODO Auto-generated method stub
// only applies to sorting
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setSpecification(org.eclipse.datatools.connectivity.oda.spec.QuerySpecification)
+ */
+ @SuppressWarnings("restriction")
+ public void setSpecification( QuerySpecification querySpec )
+ throws OdaException, UnsupportedOperationException
+ {
+ // assumes no support
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#getSpecification()
+ */
+ @SuppressWarnings("restriction")
+ public QuerySpecification getSpecification()
+ {
+ // assumes no support
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#getEffectiveQueryText()
+ */
+ public String getEffectiveQueryText()
+ {
+ // TODO Auto-generated method stub
+ return m_preparedText;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#cancel()
+ */
+ public void cancel() throws OdaException, UnsupportedOperationException
+ {
+ // assumes unable to cancel while executing a query
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/ResultSet.java b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/ResultSet.java
index 353b49b..9ce9702 100644
--- a/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/ResultSet.java
+++ b/examples/org.eclipse.datatools.connectivity.oda.jdbc.dbprofile.sample/src/org/eclipse/datatools/connectivity/oda/jdbc/dbprofile/sample/impl/ResultSet.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2008 Actuate Corporation.
+ * Copyright (c) 2008, 2009 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -280,6 +280,23 @@
return getBoolean( findColumn( columnName ) );
}
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IResultSet#getObject(int)
+ */
+ public Object getObject( int index ) throws OdaException
+ {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IResultSet#getObject(java.lang.String)
+ */
+ public Object getObject( String columnName ) throws OdaException
+ {
+ return getObject( findColumn( columnName ) );
+ }
+
/*
* @see org.eclipse.datatools.connectivity.oda.IResultSet#wasNull()
*/
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/plugin.xml b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/plugin.xml
index 413edb5..fa0f6cc 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/plugin.xml
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/plugin.xml
@@ -86,6 +86,7 @@
minArguments="1">
</filterType>
<filterType
+ class="org.eclipse.datatools.connectivity.oda.consumer.testdriver.spec.impl.MyCustomExpression"
displayName="Between"
id="1001"
isNegatable="true"
@@ -147,6 +148,19 @@
</variableClassRestriction>
</variableRestriction>
</filterType>
+ <filterType
+ id="IdentityEq"
+ isNegatable="false"
+ isOptionable="false"
+ maxArguments="1"
+ minArguments="1">
+ <variableRestriction
+ variableType="ResultSetColumn">
+ <variableOdaDataTypeRestriction
+ odaScalarDataType="JavaObject">
+ </variableOdaDataTypeRestriction>
+ </variableRestriction>
+ </filterType>
</filterExpressionTypes>
<aggregateExpressionTypes>
<aggregateType
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestAdvQueryImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestAdvQueryImpl.java
index 861af5e..6de9952 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestAdvQueryImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestAdvQueryImpl.java
@@ -29,6 +29,7 @@
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
+import org.eclipse.datatools.connectivity.oda.spec.QuerySpecification;
/**
* A tester ODA driver to test the behavior of odaconsumer, calling
@@ -48,7 +49,9 @@
private boolean m_wasNull = false;
private static final String TEST_QUERY_PROP_NAME = "TEST_QUERY_PROP_NAME";
private int m_outputParamStartIndex = 0;
-
+ private String m_preparedText;
+ private QuerySpecification m_querySpec;
+
// 0-based result set index.
private int m_curResultSetIndex = -1;
@@ -142,6 +145,7 @@
resetInputParamValuesArray();
m_isPrepareCalled = true;
+ m_preparedText = queryText;
}
private final void resetInputParamValuesArray() throws OdaException
@@ -238,6 +242,7 @@
*/
public void close() throws OdaException
{
+ m_preparedText = null;
m_isOpen = false;
}
@@ -575,6 +580,24 @@
}
/* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getObject(int)
+ */
+ public Object getObject( int parameterId ) throws OdaException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getObject(java.lang.String)
+ */
+ public Object getObject( String parameterName ) throws OdaException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBigDecimal(int)
*/
public BigDecimal getBigDecimal( int parameterId ) throws OdaException
@@ -1017,6 +1040,60 @@
rsInfo.setResultSet( resultSet );
}
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#cancel()
+ */
+ public void cancel() throws OdaException, UnsupportedOperationException
+ {
+ m_preparedText = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#getEffectiveQueryText()
+ */
+ public String getEffectiveQueryText()
+ {
+ if( getSpecification() != null )
+ return m_preparedText + getSpecification();
+ return m_preparedText;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#getSpecification()
+ */
+ @SuppressWarnings("restriction")
+ public QuerySpecification getSpecification()
+ {
+ return m_querySpec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setSpecification(org.eclipse.datatools.connectivity.oda.spec.QuerySpecification)
+ */
+ @SuppressWarnings("restriction")
+ public void setSpecification( QuerySpecification querySpec )
+ throws OdaException, UnsupportedOperationException
+ {
+ m_querySpec = querySpec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setObject(int, java.lang.Object)
+ */
+ public void setObject( int parameterId, Object value ) throws OdaException
+ {
+ setValue( parameterId, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IQuery#setObject(java.lang.String, java.lang.Object)
+ */
+ public void setObject( String parameterName, Object value )
+ throws OdaException
+ {
+ setValue( parameterName, value );
+ }
+
class TestResultSetInfo
{
private String m_name = null;
@@ -1059,6 +1136,5 @@
{
return m_sortSpec;
}
-
}
}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestConnectionImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestConnectionImpl.java
index c213359..d83253b 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestConnectionImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestConnectionImpl.java
@@ -21,6 +21,8 @@
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
+import com.ibm.icu.util.ULocale;
+
/**
* A tester ODA driver to test the behavior of odaconsumer, calling
* on an ODA driver's IConnection implementation.
@@ -122,6 +124,14 @@
return m_appContext;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IConnection#setLocale(com.ibm.icu.util.ULocale)
+ */
+ public void setLocale( ULocale locale ) throws OdaException
+ {
+ throw new UnsupportedOperationException();
+ }
+
void setLimitRows()
{
m_limitRowsCurrentState = true;
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestData.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestData.java
index 5233738..b12a7bf 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestData.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestData.java
@@ -111,6 +111,11 @@
return new Date( DATE_DATA );
}
+ public static final Object createObjectData()
+ {
+ return new String( "testObject" ); //$NON-NLS-1$
+ }
+
public static final IParameterRowSet createStructData() throws OdaException
{
return new TestOutputParamRowSetImpl();
@@ -243,4 +248,5 @@
}
}
}
+
}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestInputParamRowSetImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestInputParamRowSetImpl.java
index 9f08cdf..fbc7e16 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestInputParamRowSetImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestInputParamRowSetImpl.java
@@ -88,7 +88,24 @@
setValue( columnName, new Integer( value ) );
}
- public void setString( int columnIndex, String value ) throws OdaException
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IParameterRowSet#setObject(int, java.lang.Object)
+ */
+ public void setObject( int columnIndex, Object value ) throws OdaException
+ {
+ setValue( columnIndex, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IParameterRowSet#setObject(java.lang.String, java.lang.Object)
+ */
+ public void setObject( String columnName, Object value )
+ throws OdaException
+ {
+ setValue( columnName, value );
+ }
+
+ public void setString( int columnIndex, String value ) throws OdaException
{
setValue( columnIndex, value );
}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamMetaDataImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamMetaDataImpl.java
index d8360df..1a0befe 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamMetaDataImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamMetaDataImpl.java
@@ -29,6 +29,7 @@
public final static int QUERY_TYPE_ADVANCED = 2;
public final static int NATIVETYPE_TABLE_CODE = Types.OTHER;
+ @SuppressWarnings("unchecked")
public TestParamMetaDataImpl( int queryType )
{
m_params = new ArrayList();
@@ -63,6 +64,8 @@
IParameterMetaData.parameterModeIn, IParameterMetaData.parameterNullableUnknown ) );
m_params.add( new TestParameterMetaData( "BooleanParamIn", Types.BOOLEAN, "BOOLEAN", -1, -1,
IParameterMetaData.parameterModeIn, IParameterMetaData.parameterNullableUnknown ) );
+ m_params.add( new TestParameterMetaData( "ObjectParamIn", Types.JAVA_OBJECT, "JAVAOBJECT", -1, -1,
+ IParameterMetaData.parameterModeIn, IParameterMetaData.parameterNullable ) );
}
else if ( queryType == QUERY_TYPE_ADVANCED )
{
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamRowSetImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamRowSetImpl.java
index 1237489..35272a8 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamRowSetImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestParamRowSetImpl.java
@@ -163,7 +163,24 @@
throw new UnsupportedOperationException();
}
- public void setString( int columnIndex, String value ) throws OdaException
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IParameterRowSet#setObject(int, java.lang.Object)
+ */
+ public void setObject( int columnIndex, Object value ) throws OdaException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IParameterRowSet#setObject(java.lang.String, java.lang.Object)
+ */
+ public void setObject( String columnName, Object value )
+ throws OdaException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setString( int columnIndex, String value ) throws OdaException
{
throw new UnsupportedOperationException();
}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetImpl.java
index b21f7b9..1561a39 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetImpl.java
@@ -188,7 +188,26 @@
return m_currentRow;
}
- public String getString(int index) throws OdaException
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IResultSet#getObject(int)
+ */
+ public Object getObject( int index ) throws OdaException
+ {
+ checkColumnIndex( index );
+ m_wasNull = false;
+ return TestData.createObjectData();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.datatools.connectivity.oda.IResultSet#getObject(java.lang.String)
+ */
+ public Object getObject( String columnName ) throws OdaException
+ {
+ int index = findColumn( columnName );
+ return getObject( index );
+ }
+
+ public String getString(int index) throws OdaException
{
checkColumnIndex( index );
m_wasNull = false;
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetMetaDataImpl.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetMetaDataImpl.java
index 0ea4d29..7430c58 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetMetaDataImpl.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/TestResultSetMetaDataImpl.java
@@ -79,7 +79,8 @@
return getCol( index ).isNullable();
}
- private void init( boolean includeLOBs )
+ @SuppressWarnings("unchecked")
+ private void init( boolean includeLOBs )
{
m_columns = new ArrayList();
@@ -112,6 +113,8 @@
TestColumnMetaData( 17, "TimestampLabel", "TimestampCol", 93, "TIMESTAMP", -1, -1, columnNoNulls ) );
m_columns.add( new
TestColumnMetaData( 5, "BooleanLabel", "BooleanCol", Types.BOOLEAN, "BOOLEAN", -1, -1, columnNoNulls ) );
+ m_columns.add( new
+ TestColumnMetaData( 100, "ObjectLabel", "ObjectCol", Types.JAVA_OBJECT, "JAVAOBJECT", -1, -1, columnNullable ) );
}
private TestColumnMetaData getCol( int index ) throws OdaException
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/spec/impl/MyCustomExpression.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/spec/impl/MyCustomExpression.java
new file mode 100644
index 0000000..f204fd0
--- /dev/null
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.testdriver/src/org/eclipse/datatools/connectivity/oda/consumer/testdriver/spec/impl/MyCustomExpression.java
@@ -0,0 +1,43 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2009 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Actuate Corporation - initial API and implementation
+ *
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.testdriver.spec.impl;
+
+import org.eclipse.datatools.connectivity.oda.spec.ExpressionArguments;
+import org.eclipse.datatools.connectivity.oda.spec.ExpressionVariable;
+import org.eclipse.datatools.connectivity.oda.spec.result.filter.CustomExpression;
+
+@SuppressWarnings("restriction")
+public class MyCustomExpression extends CustomExpression
+{
+
+ public MyCustomExpression( String extensionId, String id )
+ {
+ super( extensionId, id );
+ // TODO Auto-generated constructor stub
+ }
+
+ public MyCustomExpression( String extensionId, String id,
+ ExpressionVariable variable, ExpressionArguments args )
+ {
+ super( extensionId, id, variable, args );
+ // TODO Auto-generated constructor stub
+ }
+
+ public MyCustomExpression()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/META-INF/MANIFEST.MF
index cf02bf0..36edffd 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/META-INF/MANIFEST.MF
@@ -5,9 +5,9 @@
Bundle-Version: 3.1.3.qualifier
Bundle-Vendor: Eclipse.org
Require-Bundle: org.junit;bundle-version="[3.8.1,4.0.0)",
- org.eclipse.datatools.connectivity.oda.consumer;bundle-version="[3.1.3,4.0.0)",
+ org.eclipse.datatools.connectivity.oda.consumer;bundle-version="[3.2.0,4.0.0)",
org.eclipse.datatools.connectivity.oda.flatfile;bundle-version="[3.0.2,4.0.0)";resolution:=optional,
org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.datatools.connectivity.oda.consumer.testdriver;bundle-version="[3.1.0,4.0.0)"
+ org.eclipse.datatools.connectivity.oda.consumer.testdriver;bundle-version="[3.2.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.datatools.connectivity.oda.consumer.test.impl.OdaConsumerTestPlugin
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/BinaryCompatibiltyTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/BinaryCompatibiltyTest.java
new file mode 100644
index 0000000..94600cb
--- /dev/null
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/BinaryCompatibiltyTest.java
@@ -0,0 +1,59 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2009 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Actuate Corporation - initial API and implementation
+ *
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.tests;
+
+import java.util.Properties;
+
+import org.eclipse.datatools.connectivity.oda.IConnection;
+
+public class BinaryCompatibiltyTest extends OdaTestCase
+{
+ private IConnection m_connection;
+
+ protected void setUp( ) throws Exception
+ {
+ super.setUp( );
+
+ m_connection = getTestDriver().getConnection( null );
+ assertNotNull( m_connection );
+ }
+
+ protected String getTestDriverId()
+ {
+ return "org.eclipse.datatools.connectivity.oda.flatfile";
+ }
+
+ protected void tearDown( ) throws Exception
+ {
+ if ( m_connection.isOpen() )
+ m_connection.close( );
+
+ super.tearDown( );
+ }
+
+ public void testSetLocale() throws Exception
+ {
+ boolean hasException = false;
+ try
+ {
+ m_connection.setLocale( null );
+ }
+ catch( UnsupportedOperationException ex )
+ {
+ hasException = true;
+ }
+ assertTrue( hasException );
+ }
+}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ConnectionTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ConnectionTest.java
index 397d709..894f6f7 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ConnectionTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ConnectionTest.java
@@ -181,6 +181,20 @@
RunQueryAndCheckRowCount( 1 );
}
+ public void testSetLocale() throws Exception
+ {
+ boolean hasException = false;
+ try
+ {
+ m_connection.setLocale( null );
+ }
+ catch( UnsupportedOperationException ex )
+ {
+ hasException = true;
+ }
+ assertTrue( hasException );
+ }
+
private void RunQueryAndCheckRowCount( int count ) throws OdaException
{
IQuery query = m_connection.newQuery( null );
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/OdaTestCase.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/OdaTestCase.java
index 69d49cd..f7cf9ca 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/OdaTestCase.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/OdaTestCase.java
@@ -43,7 +43,7 @@
return new OdaDriver( getTestDriverId() );
}
- static String getTestDriverId()
+ protected String getTestDriverId()
{
return TEST_DRIVER_ID;
}
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ParamMetaDataTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ParamMetaDataTest.java
index 7e405a4..68afcf0 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ParamMetaDataTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ParamMetaDataTest.java
@@ -1,6 +1,6 @@
/*
*************************************************************************
- * Copyright (c) 2004, 2007 Actuate Corporation.
+ * Copyright (c) 2004, 2009 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@
{
prepareComplexQuery();
- assertTrue( m_paramMetaData.getParameterCount() == 8 );
+ assertTrue( m_paramMetaData.getParameterCount() == 9 );
}
public final void testGetParameterName() throws OdaException
@@ -81,6 +81,7 @@
assertTrue( m_paramMetaData.getParameterType( 6 ) == Types.TIME );
assertTrue( m_paramMetaData.getParameterType( 7 ) == Types.TIMESTAMP );
assertTrue( m_paramMetaData.getParameterType( 8 ) == Types.BOOLEAN );
+ assertTrue( m_paramMetaData.getParameterType( 9 ) == Types.JAVA_OBJECT );
prepareAdvancedQuery();
@@ -104,6 +105,7 @@
assertTrue( m_paramMetaData.getParameterTypeName( 6 ).equals( "TIME" ) );
assertTrue( m_paramMetaData.getParameterTypeName( 7 ).equals( "TIMESTAMP" ) );
assertTrue( m_paramMetaData.getParameterTypeName( 8 ).equals( "BOOLEAN" ) );
+ assertTrue( m_paramMetaData.getParameterTypeName( 9 ).equals( "JAVAOBJECT" ) );
prepareAdvancedQuery();
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/QueryTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/QueryTest.java
index c9251cc..8956e95 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/QueryTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/QueryTest.java
@@ -26,6 +26,7 @@
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
import org.eclipse.datatools.connectivity.oda.consumer.testdriver.TestData;
+import org.eclipse.datatools.connectivity.oda.spec.QuerySpecification;
public class QueryTest extends ConnectionTest
{
@@ -241,6 +242,44 @@
assertNotNull( md );
}
+ public void testCancelQuery() throws Exception
+ {
+ m_query.prepare( "Simple Query" );
+
+ boolean hasException = false;
+ try
+ {
+ m_query.cancel();
+ }
+ catch( OdaException ex )
+ {
+ hasException = true;
+ }
+ assertTrue( hasException );
+
+ m_query.executeQuery();
+ hasException = false;
+ try
+ {
+ m_query.cancel();
+ }
+ catch( OdaException ex )
+ {
+ hasException = true;
+ }
+ assertTrue( hasException );
+ }
+
+ public void testQuerySpec() throws Exception
+ {
+ QuerySpecification querySpec = new QuerySpecification();
+ m_query.setSpecification( querySpec );
+ m_query.prepare( "Simple Query" );
+
+ String preparedText = m_query.getEffectiveQueryText();
+ assertEquals( "Simple Query" + querySpec, preparedText );
+ }
+
public final void testSetParametersByPos() throws OdaException
{
// Test setting parameters by position, without preparing
@@ -406,6 +445,22 @@
else
fail();
}
+
+ try
+ {
+ Object val = TestData.createObjectData();
+ m_query.setObject( 9, val );
+
+ if ( ! isQueryPrepared )
+ fail();
+ }
+ catch( OdaException e )
+ {
+ if ( ! isQueryPrepared )
+ CheckExceptionSetParamBeforePrepare( e );
+ else
+ fail();
+ }
}
public final void testSetParametersByName() throws OdaException
@@ -565,6 +620,22 @@
else
fail();
}
+
+ try
+ {
+ Object val = TestData.createObjectData();
+ m_query.setObject( "ObjectParamIn", val );
+
+ if ( ! isQueryPrepared )
+ fail();
+ }
+ catch( OdaException e )
+ {
+ if ( ! isQueryPrepared )
+ CheckExceptionSetParamBeforePrepare( e );
+ else
+ fail();
+ }
}
public final void testFindInParameter( ) throws OdaException
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetMetaDataTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetMetaDataTest.java
index 4d8a388..711071b 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetMetaDataTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetMetaDataTest.java
@@ -165,7 +165,7 @@
private void checkColumnCount( IResultSetMetaData md ) throws OdaException
{
- assertEquals( 12, md.getColumnCount() );
+ assertEquals( 13, md.getColumnCount() );
}
private void checkColumnNames( IResultSetMetaData md ) throws OdaException
diff --git a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetTest.java b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetTest.java
index 630937b..8d1fdc0 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.consumer.tests/src/org/eclipse/datatools/connectivity/oda/consumer/tests/ResultSetTest.java
@@ -115,6 +115,22 @@
val = m_resultSet.getBoolean( "BooleanCol" );
assertEquals( expectedVal, val );
}
+
+ public final void testGetObject() throws OdaException
+ {
+ boolean retVal = m_resultSet.next();
+ assertTrue( retVal );
+
+ Object expectedVal = TestData.createObjectData();
+
+ // Test get value by column pos. defined in TestResultSetMetaDataImpl
+ Object val = m_resultSet.getObject( 13 );
+ assertEquals( expectedVal, val );
+
+ // Test get value by column name.
+ val = m_resultSet.getObject( "ObjectCol" );
+ assertEquals( expectedVal, val );
+ }
public final void testGetBigDecimal() throws OdaException
{
diff --git a/tests/org.eclipse.datatools.connectivity.oda.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.datatools.connectivity.oda.tests/META-INF/MANIFEST.MF
index 9961ee1..8d180fd 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.datatools.connectivity.oda.tests/META-INF/MANIFEST.MF
@@ -7,5 +7,5 @@
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.datatools.connectivity.oda;bundle-version="[3.2.0,4.0.0)",
org.junit;bundle-version="[3.8.1,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
+ org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/org.eclipse.datatools.connectivity.oda.tests/src/org/eclipse/datatools/connectivity/oda/spec/tests/FilterExtensionsTest.java b/tests/org.eclipse.datatools.connectivity.oda.tests/src/org/eclipse/datatools/connectivity/oda/spec/tests/FilterExtensionsTest.java
index 192498b..2241be9 100644
--- a/tests/org.eclipse.datatools.connectivity.oda.tests/src/org/eclipse/datatools/connectivity/oda/spec/tests/FilterExtensionsTest.java
+++ b/tests/org.eclipse.datatools.connectivity.oda.tests/src/org/eclipse/datatools/connectivity/oda/spec/tests/FilterExtensionsTest.java
@@ -91,6 +91,17 @@
assertEquals( 1, betweenDefn.getMinArguments().intValue() );
assertEquals( 2, betweenDefn.getMaxArguments().intValue() );
assertFalse( betweenDefn.supportsUnboundedMaxArguments() );
+
+ FilterExpressionDefinition isInstanceDefn =
+ ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( contributor.getDeclaringExtensionId(), INSTANCE_EXPR_ID );
+ assertTrue( isInstanceDefn.isNegatable() );
+ assertFalse( isInstanceDefn.isOptionable() );
+ }
+
+ public void testVariableRestrictions() throws Exception
+ {
+ FilterExpressionDefinition betweenDefn =
+ ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( TEST_EXTENSION_ID, BETWEEN_EXPR_ID );
// test the content of variableRestriction elements
assertEquals( 1, betweenDefn.getVariableRestrictions().getRestrictedVariableTypes().length );
@@ -105,9 +116,7 @@
assertFalse( betweenDefn.getVariableRestrictions().supportsClassType( VariableType.INSTANCE_OF, RESTRICTED_CLASS_NAME ) );
FilterExpressionDefinition isInstanceDefn =
- ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( contributor.getDeclaringExtensionId(), INSTANCE_EXPR_ID );
- assertTrue( isInstanceDefn.isNegatable() );
- assertFalse( isInstanceDefn.isOptionable() );
+ ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( TEST_EXTENSION_ID, INSTANCE_EXPR_ID );
assertEquals( 1, isInstanceDefn.getVariableRestrictions().getRestrictedVariableTypes().length );
assertTrue( isInstanceDefn.getVariableRestrictions().supportsVariableType( VariableType.INSTANCE_OF ));
@@ -119,8 +128,12 @@
assertFalse( isInstanceDefn.getVariableRestrictions().hasDataTypeRestrictions( VariableType.RESULT_SET_COLUMN ) );
assertEquals( 0, isInstanceDefn.getVariableRestrictions().getResultColumnRestrictedOdaDataTypes().length );
assertFalse( isInstanceDefn.getVariableRestrictions().supportsOdaDataType( VariableType.RESULT_SET_COLUMN, Types.CHAR ) );
+
+ FilterExpressionDefinition idEqDefn =
+ ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( TEST_EXTENSION_ID, "IdentityEq" ); //$NON-NLS-1$
+ assertTrue( idEqDefn.getVariableRestrictions().supportsOdaDataType( VariableType.RESULT_SET_COLUMN, Types.JAVA_OBJECT ) );
}
-
+
public void testCreateExpression() throws Exception
{
FilterExpressionDefinition equalDefn =
@@ -143,6 +156,9 @@
FilterExpressionDefinition betweenDefn =
ResultExtensionExplorer.getInstance().getExtensionFilterDefinition( TEST_EXTENSION_ID, BETWEEN_EXPR_ID );
CustomExpression betweenExpr = betweenDefn.createExpression();
+ assertEquals( "org.eclipse.datatools.connectivity.oda.consumer.testdriver.spec.impl.MyCustomExpression", //$NON-NLS-1$
+ betweenExpr.getClass().getName() );
+
betweenExpr.setVariable( new ExpressionVariable( "(CREDITLIMIT / 100)" ) ); //$NON-NLS-1$
ExpressionArguments betweenArgs = new ExpressionArguments();
betweenArgs.addValue( 100.0 )
@@ -180,5 +196,5 @@
fail();
}
}
-
+
}