Hitachi

Hitachi Advanced Database Application Development Guide


16.6.2 SQLGetDescRec, SQLGetDescRecW

Organization of this subsection

(1) Function

This ODBC function returns the current settings or values of multiple fields of a descriptor record specified in the arguments. This function returns the fields that describe the name, data type, and storage of column or parameter data.

(2) Format

(3) Arguments

DescriptorHandle

Specifies a descriptor handle.

RecNumber

Specifies a column number (ARD or IRD) or a parameter number (APD or IPD).

Name

Specifies a pointer to the buffer in which the SQL_DESC_NAME field value in the descriptor record is to be returned.

BufferLength

Specifies the length# of the *Name buffer.

This length includes the null terminating character. SQL_NTS cannot be specified.

StringLengthPtr

Specifies a pointer to the buffer that stores the valid length# of the data that is returned to the *Name buffer. This length does not include the null terminating character.

Important

If the length# of *Name stored here is greater than the value of BufferLength without the length# of the null terminating character, the character string stored in *Name is truncated to the length# equivalent to BufferLength without the null terminating character, and then the null terminating character is added at the end.

#

The length must be in bytes for SQLGetDescRec and in characters for SQLGetDescRecW.

TypePtr

Specifies a pointer to the buffer in which the SQL_DESC_TYPE field value in the descriptor record is to be returned.

SubTypePtr

Specifies a pointer to the buffer in which the SQL_DESC_DATETIME_INTERVAL_CODE field value in the descriptor record is to be returned.

LengthPtr

Specifies a pointer to the buffer in which the SQL_DESC_OCTET_LENGTH field value in the descriptor record is to be returned.

PrecisionPtr

Specifies a pointer to the buffer in which the SQL_DESC_PRECISION field value in the descriptor record is to be returned.

ScalePtr

Specifies a pointer to the buffer in which the SQL_DESC_SCALE field value in the descriptor record is to be returned.

NullablePtr

Specifies a pointer to the buffer in which the SQL_DESC_NULLABLE field value in the descriptor record is to be returned.

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_NO_DATA, or SQL_INVALID_HANDLE.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

01004

Character string data was right-truncated

The column name was truncated because the value specified in BufferLength was smaller than the length of the column name in bytes. The length of the untruncated column name is stored in *StringLengthPtr. The function returns SQL_SUCCESS_WITH_INFO.

Y

01S51

Code replacement occurred during conversion of character encoding

A character code that cannot be converted was detected and then replaced with the specified character. The function returns SQL_SUCCESS_WITH_INFO.

Y

07009

Invalid descriptor index

The value specified in RecNumber is less than or equal to 0.

Y

08S01

Communication link failure

--

N

HY000

General error

N

HY001

Memory allocation error

N

HY007

Associated statement is not prepared

Y

HY010

Function sequence error

Before this function was executed, SQLExecute, SQLExecDirect, SQLExecDirectW, or SQLParamData was called for StatementHandle associated with DescriptorHandle and returned SQL_NEED_DATA. Since then, the setting of runtime data parameters or runtime data columns has not been completed.

Y

HY013

Memory management error

--

N

HY090

Invalid string or buffer length

An invalid value (SQL_NTS) was specified in BufferLength.

Y

HYT01

Connection timeout expired

--

N

IM001

Driver does not support this function

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None