You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/04/23 01:07:23 UTC

svn commit: r1470749 - in /jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc: ./ metadata/ metadata/results/ metadata/results/columns/ results/ results/metadata/ results/metadata/columns/

Author: rvesse
Date: Mon Apr 22 23:07:22 2013
New Revision: 1470749

URL: http://svn.apache.org/r1470749
Log:
Start implementing metadata returns

Added:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSetMetadata.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AbstractResultsMetadata.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/IntegerColumn.java
Removed:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/columns/
Modified:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JdbcCompatibility.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ShortIntegerColumn.java

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JdbcCompatibility.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JdbcCompatibility.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JdbcCompatibility.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/JdbcCompatibility.java Mon Apr 22 23:07:22 2013
@@ -30,7 +30,7 @@ import org.apache.jena.jdbc.results.meta
 import org.apache.jena.jdbc.results.metadata.columns.DoubleColumn;
 import org.apache.jena.jdbc.results.metadata.columns.FloatColumn;
 import org.apache.jena.jdbc.results.metadata.columns.LongIntegerColumn;
-import org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn;
+import org.apache.jena.jdbc.results.metadata.columns.IntegerColumn;
 import org.apache.jena.jdbc.results.metadata.columns.StringColumn;
 import org.apache.jena.jdbc.results.metadata.columns.TimeColumn;
 
@@ -242,10 +242,10 @@ public class JdbcCompatibility {
             return new LongIntegerColumn(var, nullable, true);
         } else if (dtUri.equals(XSD.xshort.toString())) {
             // Short Integer column
-            return new ShortIntegerColumn(var, nullable, true);
+            return new IntegerColumn(var, nullable, true);
         } else if (dtUri.equals(XSD.unsignedShort.toString())) {
             // Unsigned Short Integer column
-            return new ShortIntegerColumn(var, nullable, false);
+            return new IntegerColumn(var, nullable, false);
         } else if (dtUri.equals(XSD.xbyte.toString())) {
             // Signed Byte
             return new ByteColumn(var, nullable, true);

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/JenaMetadata.java Mon Apr 22 23:07:22 2013
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 
 import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.metadata.results.MetaResultSet;
 
 /**
  * Database metadata for Jena JDBC connections
@@ -129,14 +130,12 @@ public abstract class JenaMetadata imple
 
     @Override
     public ResultSet getAttributes(String arg0, String arg1, String arg2, String arg3) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return new MetaResultSet(MetadataSchema.getAttributeColumns());
     }
 
     @Override
     public ResultSet getBestRowIdentifier(String arg0, String arg1, String arg2, int arg3, boolean arg4) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return new MetaResultSet(MetadataSchema.getBestRowIdentifierColumns());
     }
 
     @Override
@@ -152,11 +151,7 @@ public abstract class JenaMetadata imple
 
     @Override
     public ResultSet getCatalogs() throws SQLException {
-        // TODO Requires a result set implementation that can be appropriately
-        // configured
-
-        // TODO Auto-generated method stub
-        return null;
+        return new MetaResultSet(MetadataSchema.getCatalogsColumns(), new Object[][] { { DEFAULT_CATALOG } });
     }
 
     @Override

Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java?rev=1470749&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/MetadataSchema.java Mon Apr 22 23:07:22 2013
@@ -0,0 +1,207 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.metadata;
+
+import static java.sql.ResultSetMetaData.*;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
+import org.apache.jena.jdbc.results.metadata.columns.IntegerColumn;
+import org.apache.jena.jdbc.results.metadata.columns.ShortIntegerColumn;
+import org.apache.jena.jdbc.results.metadata.columns.StringColumn;
+
+/**
+ * Helper class containing constants pertaining to the columns returned by
+ * various methods of a {@link DatabaseMetaData} implementation
+ * 
+ */
+public class MetadataSchema {
+
+    /**
+     * Private constructor prevents instantiation
+     */
+    private MetadataSchema() {
+    }
+
+    private static boolean init = false;
+
+    private static ColumnInfo[] ATTRIBUTE_COLUMNS;
+
+    private static ColumnInfo[] BEST_ROW_IDENTIFIER_COLUMNS;
+
+    private static ColumnInfo[] CATALOG_COLUMNS;
+
+    /**
+     * Gets the columns for the
+     * {@link DatabaseMetaData#getAttributes(String, String, String, String)}
+     * method
+     * 
+     * @return Column information
+     */
+    public static ColumnInfo[] getAttributeColumns() {
+        return ATTRIBUTE_COLUMNS;
+    }
+
+    /**
+     * Gets the columns for the
+     * {@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)}
+     * method
+     * 
+     * @return Column information
+     */
+    public static ColumnInfo[] getBestRowIdentifierColumns() {
+        return BEST_ROW_IDENTIFIER_COLUMNS;
+    }
+
+    /**
+     * Gets the columns for the {@link DatabaseMetaData#getCatalogs()} method
+     * 
+     * @return Column information
+     */
+    public static ColumnInfo[] getCatalogsColumns() {
+        return CATALOG_COLUMNS;
+    }
+
+    /**
+     * Static initializer, calls private synchronized static initializer to
+     * avoid multi-threaded race conditions
+     */
+    static {
+        init();
+    }
+
+    /**
+     * Synchronized static initializer is called by the class static
+     * initializer, this is done to avoid multi-threaded race conditions and
+     * ensure once only initialization
+     */
+    private static synchronized void init() {
+        if (init)
+            return;
+        try {
+            ATTRIBUTE_COLUMNS = new ColumnInfo[] {
+                    // TYPE_CAT String => type catalog (may be null)
+                    new StringColumn("TYPE_CAT", columnNullable),
+                    // TYPE_SCHEM String => type schema (may be null)
+                    new StringColumn("TYPE_SCHEM", columnNullable),
+                    // TYPE_NAME String => type name
+                    new StringColumn("TYPE_NAME", columnNoNulls),
+                    // ATTR_NAME String => attribute name
+                    new StringColumn("ATTR_NAME", columnNoNulls),
+                    // DATA_TYPE int => attribute type SQL type from
+                    // java.sql.Types
+                    new IntegerColumn("DATA_TYPE", columnNoNulls, true),
+                    // ATTR_TYPE_NAME String => Data source dependent type name.
+                    // For a UDT, the type name is fully qualified. For a REF,
+                    // the type name is fully qualified and represents the
+                    // target type of the reference type.
+                    new StringColumn("ATTR_TYPE_NAME", columnNoNulls),
+                    // ATTR_SIZE int => column size. For char or date types this
+                    // is the maximum number of characters; for numeric or
+                    // decimal types this is precision.
+                    new IntegerColumn("ATTR_SIZE", columnNoNulls, true),
+                    // DECIMAL_DIGITS int => the number of fractional digits.
+                    // Null is returned for data types where DECIMAL_DIGITS is
+                    // not applicable.
+                    new IntegerColumn("DECIMAL_DIGITS", columnNoNulls, true),
+                    // NUM_PREC_RADIX int => Radix (typically either 10 or 2)
+                    new IntegerColumn("NUM_PREC_RADIX", columnNoNulls, true),
+                    // NULLABLE int => whether NULL is allowed
+                    // attributeNoNulls - might not allow NULL values
+                    // attributeNullable - definitely allows NULL values
+                    // attributeNullableUnknown - nullability unknown
+                    new IntegerColumn("NULLABLE", columnNoNulls, true),
+                    // REMARKS String => comment describing column (may be null)
+                    new StringColumn("REMARKS", columnNullable),
+                    // ATTR_DEF String => default value (may be null)
+                    new StringColumn("ATTR_DEF", columnNullable),
+                    // SQL_DATA_TYPE int => unused
+                    new IntegerColumn("SQL_DATA_TYPE", columnNoNulls, true),
+                    // SQL_DATETIME_SUB int => unused
+                    new IntegerColumn("SQL_DATETIME_SUB", columnNoNulls, true),
+                    // CHAR_OCTET_LENGTH int => for char types the maximum
+                    // number of bytes in the column
+                    new IntegerColumn("CHAR_OCTET_LENGTH", columnNoNulls, true),
+                    // ORDINAL_POSITION int => index of the attribute in the UDT
+                    // (starting at 1)
+                    new IntegerColumn("ORDINAL_POSITION", columnNoNulls, true),
+                    // IS_NULLABLE String => ISO rules are used to determine the
+                    // nullability for a attribute.
+                    // YES --- if the attribute can include NULLs
+                    // NO --- if the attribute cannot include NULLs
+                    // empty string --- if the nullability for the attribute is
+                    // unknown
+                    new StringColumn("IS_NULLABLE", columnNoNulls),
+                    // SCOPE_CATALOG String => catalog of table that is the
+                    // scope of a
+                    // reference attribute (null if DATA_TYPE isn't REF)
+                    new StringColumn("SCOPE_CATALOG", columnNullable),
+                    // SCOPE_SCHEMA String => schema of table that is the scope
+                    // of a reference attribute (null if DATA_TYPE isn't REF)
+                    new StringColumn("SCOPE_SCHEMA", columnNullable),
+                    // SCOPE_TABLE String => table name that is the scope of a
+                    // referenceattribute (null if the DATA_TYPE isn't REF)
+                    new StringColumn("SCOPE_TABLE", columnNullable),
+                    // SOURCE_DATA_TYPE short => source type of a distinct type
+                    // or user-generated Ref type,SQL type from java.sql.Types
+                    // (null if DATA_TYPE isn't DISTINCT or user-generated REF)
+                    new ShortIntegerColumn("SOURCE_DATA_TYPE", columnNullable, true) };
+
+            BEST_ROW_IDENTIFIER_COLUMNS = new ColumnInfo[] {
+                    // SCOPE short => actual scope of result
+                    // bestRowTemporary - very temporary, while using row
+                    // bestRowTransaction - valid for remainder of current
+                    // transaction
+                    // bestRowSession - valid for remainder of current session
+                    new ShortIntegerColumn("SCOPE", columnNoNulls, true),
+                    // COLUMN_NAME String => column name
+                    new StringColumn("COLUMN_NAME", columnNoNulls),
+                    // DATA_TYPE int => SQL data type from java.sql.Types
+                    new IntegerColumn("DATA_TYPE", columnNoNulls, true),
+                    // TYPE_NAME String => Data source dependent type name, for
+                    // a UDT
+                    // the type name is fully qualified
+                    new StringColumn("TYPE_NAME", columnNoNulls),
+                    // COLUMN_SIZE int => precision
+                    new IntegerColumn("COLUMN_SIZE", columnNoNulls, true),
+                    // BUFFER_LENGTH int => not used
+                    new IntegerColumn("BUFFER_LENGTH", columnNoNulls, true),
+                    // DECIMAL_DIGITS short => scale - Null is returned for data
+                    // types
+                    // where DECIMAL_DIGITS is not applicable.
+                    new ShortIntegerColumn("DECIMAL_DIGITS", columnNullable, true),
+                    // PSEUDO_COLUMN short => is this a pseudo column like an
+                    // Oracle
+                    // ROWID
+                    // bestRowUnknown - may or may not be pseudo column
+                    // bestRowNotPseudo - is NOT a pseudo column
+                    // bestRowPseudo - is a pseudo column
+                    new ShortIntegerColumn("PSUEDO_COLUMN", columnNoNulls, true) };
+
+            CATALOG_COLUMNS = new ColumnInfo[] {
+            // TABLE_CAT String => catalog name
+            new StringColumn("TABLE_CAT", columnNoNulls) };
+        } catch (SQLException e) {
+            throw new Error("Fatal error initializing JDBC metadata schema information");
+        }
+        init = true;
+    }
+}

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSet.java Mon Apr 22 23:07:22 2013
@@ -38,10 +38,11 @@ import java.sql.SQLXML;
 import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.sql.Types;
 import java.util.Calendar;
 import java.util.Map;
 
-import org.apache.jena.jdbc.metadata.results.columns.MetaColumn;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
 
 /**
  * A result set implementation specifically for representing JDBC metadata
@@ -51,16 +52,18 @@ public class MetaResultSet implements Re
 
     private int currRow = -1;
     private boolean wasNull = false, closed = false;
-    private MetaColumn[] columns;
+    private ColumnInfo[] columns;
     private Object[][] rows;
+    private ResultSetMetaData metadata;
 
     /**
      * Creates new empty metadata
      * 
      * @param columns
      *            Columns
+     * @throws SQLException
      */
-    public MetaResultSet(MetaColumn[] columns) {
+    public MetaResultSet(ColumnInfo[] columns) throws SQLException {
         this(columns, new Object[0][0]);
     }
 
@@ -71,14 +74,16 @@ public class MetaResultSet implements Re
      *            Columns
      * @param rows
      *            Rows
+     * @throws SQLException
      */
-    public MetaResultSet(MetaColumn[] columns, Object[][] rows) {
+    public MetaResultSet(ColumnInfo[] columns, Object[][] rows) throws SQLException {
         if (columns == null)
             throw new IllegalArgumentException("Column information cannot be null");
         if (rows == null)
             throw new IllegalArgumentException("Row data cannot be null");
         this.columns = columns;
         this.rows = rows;
+        this.metadata = new MetaResultSetMetadata(this, this.columns);
     }
 
     @Override
@@ -170,8 +175,15 @@ public class MetaResultSet implements Re
 
     @Override
     public int findColumn(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        if (this.isClosed())
+            throw new SQLException("Result set is closed");
+        for (int i = 0; i < this.columns.length; i++) {
+            if (this.columns[i].getLabel().equals(columnLabel)) {
+                // Remember that JDBC uses a 1 based index
+                return i + 1;
+            }
+        }
+        throw new SQLException("The given column does not exist in this result set");
     }
 
     @Override
@@ -184,6 +196,40 @@ public class MetaResultSet implements Re
         }
     }
 
+    private Object getValue(int columnIndex, int expectedType, Class<?> targetType, Object nullValue) throws SQLException {
+        if (this.isClosed())
+            throw new SQLException("Result set is closed");
+        if (this.currRow < 0 || this.currRow >= this.rows.length)
+            throw new SQLException("Not currently at a row");
+        if (columnIndex < 1 || columnIndex > this.columns.length)
+            throw new SQLException("Column index is out of bounds");
+
+        // Remember that JDBC uses a 1 based index
+        ColumnInfo info = this.columns[columnIndex - 1];
+
+        // Determine whether the column has a null value
+        Object obj = this.rows[this.currRow][columnIndex];
+        this.wasNull = (obj == null);
+        if (this.wasNull)
+            return nullValue;
+
+        if (info.getType() == expectedType) {
+            // If the column is typed appropriately try and marshal
+            // appropriately
+            if (targetType.isAssignableFrom(obj.getClass())) {
+                try {
+                    return targetType.cast(obj);
+                } catch (ClassCastException e) {
+                    throw new SQLException("Value for this column in the current row is not valid for the column type");
+                }
+            } else {
+                throw new SQLException("Value for this column in the current row is not valid for the column type");
+            }
+        } else {
+            throw new SQLException("Given column does not contain decimal values");
+        }
+    }
+
     @Override
     public Array getArray(int columnIndex) throws SQLException {
         throw new SQLFeatureNotSupportedException();
@@ -206,254 +252,215 @@ public class MetaResultSet implements Re
 
     @Override
     public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (BigDecimal) this.getValue(columnIndex, Types.DECIMAL, BigDecimal.class, null);
     }
 
     @Override
     public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getBigDecimal(this.findColumn(columnLabel));
     }
 
+    @Deprecated
     @Override
     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
+    @Deprecated
     @Override
     public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public InputStream getBinaryStream(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public InputStream getBinaryStream(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Blob getBlob(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Blob getBlob(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public boolean getBoolean(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return false;
+        return (Boolean) this.getValue(columnIndex, Types.BOOLEAN, Boolean.class, false);
     }
 
     @Override
     public boolean getBoolean(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return false;
+        return this.getBoolean(this.findColumn(columnLabel));
     }
 
     @Override
     public byte getByte(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Byte) this.getValue(columnIndex, Types.TINYINT, Byte.class, 0x0);
     }
 
     @Override
     public byte getByte(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getByte(this.findColumn(columnLabel));
     }
 
     @Override
     public byte[] getBytes(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public byte[] getBytes(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Reader getCharacterStream(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Reader getCharacterStream(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Clob getClob(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Clob getClob(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public int getConcurrency() throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return ResultSet.CONCUR_READ_ONLY;
     }
 
     @Override
     public String getCursorName() throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Date getDate(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (Date) this.getValue(columnIndex, Types.DATE, Date.class, null);
     }
 
     @Override
     public Date getDate(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getDate(this.findColumn(columnLabel));
     }
 
     @Override
     public Date getDate(int columnIndex, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Date getDate(String columnLabel, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public double getDouble(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Double) this.getValue(columnIndex, Types.DOUBLE, Double.class, 0d);
     }
 
     @Override
     public double getDouble(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getDouble(this.findColumn(columnLabel));
     }
 
     @Override
     public int getFetchDirection() throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return ResultSet.FETCH_FORWARD;
     }
 
     @Override
     public int getFetchSize() throws SQLException {
-        // TODO Auto-generated method stub
+        // Not supported
         return 0;
     }
 
     @Override
     public float getFloat(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Float) this.getValue(columnIndex, Types.FLOAT, Float.class, 0f);
     }
 
     @Override
     public float getFloat(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getFloat(this.findColumn(columnLabel));
     }
 
     @Override
     public int getHoldability() throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return ResultSet.HOLD_CURSORS_OVER_COMMIT;
     }
 
     @Override
     public int getInt(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Integer) this.getValue(columnIndex, Types.INTEGER, Integer.class, 0);
     }
 
     @Override
     public int getInt(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getInt(this.findColumn(columnLabel));
     }
 
     @Override
     public long getLong(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Long) this.getValue(columnIndex, Types.BIGINT, Long.class, 0l);
     }
 
     @Override
     public long getLong(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getLong(this.findColumn(columnLabel));
     }
 
     @Override
     public ResultSetMetaData getMetaData() throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.metadata;
     }
 
     @Override
     public Reader getNCharacterStream(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Reader getNCharacterStream(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public NClob getNClob(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public NClob getNClob(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public String getNString(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (String) this.getValue(columnIndex, Types.NVARCHAR, String.class, null);
     }
 
     @Override
     public String getNString(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getNString(this.findColumn(columnLabel));
     }
 
     @Override
@@ -464,170 +471,149 @@ public class MetaResultSet implements Re
 
     @Override
     public Object getObject(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getObject(this.findColumn(columnLabel));
     }
 
     @Override
     public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Ref getRef(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Ref getRef(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public int getRow() throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        // Remember JDBC used a 1 based index
+        if (this.currRow >= 0 && this.currRow < this.rows.length) {
+            return this.currRow + 1;
+        } else {
+            return 0;
+        }
     }
 
     @Override
     public RowId getRowId(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public RowId getRowId(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public SQLXML getSQLXML(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public SQLXML getSQLXML(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public short getShort(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return (Short) this.getValue(columnIndex, Types.SMALLINT, Short.class, (short) 0);
     }
 
     @Override
     public short getShort(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return this.getShort(this.findColumn(columnLabel));
     }
 
     @Override
     public Statement getStatement() throws SQLException {
-        // TODO Auto-generated method stub
         return null;
     }
 
     @Override
     public String getString(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (String) this.getValue(columnIndex, Types.NVARCHAR, String.class, null);
     }
 
     @Override
     public String getString(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getString(this.findColumn(columnLabel));
     }
 
     @Override
     public Time getTime(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (Time) this.getValue(columnIndex, Types.TIME, Time.class, null);
     }
 
     @Override
     public Time getTime(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getTime(this.findColumn(columnLabel));
     }
 
     @Override
     public Time getTime(int columnIndex, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Time getTime(String columnLabel, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Timestamp getTimestamp(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return (Timestamp) this.getValue(columnIndex, Types.TIMESTAMP, Timestamp.class, null);
     }
 
     @Override
     public Timestamp getTimestamp(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        return this.getTimestamp(this.findColumn(columnLabel));
     }
 
     @Override
     public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public int getType() throws SQLException {
-        // TODO Auto-generated method stub
-        return 0;
+        return ResultSet.TYPE_SCROLL_INSENSITIVE;
     }
 
     @Override
     public URL getURL(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override
     public URL getURL(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
+    @Deprecated
     @Override
     public InputStream getUnicodeStream(int columnIndex) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
+    @Deprecated
     @Override
     public InputStream getUnicodeStream(String columnLabel) throws SQLException {
-        // TODO Auto-generated method stub
-        return null;
+        throw new SQLFeatureNotSupportedException();
     }
 
     @Override

Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSetMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSetMetadata.java?rev=1470749&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSetMetadata.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/metadata/results/MetaResultSetMetadata.java Mon Apr 22 23:07:22 2013
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.metadata.results;
+
+import java.sql.SQLException;
+import org.apache.jena.jdbc.results.metadata.AbstractResultsMetadata;
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
+
+/**
+ * Abstract implementation of result set metadata for Jena JDBC metadata result sets
+ * 
+ */
+public class MetaResultSetMetadata extends AbstractResultsMetadata {
+    /**
+     * Creates new result set metadata
+     * 
+     * @param results
+     *            Result Set
+     * @param columns
+     *            Column Information
+     * @throws SQLException
+     */
+    public MetaResultSetMetadata(MetaResultSet results, ColumnInfo[] columns) throws SQLException {
+        super(results, columns);
+    }
+}

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/SelectResults.java Mon Apr 22 23:07:22 2013
@@ -67,7 +67,7 @@ public class SelectResults extends Strea
         this.columns = new ArrayList<String>(this.innerResults.getResultVars());
         this.metadata = new SelectResultsMetadata(this, this.innerResults);
     }
-    
+
     /**
      * Creates new select results
      * 
@@ -82,7 +82,8 @@ public class SelectResults extends Strea
      * @throws SQLException
      *             Thrown if the arguments are invalid
      */
-    public SelectResults(JenaStatement statement, QueryExecution qe, com.hp.hpl.jena.query.ResultSet results, boolean commit) throws SQLException {
+    public SelectResults(JenaStatement statement, QueryExecution qe, com.hp.hpl.jena.query.ResultSet results, boolean commit)
+            throws SQLException {
         this(statement, qe, ResultSetFactory.makePeekable(results), commit);
     }
 
@@ -100,8 +101,10 @@ public class SelectResults extends Strea
         if (this.isClosed())
             throw new SQLException("Result Set is closed");
         for (int i = 0; i < this.columns.size(); i++) {
-            if (this.columns.get(i).equals(columnLabel))
+            if (this.columns.get(i).equals(columnLabel)) {
+                // Remember that JDBC uses a 1 based index
                 return i + 1;
+            }
         }
         throw new SQLException("The given column does not exist in this result set");
     }
@@ -111,6 +114,7 @@ public class SelectResults extends Strea
         if (this.isClosed())
             throw new SQLException("Result Set is closed");
         if (columnIndex >= 1 && columnIndex <= this.columns.size()) {
+            // Remember that JDBC uses a 1 based index
             return this.columns.get(columnIndex - 1);
         } else {
             throw new SQLException("Column Index is out of bounds");

Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AbstractResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AbstractResultsMetadata.java?rev=1470749&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AbstractResultsMetadata.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/AbstractResultsMetadata.java Mon Apr 22 23:07:22 2013
@@ -0,0 +1,187 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
+
+/**
+ * Abstract implementation of JDBC result set metadata
+ *
+ */
+public class AbstractResultsMetadata implements ResultSetMetaData {
+
+    protected ResultSet results;
+    protected List<ColumnInfo> columns = new ArrayList<ColumnInfo>();
+
+    public AbstractResultsMetadata(ResultSet results, ColumnInfo[] columns) throws SQLException {
+        if (results == null)
+            throw new SQLException("Result Set cannot be null");
+        this.results = results;
+        for (ColumnInfo column : columns) {
+            this.columns.add(column);
+        }
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        throw new SQLFeatureNotSupportedException();
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        throw new SQLFeatureNotSupportedException();
+    }
+
+    @Override
+    public String getCatalogName(int column) throws SQLException {
+        if (this.results != null) {
+            return this.results.getStatement().getConnection().getCatalog();
+        } else {
+            return "";
+        }
+    }
+
+    protected final ColumnInfo getColumnInfo(int column) throws SQLException {
+        // Remember JDBC columns use a 1 based index
+        if (column >= 1 && column <= this.columns.size()) {
+            return this.columns.get(column - 1);
+        } else {
+            throw new SQLException("Column Index is out of bounds");
+        }
+    }
+
+    @Override
+    public String getColumnClassName(int column) throws SQLException {
+        return this.getColumnInfo(column).getClassName();
+    }
+
+    @Override
+    public int getColumnCount() throws SQLException {
+        return this.columns.size();
+    }
+
+    /**
+     * Gets a columns display size
+     * <p>
+     * Since RDF imposes no maximum on the size of a term this may be
+     * arbitrarily large hence {@link Integer#MAX_VALUE} is returned, users
+     * should not rely on this method to give them accurate information for UI
+     * usage.
+     * </p>
+     */
+    @Override
+    public int getColumnDisplaySize(int column) throws SQLException {
+        return this.getColumnInfo(column).getDisplaySize();
+    }
+
+    @Override
+    public String getColumnName(int column) throws SQLException {
+        return this.getColumnInfo(column).getLabel();
+    }
+
+    @Override
+    public String getColumnLabel(int column) throws SQLException {
+        return this.getColumnInfo(column).getLabel();
+    }
+
+    @Override
+    public int getColumnType(int column) throws SQLException {
+        return this.getColumnInfo(column).getType();
+    }
+
+    @Override
+    public String getColumnTypeName(int column) throws SQLException {
+        return this.getColumnInfo(column).getTypeName();
+    }
+
+    @Override
+    public int getPrecision(int column) throws SQLException {
+        return this.getColumnInfo(column).getPrecision();
+    }
+
+    @Override
+    public int getScale(int column) throws SQLException {
+        return this.getColumnInfo(column).getScale();
+    }
+
+    @Override
+    public String getSchemaName(int column) throws SQLException {
+        // Not applicable so return empty string
+        return "";
+    }
+
+    @Override
+    public String getTableName(int column) throws SQLException {
+        // Not applicable so return empty string
+        return "";
+    }
+
+    @Override
+    public boolean isAutoIncrement(int column) throws SQLException {
+        return this.getColumnInfo(column).isAutoIncrement();
+    }
+
+    @Override
+    public boolean isCaseSensitive(int column) throws SQLException {
+        return this.getColumnInfo(column).isCaseSensitive();
+    }
+
+    @Override
+    public boolean isCurrency(int column) throws SQLException {
+        return this.getColumnInfo(column).isCurrency();
+    }
+
+    @Override
+    public boolean isDefinitelyWritable(int column) throws SQLException {
+        return this.isWritable(column);
+    }
+
+    @Override
+    public int isNullable(int column) throws SQLException {
+        return this.getColumnInfo(column).getNullability();
+    }
+
+    @Override
+    public boolean isReadOnly(int column) throws SQLException {
+        return this.getColumnInfo(column).isReadOnly();
+    }
+
+    @Override
+    public boolean isSearchable(int column) throws SQLException {
+        return this.getColumnInfo(column).isSearchable();
+    }
+
+    @Override
+    public boolean isSigned(int column) throws SQLException {
+        return this.getColumnInfo(column).isSigned();
+    }
+
+    @Override
+    public boolean isWritable(int column) throws SQLException {
+        return this.getColumnInfo(column).isWritable();
+    }
+
+}
\ No newline at end of file

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/JenaResultsMetadata.java Mon Apr 22 23:07:22 2013
@@ -18,23 +18,24 @@
 
 package org.apache.jena.jdbc.results.metadata;
 
-import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.jena.jdbc.results.JenaResultSet;
 import org.apache.jena.jdbc.results.metadata.columns.ColumnInfo;
 
 /**
- * Abstract implementation of result set metadata for Jena JDBC result sets
+ * Abstract implementation of result set metadata for Jena JDBC result sets,
+ * specially for {@link JenaResultSet} implementations.
+ * <p>
+ * This differs from the base {@link AbstractResultsMetadata} in that it
+ * provides a strongly typed method for accessing the {@link JenaResultSet}
+ * which may be useful for some advanced metadata implementations.
+ * </p>
  * 
  */
-public abstract class JenaResultsMetadata implements ResultSetMetaData {
+public abstract class JenaResultsMetadata extends AbstractResultsMetadata {
 
-    private JenaResultSet results;
-    private List<ColumnInfo> columns = new ArrayList<ColumnInfo>();
+    private JenaResultSet jenaResults;
 
     /**
      * Creates new result set metadata
@@ -46,147 +47,16 @@ public abstract class JenaResultsMetadat
      * @throws SQLException
      */
     public JenaResultsMetadata(JenaResultSet results, ColumnInfo[] columns) throws SQLException {
-        if (results == null)
-            throw new SQLException("Result Set cannot be null");
-        this.results = results;
-        for (ColumnInfo column : columns) {
-            this.columns.add(column);
-        }
-    }
-
-    @Override
-    public boolean isWrapperFor(Class<?> iface) throws SQLException {
-        throw new SQLFeatureNotSupportedException();
-    }
-
-    @Override
-    public <T> T unwrap(Class<T> iface) throws SQLException {
-        throw new SQLFeatureNotSupportedException();
-    }
-
-    @Override
-    public String getCatalogName(int column) throws SQLException {
-        return this.results.getStatement().getConnection().getCatalog();
-    }
-
-    protected final ColumnInfo getColumnInfo(int column) throws SQLException {
-        // Remember JDBC columns use a 1 based index
-        if (column >= 1 && column <= this.columns.size()) {
-            return this.columns.get(column - 1);
-        } else {
-            throw new SQLException("Column Index is out of bounds");
-        }
-    }
-
-    @Override
-    public String getColumnClassName(int column) throws SQLException {
-        return this.getColumnInfo(column).getClassName();
-    }
-
-    @Override
-    public int getColumnCount() throws SQLException {
-        return this.columns.size();
+        super(results, columns);
+        this.jenaResults = results;
     }
 
     /**
-     * Gets a columns display size
-     * <p>
-     * Since RDF imposes no maximum on the size of a term this may be
-     * arbitrarily large hence {@link Integer#MAX_VALUE} is returned, users
-     * should not rely on this method to give them accurate information for UI
-     * usage.
-     * </p>
+     * Gets the associated Jena Result Set
+     * @return Jena Result Set
      */
-    @Override
-    public int getColumnDisplaySize(int column) throws SQLException {
-        return this.getColumnInfo(column).getDisplaySize();
-    }
-
-    @Override
-    public String getColumnName(int column) throws SQLException {
-        return this.getColumnInfo(column).getLabel();
-    }
-
-    @Override
-    public String getColumnLabel(int column) throws SQLException {
-        return this.getColumnInfo(column).getLabel();
-    }
-
-    @Override
-    public int getColumnType(int column) throws SQLException {
-        return this.getColumnInfo(column).getType();
-    }
-
-    @Override
-    public String getColumnTypeName(int column) throws SQLException {
-        return this.getColumnInfo(column).getTypeName();
-    }
-
-    @Override
-    public int getPrecision(int column) throws SQLException {
-        return this.getColumnInfo(column).getPrecision();
-    }
-
-    @Override
-    public int getScale(int column) throws SQLException {
-        return this.getColumnInfo(column).getScale();
-    }
-
-    @Override
-    public String getSchemaName(int column) throws SQLException {
-        // Not applicable so return empty string
-        return "";
-    }
-
-    @Override
-    public String getTableName(int column) throws SQLException {
-        // Not applicable so return empty string
-        return "";
-    }
-
-    @Override
-    public boolean isAutoIncrement(int column) throws SQLException {
-        return this.getColumnInfo(column).isAutoIncrement();
-    }
-
-    @Override
-    public boolean isCaseSensitive(int column) throws SQLException {
-        return this.getColumnInfo(column).isCaseSensitive();
-    }
-
-    @Override
-    public boolean isCurrency(int column) throws SQLException {
-        return this.getColumnInfo(column).isCurrency();
-    }
-
-    @Override
-    public boolean isDefinitelyWritable(int column) throws SQLException {
-        return this.isWritable(column);
-    }
-
-    @Override
-    public int isNullable(int column) throws SQLException {
-        return this.getColumnInfo(column).getNullability();
-    }
-
-    @Override
-    public boolean isReadOnly(int column) throws SQLException {
-        return this.getColumnInfo(column).isReadOnly();
-    }
-
-    @Override
-    public boolean isSearchable(int column) throws SQLException {
-        return this.getColumnInfo(column).isSearchable();
-    }
-
-    @Override
-    public boolean isSigned(int column) throws SQLException {
-        return this.getColumnInfo(column).isSigned();
-    }
-
-    @Override
-    public boolean isWritable(int column) throws SQLException {
-        return this.getColumnInfo(column).isWritable();
+    protected final JenaResultSet getJenaResultSet() {
+        return this.jenaResults;
     }
 
 }

Added: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/IntegerColumn.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/IntegerColumn.java?rev=1470749&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/IntegerColumn.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/IntegerColumn.java Mon Apr 22 23:07:22 2013
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.results.metadata.columns;
+
+import java.sql.SQLException;
+import java.sql.Types;
+
+/**
+ * Column information for normal integer columns, integer columns report as
+ * {@link Types#INTEGER} for JDBC purposes because some of the XML Schema integer types
+ * equate to integer
+ * 
+ */
+public class IntegerColumn extends NumericColumn {
+
+    /**
+     * Creates new integer column information
+     * @param label Label
+     * @param nullable Nullability
+     * @param signed Whether the integer is signed
+     * @throws SQLException
+     */
+    public IntegerColumn(String label, int nullable, boolean signed) throws SQLException {
+        super(label, Types.INTEGER, nullable, Integer.class, 0, Integer.toString(Integer.MAX_VALUE).length(), signed);
+    }
+
+}

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ShortIntegerColumn.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ShortIntegerColumn.java?rev=1470749&r1=1470748&r2=1470749&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ShortIntegerColumn.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ShortIntegerColumn.java Mon Apr 22 23:07:22 2013
@@ -22,22 +22,26 @@ import java.sql.SQLException;
 import java.sql.Types;
 
 /**
- * Column information for short integer columns, integer columns report as
- * {@link Types#INTEGER} for JDBC purposes because some of the XML Schema integer types
- * equate to integer
+ * Column information for short integer columns, note that no XSD types directly
+ * correspond to a {@link Types#SMALLINT} so this is not really used but merely
+ * provided for completeness.
  * 
  */
 public class ShortIntegerColumn extends NumericColumn {
 
     /**
      * Creates new integer column information
-     * @param label Label
-     * @param nullable Nullability
-     * @param signed Whether the integer is signed
+     * 
+     * @param label
+     *            Label
+     * @param nullable
+     *            Nullability
+     * @param signed
+     *            Whether the integer is signed
      * @throws SQLException
      */
     public ShortIntegerColumn(String label, int nullable, boolean signed) throws SQLException {
-        super(label, Types.INTEGER, nullable, Integer.class, 0, Integer.toString(Integer.MAX_VALUE).length(), signed);
+        super(label, Types.SMALLINT, nullable, Short.class, 0, Short.toString(Short.MAX_VALUE).length(), signed);
     }
 
 }