package com.sybase.jaguar.sql; public interface JServerResultSetMetaData extends ResultSetMetaData
Provides methods to describe a result set’s metadata. Metadata specifies the number of columns in each row as well as the datatype, format, nullability, and so forth for each column.
The JContext.createServerResultSetMetaData() method returns a class instance that implements this interface.
setAutoIncrement(int, boolean) – (Not yet supported.) Specifies whether a column has the auto-increment property.
setCaseSensitive(int, String) – (Not yet supported.) Specifies whether a column’s values are case-sensitive.
setCatalogName(int, String) – (Not yet supported.) Specifies the name of the column’s catalog (database).
setColumnCount(int) – Specifies the number of columns that will be sent in result-set rows.
setColumnDisplaySize(int, int) – Specifies the column’s normal maximum width in characters.
setColumnLabel(int, String) – Recommends a display title for the column.
setColumnName(int, String) – Specifies the column’s name.
setColumnType(int, int) – Specifies the column’s SQL (java.sql.Types) datatype.
setColumnTypeName(int, String) – (Not yet supported.) Specifies a column’s data-source-specific type name.
setCurrency(int, boolean) – Specifies whether the column represents a cash value.
setNullable(int, int) – Specifies whether column values can be null.
setPrecision(int, int) – Specifies the column’s precision. The precision equals the number of decimal digits in a value.
setScale(int, int) – Specifies the column’s scale. The scale equals the number of decimal digits to the right of the decimal point.
setSchemaName(int, String) – (Not yet supported.) Specifies the schema name of the column’s table.
setSearchable(int, boolean) – (Not yet supported.) Specifies whether a column can be used in a SQL where clause.
setSigned(int, boolean) – (Not yet supported.) Specifies whether the column represents a signed number.
setTableName(int, String) – (Not yet supported.) Specifies the name of the table that contains the column.
Note The current version does not support some interface methods. The list above indicates the methods that are not yet supported. These methods throw a JException with a “Unsupported Functionality” message.
JServerResultSetMetaData provides set methods that correspond to the get methods defined in java.sql.ResultSetMetaData. Since JServerResultSetMetaData extends ResultSetMetaData, you can call the get methods directly on a JServerResultSetMetaData object.
You can use an initialized JServerResultSetMetaData object to create one or more JServerResultSet objects by calling JContext.createServerResultSet(JServerResultSetMetaData).
“Sending result sets with Java” in the EAServer Programmer’s Guide summarizes the call sequences to send result sets and contains an example.
java.sql.ResultSetMetaData
Specifies the number of columns that will be sent in result-set rows.
Package |
|
Interface |
public abstract void setColumnCount(int columnCount) throws SQLException
The number of columns.
You must call setColumnCount() before you can call any other methods to describe an individual column’s metadata. Once the number of columns is specified, it cannot be changed without discarding any column descriptions that you have set. That is, if you call setColumnCount() again, you must reset each column’s metadata.
ResultSetMetaData.getColumnCount()
Specifies the column’s normal maximum width in characters.
Package |
|
Interface |
public abstract void setColumnDisplaySize (int columnIndx, int size) throws SQLException
The index of the column. The first column has index 1.
The maximum width in characters.
setColumnDisplaySize determines the maximum length of variable length columns (CHAR, VARCHAR, LONGVARCHAR, BINARY, VARBINARY, LONGVARBINARY).
If you do not call setColumnDisplaySize to set a default display size, the implementation-specific default is used. To avoid excessive memory allocation, you must explicitly set the display size. In particular, the default display sizes for LONGVARCHAR and LONGVARBINARY columns can be larger than a Gigabyte.
ResultSetMetaData.getColumnDisplaySize(int)
Recommends a display title for the column.
Package |
|
Interface |
public abstract void setColumnLabel (int columnIndex, String label) throws SQLException
The index of the column. The first column has index 1.
The recommended display title. The default is the column name specified with setColumnName(int, String).
ResultSetMetaData.getColumnLabel(int), setColumnName(int, String)
Specifies the column’s name.
Package |
|
Interface |
public abstract void setColumnName (int columnIndex, String columnName) throws SQLException
The index of the column. The first column has index 1.
The name of the column. The default is “” (0-length string).
ResultSetMetaData.getColumnName(int)
Specifies the column’s SQL (java.sql.Types) datatype.
Package |
|
Interface |
public abstract void setColumnType (int columnIndex, int SQLType) throws SQLException
The index of the column. The first column has index 1.
A symbolic constant that indicates the column’s Java datatype. Constants are defined statically in the class java.sql.Types. The table below lists the supported java.sql.Types and lists, for each type, the corresponding Java type and the JServerResultSet.set<Object>(int, <Object>) method that must be called to set values for the column.
java.sql.Types constant |
Java datatype |
JServerResultSet method to set values |
---|---|---|
BINARY |
byte[] |
setBinaryStream or setBytes |
BIT |
boolean |
setBoolean |
CHAR |
java.lang.String |
setASCIIStream or setString |
DECIMAL |
java.math.BigDecimal |
setBigDecimal |
DOUBLE |
double |
setDouble |
FLOAT |
double |
setDouble |
INTEGER |
int |
setInt |
LONGVARBINARY |
java.io.InputStream or byte[] |
setBinaryStream or setBytes |
LONGVARCHAR |
String |
setASCIIStream or setString |
NUMERIC |
java.math.BigDecimal |
setBigDecimal |
REAL |
float |
setFloat |
SMALLINT |
short |
setShort |
TIMESTAMP |
java.sql.Timestamp |
setTimestamp |
TINYINT |
byte |
setByte |
VARCHAR |
java.lang.String |
setString |
VARBINARY |
byte[] |
setBytes |
setColumnType(int, int) specifies the datatype for a column. There is no default. For java.math.BigDecimal columns, you must also call setPrecision(int, int) and setScale(int, int) to specify the column’s precision and scale, respectively.
For columns that represent cash values, you must use JServerResultSet.setCurrency(int, long) to set values for the column.
java.sql.Types, ResultSetMetaData.getColumnType(int), setPrecision(int, int), setScale(int, int)
Specifies whether the column represents a cash value.
Package |
|
Interface |
public abstract void setCurrency (int columnIndex, boolean property) throws SQLException
The index of the column. The first column has index 1.
true
if the
column represents a cash value, false
otherwise.
The default is false
.
ResultSetMetaData.isCurrency(int)
Specifies whether column values can be null.
Package |
|
Interface |
public abstract void setNullable (int columnIndex, int property) throws SQLException
The index of the column. The first column has index 1.
A symbolic constant that takes the following values:
Value |
To indicate |
---|---|
columnNullable |
Values for the column can be null. |
columnNoNulls |
Values for the column cannot be null. |
columnNullableUnknown |
Nullability of the column is not known. |
The default is columnNullableUnknown.
JServerResultSet.setNull(int), ResultSetMetaData.isNullable(int)
Specifies the column’s precision. The precision equals the number of decimal digits in a value.
Package |
|
Interface |
public abstract void setPrecision (int columnIndex, int precision) throws SQLException
The index of the column. The first column has index 1.
The precision of the column. The default is 0.
This method applies to java.math.BigDecimal columns only.
ResultSetMetaData.getPrecision(int), setScale(int, int)
Specifies the column’s scale. The scale equals the number of decimal digits to the right of the decimal point.
Package |
|
Interface |
public abstract void setScale (int columnIndex, int scale) throws SQLException
The index of the column. The first column has index 1.
The scale for the column. The default is 0.
This method applies to java.math.BigDecimal columns only.
ResultSetMetaData.getScale(int), setPrecision(int, int)
Copyright © 2005. Sybase Inc. All rights reserved. |