xxl.relational
Class Projection

java.lang.Object
  |
  +--xxl.relational.AbstractResultSet
        |
        +--xxl.relational.Projection

public class Projection
extends AbstractResultSet

The operator for projection (without duplicate removal).
For each tuple of the given resultSet a new tuple will be computed. This technique includes e.g. renaming functionality.

Examples:


	new Projection(new String[]{"name", "birth year"}, resultSet);
	
creates a projection on the columns "name" and "birth year" as expected.

	new Projection(new String[]{"name"}, new String[]{"last name"}, resultSet);
	
realizes a column renaming. The column "name" of the given resultSet is renamed to "last name" in the output ResultSet.


More formally:
A projection is a Function with the following syntax:


	projection.invoke()
	
returns the metadata for the output ResultSet (as java.sql.ResultSetMetaData)

	projection.invoke((Object) columnName)
	
maps the given columnName to its column index and returns it (as java.lang.Integer)

	projection.invoke((Object) columnIndex, (Object) tuple)
	
computes from the given tuple the new tuple and returns the value of column columnIndex.


Field Summary
protected  Function projection
           
protected  java.sql.ResultSet resultSet
           
protected  Tuple tuple
           
protected  boolean wasNull
           
 
Constructor Summary
Projection(Function projection, java.sql.ResultSet resultSet)
           
Projection(int[] columnIndexes, int[] columnIndexesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
Projection(int[] columnIndexes, java.sql.ResultSet resultSet)
           
Projection(int[] columnIndexesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
Projection(int[] columnIndexes, java.lang.String[] columnNamesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
Projection(java.lang.String[] columnNames, int[] columnIndexesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
Projection(java.lang.String[] columnNames, java.sql.ResultSet resultSet)
           
Projection(java.lang.String[] columnNamesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
Projection(java.lang.String[] columnNames, java.lang.String[] columnNamesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
 
Method Summary
 void close()
           
protected  Function createProjection(int[] columnIndexes, int[] columnIndexesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
protected  Function createProjection(int[] columnIndexes, java.lang.String[] columnNames, java.sql.ResultSet resultSet)
           
protected  Function createProjection(int[] columnIndexes, java.lang.String[] columnNamesToRename, java.lang.String[] newNames, java.sql.ResultSet resultSet)
           
 int findColumn(java.lang.String columnName)
           
 byte[] getBytes(int columnIndex)
           
 java.sql.ResultSetMetaData getMetaData()
           
 java.lang.Object getObject(int columnIndex)
           
 boolean next()
           
 boolean wasNull()
           
 
Methods inherited from class xxl.relational.AbstractResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getColumnCount, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultSet

protected java.sql.ResultSet resultSet

projection

protected Function projection

tuple

protected Tuple tuple

wasNull

protected boolean wasNull
Constructor Detail

Projection

public Projection(Function projection,
                  java.sql.ResultSet resultSet)

Projection

public Projection(int[] columnIndexes,
                  java.sql.ResultSet resultSet)

Projection

public Projection(java.lang.String[] columnNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(int[] columnIndexesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(java.lang.String[] columnNamesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(int[] columnIndexes,
                  int[] columnIndexesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(int[] columnIndexes,
                  java.lang.String[] columnNamesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(java.lang.String[] columnNames,
                  int[] columnIndexesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)

Projection

public Projection(java.lang.String[] columnNames,
                  java.lang.String[] columnNamesToRename,
                  java.lang.String[] newNames,
                  java.sql.ResultSet resultSet)
Method Detail

createProjection

protected Function createProjection(int[] columnIndexes,
                                    int[] columnIndexesToRename,
                                    java.lang.String[] newNames,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException

createProjection

protected Function createProjection(int[] columnIndexes,
                                    java.lang.String[] columnNamesToRename,
                                    java.lang.String[] newNames,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException

createProjection

protected Function createProjection(int[] columnIndexes,
                                    java.lang.String[] columnNames,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException

next

public boolean next()
             throws java.sql.SQLException
Overrides:
next in class AbstractResultSet

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
Overrides:
getMetaData in class AbstractResultSet

findColumn

public int findColumn(java.lang.String columnName)
               throws java.sql.SQLException
Overrides:
findColumn in class AbstractResultSet

getObject

public java.lang.Object getObject(int columnIndex)
                           throws java.sql.SQLException
Overrides:
getObject in class AbstractResultSet

getBytes

public byte[] getBytes(int columnIndex)
                throws java.sql.SQLException
Overrides:
getBytes in class AbstractResultSet

wasNull

public boolean wasNull()
                throws java.sql.SQLException
Overrides:
wasNull in class AbstractResultSet

close

public void close()
           throws java.sql.SQLException
Overrides:
close in class AbstractResultSet