Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

16.2.7 ResultSetMetaData class

Organization of this subsection
(1) Overview
(2) Details of method

(1) Overview

The ResultSetMetaData class provides the following functions:

(2) Details of method

(a) isSearchable (int column) method

true is returned if the column specified by the column parameter can be used for the WHERE clause; otherwise, false is returned as the return value. In the case of the WHERE clause, true is always returned to enable use of all data type columns. However, for the first column of ResultSet, which is the return value of the Array.getResultSet method, false is returned. For details about getResultSet, see 16.6 Array class.

Example:
Column C1 is in table T1. Regardless of its data type, C1 can be used in the WHERE clause as shown below:
SELECT * FROM T1 WHERE LENGTH (C1) > 5
 
(b) getColumnDisplaySize (int column) method

The return value is the maximum number of characters when the column specified by the column parameter is expressed in a character string. However, for the first column of ResultSet, which is the return value of the Array.getResultSet method, 10 is returned. Table 16-4 lists the return values for this method for each SQL data type in HiRDB.

Table 16-4 Return values of the getColumnDisplaySize method for each SQL data type in HiRDB

SQL data type in HiRDB Return value (int) Return value format
INTEGER 11 1 sign character + 10 digits, which is the maximum number of digits
SMALLINT 6 1 sign character + 5 digits, which is the maximum number of digits
DECIMAL(m,n)
NUMERIC(m,n)
  • m: Accuracy (total number of digits)
  • n: Decimal scaling position (number of digits after decimal point)
m + 2 1 sign character + accuracy m + 1 decimal point digit
FLOAT
DOUBLE PRECISION
23 1 sign character + 17 digits, which is the maximum number of significant digits + 1 decimal point character + 4, which is the maximum number of characters in the index area
SMALLFLT
REAL
13 1 sign character + 8 digits, which is the maximum number of significant digits + 1 decimal point character + 3, which is the maximum number of characters in the index area
CHAR(n)
  • n: Number of bytes of the definition length
n NA
VARCHAR(n)
CHAR VARYING(n)
  • n: Number of bytes of the maximum length
n NA
NCHAR(n)
NATIONAL CHAR(n)
  • n: Number of characters of the definition length
n NA
NVARCHAR(n)
NATIONAL CHAR VARYING(n)
NCHAR VARYING(n)
  • n: Number of characters of the maximum length
n NA
MCHAR(n)
  • n: Number of bytes of the maximum length
n NA
MVARCHAR(n)
  • n: Number of bytes of the maximum length
n NA
DATE 10 yyyy-mm-dd, which is 10 characters
TIME 8 hh:mm:ss, which is 8 characters
TIMESTAMP(p)
  • p: Number of digits of the fractional part of the second

(1) When p is 0:
19

(2) When p is 2, 4, or 6:
20 + p
(1) yyyy-mm-dd hh:mm:ss, which is 19 characters
(2) 19 characters shown above + 1 decimal point character + p, which is the number of digits of the decimal part
BLOB(n[K|M|G])
  • n: Maximum length
  • K: Kilobytes
  • M: Megabytes
  • G: Gigabytes
If the unit is omitted, bytes is assumed.

When the unit specification is omitted:
n

When K is specified for the unit:
n x 1024*

When M is specified for the unit:
n x 1024 x 1024*

When M is specified for the unit:
n x 1024 x 1024 x 1024#
NA
BINARY(n)
  • n: Number of bytes of the maximum length.
N NA

Legend:
NA: Not applicable.

* Calculation result 2147483648 becomes 2147483647.