Hitachi

Hitachi Advanced Database Application Development Guide


19.5.8 a_rdb_CNV_DATEchar() (convert DATE-type data)

Organization of this subsection

(1) Function

This CLI function converts SQL DATE-type data to character string data in C or C++. The following figure shows an example of conversion from DATE-type data to character string data.

Figure 19‒8: Example of conversion from DATE-type data to character string data

[Figure]

Explanation:
  • This example converts DATE-type data to character string data according to the predefined output representation that represents a date. For details about the predefined output representation for dates, see the topic Predefined character-string representations in the manual HADB SQL Reference.

  • Null characters (0x00) are added at the end.

(2) Format

#include <adbcnv.h>
 
signed short a_rdb_CNV_DATEchar
(
  unsigned char       *DATE_Data,               /* In  */
  char                *char_Data,               /* Out */
  unsigned short       BufferLength,            /* In  */
  void                *Option                   /* In  */
)

(3) Arguments

DATE_Data

Specifies the start address of the area where the DATE-type data before conversion is stored.

char_Data

Specifies the start address of area where the character string data after conversion (character string data in C or C++) is to be stored.

BufferLength

Specifies the length (in bytes) of the area where the character string data after conversion is to be stored. Specify a value of 11.

Option

Specifies NULL.

(4) Return value

  1. If a_rdb_CNV_DATEchar() terminates normally, a_rdb_RC_CNV_SUCCESS is returned.

  2. If an error occurs, the error code is returned as the return value. For details about the error code, see 19.8 Return values of the CLI functions.

(5) Notes

You must ensure that there is no overlap between the area for storing the data before conversion (DATE_Data) and the area for storing the data after conversion (char_Data).