Chapter 1 Java Classes and Interfaces
package com.sybase.jaguar.sql;public class 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.
No public constructors. Call JContext.createServerResultSetMetaData().
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 Jaguar CTS Programmer's Guide summarizes the call sequences to send result sets and contains an example.
Note
The current release does not support all the interface methods.
The list above indicates the methods that are not yet supported.
These methods throw a JException with a "Unsupported
Functionality:" message.
java.sql.ResultSetMetaData
Specify the number of columns that will be sent in result set rows.
Package |
|
Interface |
public abstract void setColumnCount(int columnCount)
throws SQLException
columnCount
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()
Specify the column's normal maximum width in characters.
Package |
|
Interface |
public abstract void setColumnDisplaySize
(int columnIndx, int size)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
size
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)
Recommend a display title for the column.
Package |
|
Interface |
public abstract void setColumnLabel
(int columnIndex, String label)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
label
The recommended display title. The default is the column name specified with setColumnName(int, String).
ResultSetMetaData.getColumnLabel(int), setColumnName(int, String)
Specify the column's name.
Package |
|
Interface |
public abstract void setColumnName
(int columnIndex, String columnName)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
columnName
The name of the column. The default is "" (0-length string).
ResultSetMetaData.getColumnName(int)
Specify the column's SQL (java.sql.Types) datatype.
Package |
|
Interface |
public abstract void setColumnType
(int columnIndex, int SQLType)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
SQLType
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.
Note
java.sql.Types.OTHER and java.sql.Types.BIGINT are
not supported.
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)
Specify whether the column represents a cash value.
Package |
|
Interface |
public abstract void setCurrency
(int columnIndex, boolean property)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
property
true
if the
column represents a cash value, false
otherwise.
The default is false
.
ResultSetMetaData.isCurrency(int)
Specify whether column values can be null.
Package |
|
Interface |
public abstract void setNullable
(int columnIndex, int property)
throws SQLException
columnIndex
The index of the column. The first column has index 1.
property
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)
Specify 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
columnIndex
The index of the column. The first column has index 1.
precision
The precision of the column. The default is 0.
This method applies to java.math.BigDecimal columns only.
ResultSetMetaData.getPrecision(int), setScale(int, int)
Specify 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
columnIndex
The index of the column. The first column has index 1.
scale
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 © 2000 Sybase, Inc. All rights reserved. |
![]() |