Skip to content

Commit

Permalink
In mondrian driver, create dual implementations of key JDBC objects t…
Browse files Browse the repository at this point in the history
…o allow running against both JDBC 3.0 (JDK 1.5) and JDBC 4.0 (JDK 1.6); add OlapWrapper for JDBC 3.0 users, who have no access to java.sql.Wrapper methods; implement OlapPreparedStatement in mondrian driver.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@22 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Jun 15, 2007
1 parent bddae98 commit 7a691f0
Show file tree
Hide file tree
Showing 38 changed files with 2,373 additions and 794 deletions.
20 changes: 20 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,33 @@
<target name="compile" depends="prepare,parser,compile.java"/>

<target name="compile.java">
<condition property="jdk16.present">
<equals arg1="${ant.java.version}" arg2="1.6"/>
</condition>
<condition property="jdk16.not.present">
<not>
<equals arg1="${ant.java.version}" arg2="1.6"/>
</not>
</condition>

<javac
srcdir="${src.dir}"
destdir="${classes.dir}"
debug="${project.build.debug}"
classpathref="project.classpath"
source="1.5">
<include name="**/*.java"/>
<exclude name="mondrian/olap4j/FactoryJdbc3Impl.java" if="jdk16.present"/>
<exclude name="mondrian/olap4j/FactoryJdbc4Impl.java" if="jdk16.not.present"/>
</javac>

<javac
srcdir="${testsrc.dir}"
destdir="${testclasses.dir}"
debug="${project.build.debug}"
classpathref="project.classpath"
source="1.5">
<include name="**/*.java"/>
</javac>
</target>

Expand Down
232 changes: 4 additions & 228 deletions src/mondrian/olap4j/EmptyResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package mondrian.olap4j;

import org.olap4j.OlapWrapper;

import java.sql.*;
import java.math.BigDecimal;
import java.io.InputStream;
Expand All @@ -24,7 +26,7 @@
* @version $Id$
* @since May 24, 2007
*/
class EmptyResultSet implements ResultSet {
abstract class EmptyResultSet implements ResultSet, OlapWrapper {
final MondrianOlap4jConnection olap4jConnection;

EmptyResultSet(MondrianOlap4jConnection olap4jConnection) {
Expand Down Expand Up @@ -611,233 +613,7 @@ public void updateArray(String columnLabel, Array x) throws SQLException {
throw new UnsupportedOperationException();
}

public RowId getRowId(int columnIndex) throws SQLException {
throw new UnsupportedOperationException();
}

public RowId getRowId(String columnLabel) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateRowId(int columnIndex, RowId x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateRowId(String columnLabel, RowId x) throws SQLException {
throw new UnsupportedOperationException();
}

public int getHoldability() throws SQLException {
throw new UnsupportedOperationException();
}

public boolean isClosed() throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNString(
int columnIndex, String nString) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNString(
String columnLabel, String nString) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(
String columnLabel, NClob nClob) throws SQLException {
throw new UnsupportedOperationException();
}

public NClob getNClob(int columnIndex) throws SQLException {
throw new UnsupportedOperationException();
}

public NClob getNClob(String columnLabel) throws SQLException {
throw new UnsupportedOperationException();
}

public SQLXML getSQLXML(int columnIndex) throws SQLException {
throw new UnsupportedOperationException();
}

public SQLXML getSQLXML(String columnLabel) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateSQLXML(
int columnIndex, SQLXML xmlObject) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateSQLXML(
String columnLabel, SQLXML xmlObject) throws SQLException {
throw new UnsupportedOperationException();
}

public String getNString(int columnIndex) throws SQLException {
throw new UnsupportedOperationException();
}

public String getNString(String columnLabel) throws SQLException {
throw new UnsupportedOperationException();
}

public Reader getNCharacterStream(int columnIndex) throws SQLException {
throw new UnsupportedOperationException();
}

public Reader getNCharacterStream(String columnLabel) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNCharacterStream(
int columnIndex, Reader x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNCharacterStream(
String columnLabel, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateAsciiStream(
int columnIndex, InputStream x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBinaryStream(
int columnIndex, InputStream x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateCharacterStream(
int columnIndex, Reader x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateAsciiStream(
String columnLabel, InputStream x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBinaryStream(
String columnLabel, InputStream x, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateCharacterStream(
String columnLabel, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBlob(
int columnIndex,
InputStream inputStream,
long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBlob(
String columnLabel,
InputStream inputStream,
long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateClob(
int columnIndex, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateClob(
String columnLabel, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(
int columnIndex, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(
String columnLabel, Reader reader, long length) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNCharacterStream(
int columnIndex, Reader x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNCharacterStream(
String columnLabel, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateAsciiStream(
int columnIndex, InputStream x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBinaryStream(
int columnIndex, InputStream x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateCharacterStream(
int columnIndex, Reader x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateAsciiStream(
String columnLabel, InputStream x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBinaryStream(
String columnLabel, InputStream x) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateCharacterStream(
String columnLabel, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBlob(
int columnIndex, InputStream inputStream) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateBlob(
String columnLabel, InputStream inputStream) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateClob(int columnIndex, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateClob(
String columnLabel, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(
int columnIndex, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}

public void updateNClob(
String columnLabel, Reader reader) throws SQLException {
throw new UnsupportedOperationException();
}
// implement Wrapper

public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface.isInstance(this)) {
Expand Down
45 changes: 45 additions & 0 deletions src/mondrian/olap4j/Factory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
// $Id: $
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007-2007 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
package mondrian.olap4j;

import mondrian.olap.Result;

import java.util.Properties;
import java.sql.Connection;
import java.sql.SQLException;

/**
* Instantiates classes to implement the olap4j API against the
* Mondrian OLAP engine.
*
* <p>There are implementations for JDBC 3.0 (which occurs in JDK 1.5)
* and JDBC 4.0 (which occurs in JDK 1.6).
*
* @author jhyde
* @version $Id: $
* @since Jun 14, 2007
*/
interface Factory {
Connection newConnection(String url, Properties info) throws SQLException;

EmptyResultSet newEmptyResultSet(MondrianOlap4jConnection olap4jConnection);

MondrianOlap4jCellSet newCellSet(
MondrianOlap4jStatement olap4jStatement,
Result result);

MondrianOlap4jPreparedStatement newPreparedStatement(
String mdx, MondrianOlap4jConnection olap4jConnection);

MondrianOlap4jDatabaseMetaData newDatabaseMetaData(
MondrianOlap4jConnection olap4jConnection);
}

// End Factory.java
Loading

0 comments on commit 7a691f0

Please sign in to comment.