jaguar.sql.JServerResultSet interface  jaguar.util.JException class

Chapter 1: Java Classes and Interfaces

jaguar.sql.JServerResultSetMetaData interface

Description

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.

Constructors

The JContext.createServerResultSetMetaData() method returns a class instance that implements this interface.

Methods

NoteNote 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.

Usage

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.

See also

java.sql.ResultSetMetaData




JServerResultSetMetaData.setColumnCount(int)

Description

Specifies the number of columns that will be sent in result-set rows.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setColumnCount(int columnCount)
    throws SQLException 

Parameters

columnCount

The number of columns.

Usage

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.

See also

ResultSetMetaData.getColumnCount()




JServerResultSetMetaData.setColumnDisplaySize(int, int)

Description

Specifies the column’s normal maximum width in characters.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setColumnDisplaySize
    (int columnIndx, int size)
    throws SQLException

Parameters

columnIndex

The index of the column. The first column has index 1.

size

The maximum width in characters.

Usage

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.

See also

ResultSetMetaData.getColumnDisplaySize(int)




JServerResultSetMetaData.setColumnLabel(int, String)

Description

Recommends a display title for the column.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setColumnLabel
    (int columnIndex, String label)
    throws SQLException 

Parameters

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).

See also

ResultSetMetaData.getColumnLabel(int), setColumnName(int, String)




JServerResultSetMetaData.setColumnName(int, String)

Description

Specifies the column’s name.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setColumnName
    (int columnIndex, String columnName)
    throws SQLException 

Parameters

columnIndex

The index of the column. The first column has index 1.

columnName

The name of the column. The default is “” (0-length string).

See also

ResultSetMetaData.getColumnName(int)




JServerResultSetMetaData.setColumnType(int, int)

Description

Specifies the column’s SQL (java.sql.Types) datatype.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setColumnType
    (int columnIndex, int SQLType) 
    throws SQLException 

Parameters

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.

Table 1-1: Mapping type constants to Java types and setXXX methods

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

NoteNote java.sql.Types.OTHER and java.sql.Types.BIGINT are not supported.

Usage

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.

See also

java.sql.Types, ResultSetMetaData.getColumnType(int), setPrecision(int, int), setScale(int, int)




JServerResultSetMetaData.setCurrency(int, boolean)

Description

Specifies whether the column represents a cash value.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void  setCurrency
    (int columnIndex, boolean property)
    throws SQLException 

Parameters

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.

See also

ResultSetMetaData.isCurrency(int)




JServerResultSetMetaData.setNullable(int, int)

Description

Specifies whether column values can be null.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setNullable
    (int columnIndex, int property)
    throws SQLException 

Parameters

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.

See also

JServerResultSet.setNull(int), ResultSetMetaData.isNullable(int)




JServerResultSetMetaData.setPrecision(int, int)

Description

Specifies the column’s precision. The precision equals the number of decimal digits in a value.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setPrecision
    (int columnIndex, int precision) 
    throws SQLException 

Parameters

columnIndex

The index of the column. The first column has index 1.

precision

The precision of the column. The default is 0.

Usage

This method applies to java.math.BigDecimal columns only.

See also

ResultSetMetaData.getPrecision(int), setScale(int, int)




JServerResultSetMetaData.setScale(int, int)

Description

Specifies the column’s scale. The scale equals the number of decimal digits to the right of the decimal point.

Syntax

Package

com.sybase.jaguar.sql

Interface

JServerResultSetMetaData

public abstract void setScale
    (int columnIndex, int scale) 
    throws SQLException 

Parameters

columnIndex

The index of the column. The first column has index 1.

scale

The scale for the column. The default is 0.

Usage

This method applies to java.math.BigDecimal columns only.

See also

ResultSetMetaData.getScale(int), setPrecision(int, int)





Copyright © 2005. Sybase Inc. All rights reserved. jaguar.util.JException class