Hitachi

Hitachi Advanced Database Application Development Guide


8.7.5 getColumnDisplaySize(int column)

Organization of this subsection

(1) Function

This method acquires a specified column's maximum width (in characters).

(2) Format

public synchronized int getColumnDisplaySize(int column) throws SQLException

(3) Arguments

int column

Specifies a column number (where the first column is 1).

(4) Return value

The method returns the maximum width in characters. The following table shows the return values of the getColumnDisplaySize method.

Table 8‒72: Return values of the getColumnDisplaySize method

Column's data type (HADB data type)

Return value (maximum number of characters)

INTEGER

20

SMALLINT

11

6#1

DOUBLE PRECISION

23

DECIMAL(m,n)

m + 2

CHAR(n)

VARCHAR(n)

n

DATE

10

TIME(p)

p = 0: 8

p > 0: 8 + (n + 1)

TIMESTAMP(p)

p = 0: 19

p > 0: 19 + (n + 1)

BINARY(n)

VARBINARY(n)

n × 2

ROW

row-length#2

BOOLEAN (column found only in a ResultSet created from DatabaseMetaData)

5

#1

This column is found only in a ResultSet created from DatabaseMetaData. If the column's data type is defined as short, this value is returned.

#2

Sum of the data lengths of all columns. For details about how to obtain a column's data length, see the topic List of data types in the manual HADB SQL Reference.

(5) Exceptions

If the specified column value is 0 or less, or is greater than the number of columns in the table, the JDBC driver throws an SQLException.