Hitachi

Hitachi Advanced Database Application Development Guide


16.7.1 SQLPrepare, SQLPrepareW

Organization of this subsection

(1) Function

This ODBC function sends an SQL statement to the data source and preprocesses the SQL statement.

(2) Format

(3) Arguments

StatementHandle

Specifies a statement handle.

StatementText

Specifies an SQL character string. Comments (bracketed between /* and */) are not permitted within an SQL character string, but specifications bracketed between /*>> and <<*/ (for example, index specifications) are permitted within an SQL character string.

TextLength

Specifies the length of *StatementText (in bytes for SQLPrepare and in characters for SQLPrepareW).

If the SQL character string specified in StatementText guarantees a null terminating character, SQL_NTS can be specified in this argument.

(4) Return value

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

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

01S02

Option value changed

N

08S01

Communication link failure

N

21S01

Insert value list does not match column list

N

21S02

Degree of derived table does not match column list

N

22018

Invalid character value for cast specification

N

22019

Invalid escape character

N

22025

Invalid escape sequence

N

24000

Invalid cursor status

N

34000

Invalid cursor name

N

3D000

Invalid catalog name

N

3F000

Invalid schema name

N

42000

Syntax error or access violation

N

42S01

Base table or view already exists

N

42S02

Base table or view not found

N

42S11

Index already exists

N

42S12

Index not found

N

42S21

Column already exists

N

42S22

Column not found

N

5C002

Character encoding conversion error

A character code that cannot be converted was detected.

Y

5C041

Unsupported data type error

The driver does not support the specified data type.

Y

5C051

The text character string for an SQL statement exceeded 16,000,000 characters

Even if the text character string for an SQL statement consists of 16,000,000 or fewer characters, the result after character encoding conversion by the driver manager might exceed 16,000,000 characters. SQLSTATE is also returned in such a case.

Y

HY000

General error

--

N

HY001

Memory allocation error

The memory required to execute or complete the function has not been allocated for the driver.

Y

HY008

Operation cancelled

--

N

HY009

Invalid use of null pointer

A null pointer is specified for StatementText.

Y

HY010

Function sequence error

--

Y

HY013

Memory management error

N

HY090

Invalid string or buffer length

The value specified in TextLength is less than or equal to 0, or not SQL_NTS.

Y

HY117

Connection suspended

--

N

HYC00

Optional feature not implemented

N

HYT00

Timeout expired

N

HYT01

Connection timeout expired

N

IM001

Driver does not support this function

N

IM017

Invalid asynchronous polling

N

IM018

Incomplete asynchronous execution

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