Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SQLDBC::SQLDBC_ParameterMetaData Class Reference

#include <SQLDBC.h>

List of all members.


Detailed Description

Can retrieve information to find out the parameter types and their properties in a PreparedStatement object.

Definition at line 402 of file SQLDBC.h.

Public Types

Public Methods


Member Typedef Documentation

typedef enum SQLDBC::SQLDBC_ParameterMetaData::ParameterMode SQLDBC::SQLDBC_ParameterMetaData::ParameterMode
 

typedef enum SQLDBC::SQLDBC_ParameterMetaData::ParameterNullBehavior SQLDBC::SQLDBC_ParameterMetaData::ParameterNullBehavior
 


Member Enumeration Documentation

enum SQLDBC::SQLDBC_ParameterMetaData::ParameterMode
 

Enumeration values:
parameterModeUnknown  The input/output behaviour of the parameter is unknown.
parameterModeIn  The parameter in an input parameter.
parameterModeInOut  The parameter in an input and output parameter.
parameterModeOut  The parameter in an output parameter.

Definition at line 431 of file SQLDBC.h.

enum SQLDBC::SQLDBC_ParameterMetaData::ParameterNullBehavior
 

Enumeration values:
parameterNoNulls  The parameter must not be NULL values.
parameterNullable  The parameter allows NULL values.
parameterNullableUnknown  It is unknown whether the parameter allows NULL values.

Definition at line 407 of file SQLDBC.h.


Member Function Documentation

SQLDBC_Int2 SQLDBC::SQLDBC_ParameterMetaData::getParameterCount  
 

Returns the number of parameter/columns in the PreparedStatement or ResultSet object.

Returns:
The number of parameter or columns.

SQLDBC_Int4 SQLDBC::SQLDBC_ParameterMetaData::getParameterLength SQLDBC_Int2    param
 

Returns the maximum width in characters of the data type of the specified parameter.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
The maximum width in bytes of the data type of the specified parameter

ParameterMode SQLDBC::SQLDBC_ParameterMetaData::getParameterMode SQLDBC_Int2    param
 

Returns the input/output behaviour of the specified parameter.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
The input/output behaviour of the parameter data type; Possible values are: parameterModeIn, parameterModeOut or parameterModeInOut.

SQLDBC_Retcode SQLDBC::SQLDBC_ParameterMetaData::getParameterName SQLDBC_Int2    param,
char *    buffer,
const SQLDBC_StringEncoding    encoding,
const SQLDBC_Length    bufferSize,
SQLDBC_Length   bufferLength
const
 

Requests the name of the specified parameter.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
buffer The buffer to store the name
encoding The code of the name of the specified parameter
bufferSize The buffer size in bytes of the buffer.
bufferLength [out] The number of bytes stored in the buffer, not included the number of bytes necessary for the zero-terminator. If the source string exceeds the bufferSize value SQLDBC_DATA_TRUNC is returned and the bufferLength is set to the number of bytes required to store the name without truncation (not included the number of bytes necessary for the zero-terminator).
Returns:
SQLDBC_OK on success, SQLDBC_DATA_TRUNC if the buffer is too small.

SQLDBC_SQLType SQLDBC::SQLDBC_ParameterMetaData::getParameterType SQLDBC_Int2    param
 

Returns the data type of the specified parameter.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
Data type of the parameter

SQLDBC_Int4 SQLDBC::SQLDBC_ParameterMetaData::getPhysicalLength SQLDBC_Int2    param
 

Returns maximum physical width in bytes of the data type of the specified parameter.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
Maximum physical width in bytes of the data type of the specified parameter.

SQLDBC_Int4 SQLDBC::SQLDBC_ParameterMetaData::getPrecision SQLDBC_Int2    param
 

Returns the number of decimal digits of the data type of the specified parameter.

For number types, getPrecision() returns the number of decimal digits. For character types, it returns the maximum length in characters. For binary types, it returns the maximum length in bytes.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
The number of decimal digits of the data type of the specified parameter.

SQLDBC_Int4 SQLDBC::SQLDBC_ParameterMetaData::getScale SQLDBC_Int2    param
 

Returns the number of decimal places of the data type of the specified parameter.

For none numeric types, the scale is set to zero.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
Number of decimal places of the data type of the specified parameter.

ParameterNullBehavior SQLDBC::SQLDBC_ParameterMetaData::isNullable SQLDBC_Int2    param
 

Returns whether NULL values are allowed for the specified parameter values.

Parameters:
param Index of the parameter. The first parameter is number 1, the second is number 2, ...
Returns:
Whether NULL values are allowed for the specified parameter; Possible values are parameterNoNulls, parameterNullable or parameterNullableUnknown


Friends And Related Function Documentation

friend class SQLDBC_PreparedStatement [friend]
 

A class for preparing and executing SQL statements.

A prepared SQL command can be parsed and contain input and output parameters. Parameters are marked with a '?' or ':<name>' tag. All DML commands can be parsed. DDL commands can be parsed, too. However, it is not recommended to do so. Prepared SQL commands increase the performance since they are parsed only once and executed several times. Applications only need to change the content of the bound parameters and execute the command again.

All prepared SQL commands are stored in an internally managed ParseInfo Cache . The ParseInfo Cache shares this information with different prepared SQL statements within the same connection.

The SQL statement may contain ASCII or UCS2 characters and must not zero-terminated. The execute() member function converts it to the adequate code set considering the code of the database. Therefore it is possible to write portable code for UNICODE and non-UNICODE databases.

Note:
To increase the performance, applications must use UCS2 statements for UNICODE databases only.
Example:
Preparation and execution of an SQL statement.
   SQLDBC_PrepareStatement *stmt = conn->createPreparedStatement();
   SQLDBC_Retcode rc = stmt->prepare("SELECT * FROM DUAL");
   if (rc != SQLDBC_OK) {
     // Handle error ...
   }
   rc = stmt->execute();
   if (rc != SQLDBC_OK) {
     // Handle error ...
   }
   

Hints:
  • The application must call createPreparedStatement() to retrieve a prepared SQL statement
  • For parsing the SQL statement, call the prepare() member function,
  • For a single-row execution, use the execute() member function,
  • For mass execution, bind arrays of parameter values, use setBatchSize() to set the row array size to the number of array elements bound, and use the execute() method.
  • Use the isQuery() method to check whether the parsed statement creates a result set upon execution.
  • Use SQLDBC_Statement for a direct execution, since the prepared statement inherits all direct-execution functions from SQLDBC_Statement.
  • The current result set is deleted when
    • A new statement is parsed
    • The statement is re-executed
    • The statement is deleted
Todo:
binding parameter by name

Definition at line 588 of file SQLDBC.h.

friend struct SQLDBC_PreparedStatementStorage [friend]
 

Definition at line 589 of file SQLDBC.h.


The documentation for this class was generated from the following file: