Hitachi

Hitachi Advanced Database Application Development Guide


19.5.2 a_rdb_CNV_charDATE() (convert to DATE-type data)

Organization of this subsection

(1) Function

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

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

[Figure]

Important

The character string data before conversion must be in a predefined input representation that represents a date. For details about the predefined input representations for dates, see the topic Predefined character-string representations in the manual HADB SQL Reference.

Example:

The character string data that represents September 30, 2014, must be in one of the following formats:

2014-09-30

2014/09/30

(2) Format

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

(3) Arguments

char_Data

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

DATE_Data

Specifies the start address of the area where the DATE-type data after conversion is to be stored.

BufferLength

Specifies the length (in bytes) of the area where the DATE-type data after conversion is to be stored. Specify a value of 4.

Option

Specifies NULL.

(4) Return value

  1. If a_rdb_CNV_charDATE() 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 (char_Data) and the area for storing the data after conversion (DATE_Data).