Class GenericResultDescription
java.lang.Object
org.apache.derby.impl.sql.GenericResultDescription
- All Implemented Interfaces:
Externalizable, Serializable, Formatable, TypedFormat, ResultDescription
GenericResultDescription: basic implementation of result
description, used in conjunction with the other
implementations in this package. This implementation
of ResultDescription may be used by anyone.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionA map which maps a column name to a column number.private ResultColumnDescriptor[]This class implements Formatable.private ResultSetMetaDataSaved JDBC ResultSetMetaData object.private String -
Constructor Summary
ConstructorsConstructorDescriptionNiladic constructor for FormatableGenericResultDescription(ResultColumnDescriptor[] columns, String statementType) Build a GenericResultDescription from columns and typeGenericResultDescription(ResultDescription rd, int[] theCols) Build a GenericResultDescription -
Method Summary
Modifier and TypeMethodDescriptionintfindColumnInsenstive(String columnName) Find a column name based upon the JDBC rules for getXXX and setXXX.intReturns the number of columns in the result set.getColumnDescriptor(int position) position is 1-based.Return information about all the columns.getColumnInfo(int idx) Return the information about a single column (0-based indexing)Get the saved meta data.Returns an identifier that tells what type of statement has been executed.intGet the formatID which corresponds to this class.voidRead this object from a stream of stored objects.voidsetMetaData(ResultSetMetaData rsmd) Set the meta data if it has not already been set.toString()truncateColumns(int truncateFrom) Get a new result description that has been truncated from input column number.voidWrite this object out
-
Field Details
-
columns
This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method. -
statementType
-
metaData
-
columnNameMap
-
-
Constructor Details
-
GenericResultDescription
public GenericResultDescription()Niladic constructor for Formatable -
GenericResultDescription
Build a GenericResultDescription from columns and type- Parameters:
columns- an array of col descriptorsstatementType- the type
-
GenericResultDescription
Build a GenericResultDescription- Parameters:
rd- the result descriptiontheCols- the columns to take from the input rd
-
-
Method Details
-
getStatementType
Description copied from interface:ResultDescriptionReturns an identifier that tells what type of statement has been executed. This can be used to determine what other methods to call to get the results back from a statement. For example, a SELECT statement returns rows and columns, while other statements don't, so you would only call getColumnCount() or getColumnType() for SELECT statements.- Specified by:
getStatementTypein interfaceResultDescription- Returns:
- A String identifier telling what type of statement this is.
- See Also:
-
getColumnCount
public int getColumnCount()Description copied from interface:ResultDescriptionReturns the number of columns in the result set.- Specified by:
getColumnCountin interfaceResultDescription- Returns:
- The number of columns in the result set.
- See Also:
-
getColumnInfo
Description copied from interface:ResultDescriptionReturn information about all the columns.- Specified by:
getColumnInfoin interfaceResultDescription
-
getColumnInfo
Description copied from interface:ResultDescriptionReturn the information about a single column (0-based indexing)- Specified by:
getColumnInfoin interfaceResultDescription
-
getColumnDescriptor
position is 1-based.- Specified by:
getColumnDescriptorin interfaceResultDescription- Parameters:
position- The oridinal position of a column in the ResultSet.- Returns:
- A ResultColumnDescriptor describing the column in the ResultSet.
- See Also:
-
truncateColumns
Get a new result description that has been truncated from input column number. If the input column is 5, then columns 5 to getColumnCount() are removed. The new ResultDescription points to the same ColumnDescriptors (this method performs a shallow copy.- Specified by:
truncateColumnsin interfaceResultDescription- Parameters:
truncateFrom- the starting column to remove- Returns:
- a new ResultDescription
-
writeExternal
Write this object out- Specified by:
writeExternalin interfaceExternalizable- Parameters:
out- write bytes here- Throws:
IOException- thrown on error
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternalin interfaceExternalizable- Parameters:
in- read this.- Throws:
IOException- thrown on errorClassNotFoundException- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Returns:
- the formatID of this class
-
toString
-
setMetaData
Set the meta data if it has not already been set.- Specified by:
setMetaDatain interfaceResultDescription
-
getMetaData
Get the saved meta data.- Specified by:
getMetaDatain interfaceResultDescription
-
findColumnInsenstive
Find a column name based upon the JDBC rules for getXXX and setXXX. Name matching is case-insensitive, matching the first name (1-based) if there are multiple columns that map to the same name.- Specified by:
findColumnInsenstivein interfaceResultDescription- Parameters:
columnName-- Returns:
- Position of the column (1-based), -1 if no match.
-