org.apache.derby.vti
Class StringColumnVTI

java.lang.Object
  extended by org.apache.derby.vti.VTITemplateBase
      extended by org.apache.derby.vti.VTITemplate
          extended by org.apache.derby.vti.StringColumnVTI
All Implemented Interfaces:
java.sql.ResultSet, java.sql.Wrapper

public abstract class StringColumnVTI
extends VTITemplate

This is an abstract table function which assumes that all columns are strings and which coerces the strings to reasonable values for various getXXX() methods. Subclasses must implement the following ResultSet methods:

and the following protected method introduced by this class:


Field Summary
private  java.lang.String[] _columnNames
           
private  boolean _lastColumnWasNull
           
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Constructor Summary
StringColumnVTI(java.lang.String[] columnNames)
           Build a StringColumnVTI with the given column names
 
Method Summary
private  void checkNull(java.lang.String columnValue)
           Set the wasNull flag based on whether this column value turned out to be null.
 int findColumn(java.lang.String columnName)
           
 java.io.InputStream getAsciiStream(int columnIndex)
           
 java.math.BigDecimal getBigDecimal(int columnIndex)
           
 java.io.InputStream getBinaryStream(int columnIndex)
           
 java.sql.Blob getBlob(int columnIndex)
           
 boolean getBoolean(int columnIndex)
           
 byte getByte(int columnIndex)
           
 byte[] getBytes(int columnIndex)
           
 java.sql.Clob getClob(int columnIndex)
           
 int getColumnCount()
           Get the number of columns.
 java.lang.String getColumnName(int columnNumber)
           Get name of a column (1-based indexing).
 java.sql.Date getDate(int columnIndex)
           
 double getDouble(int columnIndex)
           
private  java.io.InputStream getEncodedStream(java.lang.String columnValue, java.lang.String encoding)
           Turn a string into an appropriately encoded ByteArrayInputStream.
 float getFloat(int columnIndex)
           
 int getInt(int columnIndex)
           
 long getLong(int columnIndex)
           
protected abstract  java.lang.String getRawColumn(int columnNumber)
           Get the string value of the column in the current row identified by the 1-based columnNumber.
 short getShort(int columnIndex)
           
 java.lang.String getString(int columnIndex)
           
 java.sql.Time getTime(int columnIndex)
           
 java.sql.Timestamp getTimestamp(int columnIndex)
           
private  long parseDateTime(java.lang.String columnValue)
           Translate a date/time expression into the corresponding long number of milliseconds.
 boolean wasNull()
           
private  java.sql.SQLException wrap(java.lang.Throwable t)
           Wrap an exception in a SQLException.
 
Methods inherited from class org.apache.derby.vti.VTITemplate
close, getBigDecimal, getBigDecimal, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getObject, getShort, getString, getTime, getTimestamp, next
 
Methods inherited from class org.apache.derby.vti.VTITemplateBase
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, first, getArray, getArray, getAsciiStream, getBigDecimal, getBinaryStream, getBlob, getCharacterStream, getCharacterStream, getClob, getConcurrency, getCursorName, getDate, getDate, getFetchDirection, getFetchSize, getMetaData, getObject, getObject, getObject, getRef, getRef, getRow, getStatement, getTime, getTime, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, notImplemented, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, 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
 
Methods inherited from interface java.sql.ResultSet
getHoldability, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getRowId, getRowId, getSQLXML, getSQLXML, isClosed, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateRowId, updateRowId, updateSQLXML, updateSQLXML
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

_columnNames

private java.lang.String[] _columnNames

_lastColumnWasNull

private boolean _lastColumnWasNull
Constructor Detail

StringColumnVTI

public StringColumnVTI(java.lang.String[] columnNames)

Build a StringColumnVTI with the given column names

Method Detail

getRawColumn

protected abstract java.lang.String getRawColumn(int columnNumber)
                                          throws java.sql.SQLException

Get the string value of the column in the current row identified by the 1-based columnNumber.

Throws:
java.sql.SQLException

getColumnCount

public int getColumnCount()

Get the number of columns.


getColumnName

public java.lang.String getColumnName(int columnNumber)

Get name of a column (1-based indexing).


wasNull

public boolean wasNull()
                throws java.sql.SQLException
Specified by:
wasNull in interface java.sql.ResultSet
Overrides:
wasNull in class VTITemplateBase
Throws:
java.sql.SQLException

findColumn

public int findColumn(java.lang.String columnName)
               throws java.sql.SQLException
Specified by:
findColumn in interface java.sql.ResultSet
Overrides:
findColumn in class VTITemplateBase
Throws:
java.sql.SQLException

getString

public java.lang.String getString(int columnIndex)
                           throws java.sql.SQLException
Specified by:
getString in interface java.sql.ResultSet
Overrides:
getString in class VTITemplateBase
Throws:
java.sql.SQLException

getBoolean

public boolean getBoolean(int columnIndex)
                   throws java.sql.SQLException
Specified by:
getBoolean in interface java.sql.ResultSet
Overrides:
getBoolean in class VTITemplateBase
Throws:
java.sql.SQLException

getByte

public byte getByte(int columnIndex)
             throws java.sql.SQLException
Specified by:
getByte in interface java.sql.ResultSet
Overrides:
getByte in class VTITemplateBase
Throws:
java.sql.SQLException

getShort

public short getShort(int columnIndex)
               throws java.sql.SQLException
Specified by:
getShort in interface java.sql.ResultSet
Overrides:
getShort in class VTITemplateBase
Throws:
java.sql.SQLException

getInt

public int getInt(int columnIndex)
           throws java.sql.SQLException
Specified by:
getInt in interface java.sql.ResultSet
Overrides:
getInt in class VTITemplateBase
Throws:
java.sql.SQLException

getLong

public long getLong(int columnIndex)
             throws java.sql.SQLException
Specified by:
getLong in interface java.sql.ResultSet
Overrides:
getLong in class VTITemplateBase
Throws:
java.sql.SQLException

getFloat

public float getFloat(int columnIndex)
               throws java.sql.SQLException
Specified by:
getFloat in interface java.sql.ResultSet
Overrides:
getFloat in class VTITemplateBase
Throws:
java.sql.SQLException

getDouble

public double getDouble(int columnIndex)
                 throws java.sql.SQLException
Specified by:
getDouble in interface java.sql.ResultSet
Overrides:
getDouble in class VTITemplateBase
Throws:
java.sql.SQLException

getBigDecimal

public java.math.BigDecimal getBigDecimal(int columnIndex)
                                   throws java.sql.SQLException
Specified by:
getBigDecimal in interface java.sql.ResultSet
Overrides:
getBigDecimal in class VTITemplateBase
Throws:
java.sql.SQLException

getBytes

public byte[] getBytes(int columnIndex)
                throws java.sql.SQLException
Specified by:
getBytes in interface java.sql.ResultSet
Overrides:
getBytes in class VTITemplateBase
Throws:
java.sql.SQLException

getDate

public java.sql.Date getDate(int columnIndex)
                      throws java.sql.SQLException
Specified by:
getDate in interface java.sql.ResultSet
Overrides:
getDate in class VTITemplateBase
Throws:
java.sql.SQLException

getTime

public java.sql.Time getTime(int columnIndex)
                      throws java.sql.SQLException
Specified by:
getTime in interface java.sql.ResultSet
Overrides:
getTime in class VTITemplateBase
Throws:
java.sql.SQLException

getTimestamp

public java.sql.Timestamp getTimestamp(int columnIndex)
                                throws java.sql.SQLException
Specified by:
getTimestamp in interface java.sql.ResultSet
Overrides:
getTimestamp in class VTITemplateBase
Throws:
java.sql.SQLException

getAsciiStream

public java.io.InputStream getAsciiStream(int columnIndex)
                                   throws java.sql.SQLException
Specified by:
getAsciiStream in interface java.sql.ResultSet
Overrides:
getAsciiStream in class VTITemplateBase
Throws:
java.sql.SQLException

getBinaryStream

public java.io.InputStream getBinaryStream(int columnIndex)
                                    throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.ResultSet
Overrides:
getBinaryStream in class VTITemplateBase
Throws:
java.sql.SQLException

getBlob

public java.sql.Blob getBlob(int columnIndex)
                      throws java.sql.SQLException
Specified by:
getBlob in interface java.sql.ResultSet
Overrides:
getBlob in class VTITemplateBase
Throws:
java.sql.SQLException

getClob

public java.sql.Clob getClob(int columnIndex)
                      throws java.sql.SQLException
Specified by:
getClob in interface java.sql.ResultSet
Overrides:
getClob in class VTITemplateBase
Throws:
java.sql.SQLException

checkNull

private void checkNull(java.lang.String columnValue)

Set the wasNull flag based on whether this column value turned out to be null.


wrap

private java.sql.SQLException wrap(java.lang.Throwable t)

Wrap an exception in a SQLException.


parseDateTime

private long parseDateTime(java.lang.String columnValue)
                    throws java.sql.SQLException

Translate a date/time expression into the corresponding long number of milliseconds.

Throws:
java.sql.SQLException

getEncodedStream

private java.io.InputStream getEncodedStream(java.lang.String columnValue,
                                             java.lang.String encoding)
                                      throws java.sql.SQLException

Turn a string into an appropriately encoded ByteArrayInputStream.

Throws:
java.sql.SQLException

Built on Wed 2013-06-12 15:21:56+0000, from revision ???

Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.