Defines a specific command parameter that you assign and/or read the value. More...

Inherits SAValue, and SAOptions.

Public Member Functions

const SAStringName () const
 Returns the name of the parameter.
 
SADataType_t ParamType () const
 Returns parameter's data type.
 
void setParamType (SADataType_t eParamType)
 Sets the parameter's data type. More...
 
int ParamNativeType () const
 Returns code of parameter's native data type. More...
 
void setParamNativeType (int nNativeType)
 Sets parameter's native data type type. More...
 
size_t ParamSize () const
 Returns the parameter's data size.
 
void setParamSize (size_t nParamSize)
 Sets parameter's data size. More...
 
SAParamDirType_t ParamDirType () const
 Returns direction type of parameter (input, output, etc.) More...
 
void setParamDirType (SAParamDirType_t eParamDirType)
 Sets direction type of parameter (input, output, etc.) More...
 
int ParamPrecision () const
 Returns parameter's precision. More...
 
void setParamPrecision (int nParamPrecision)
 Sets precision of the parameter value. More...
 
int ParamScale () const
 Returns parameter's scale. More...
 
void setParamScale (int nParamScale)
 Sets parameter's scale. More...
 
void ReadLongOrLob (saLongOrLobReader_t fnReader, size_t nReaderWantedSize, void *pAddlData)
 Starts reading of Long or BLob(CLob) value using user defined callback. More...
 
bool isInput () const
 Returns true if SAParam::ParamDirType() is SA_ParamInput or SA_ParamInputOutput.
 
bool isOutput () const
 Returns true if SAParam::ParamDirType() is SA_ParamOutput or SA_ParamInputOutput.
 
- Public Member Functions inherited from SAValue
void setAsNull ()
 Sets value as null.
 
void setAsDefault ()
 Sets a flag to use default value.
 
bool isDefault () const
 Shows if "default value" flag is set.
 
void setAsUnknown ()
 Sets the value type as unknown.
 
bool & setAsBool ()
 Sets the value as bool data.
 
short & setAsShort ()
 Sets the value as short integer data.
 
unsigned short & setAsUShort ()
 Sets the value as unsigned short integer data.
 
sa_int32_t & setAsInt32 ()
 Sets the value as 32-bit integer data.
 
sa_uint32_t & setAsUInt32 ()
 Sets the value as unsigned 32-bit integer data.
 
sa_int32_t & setAsLong ()
 Sets the value as 32-bit integer data (deprecated).
 
sa_uint32_t & setAsULong ()
 Sets the value as unsigned 32-bit integer data (deprecated).
 
sa_int64_t & setAsInt64 ()
 Sets the value as 64-bit integer data.
 
sa_uint64_t & setAsUInt64 ()
 Sets the value as unsigned 64-bit integer data.
 
double & setAsDouble ()
 Sets the value as double precision data.
 
SANumericsetAsNumeric ()
 Sets the value as SANumeric data.
 
SADateTimesetAsDateTime ()
 Sets the value as SADateTime data.
 
SAIntervalsetAsInterval ()
 Sets the value as SAInterval data.
 
SAStringsetAsString ()
 Sets value as character string data (SAString).
 
SAStringsetAsBytes ()
 Sets value as binary string data (SAString).
 
SAStringsetAsLongBinary (saLongOrLobWriter_t fnWriter=NULL, size_t nWriterSize=0, void *pAddlData=NULL)
 Sets value as long binary data (SAString).
 
SAStringsetAsLongChar (saLongOrLobWriter_t fnWriter=NULL, size_t nWriterSize=0, void *pAddlData=NULL)
 Sets value as long character data (SAString).
 
SAStringsetAsBLob (saLongOrLobWriter_t fnWriter=NULL, size_t nWriterSize=0, void *pAddlData=NULL)
 Sets parameter's value as BLob data (SAString).
 
SAStringsetAsCLob (saLongOrLobWriter_t fnWriter=NULL, size_t nWriterSize=0, void *pAddlData=NULL)
 Sets parameter's value as CLob data (SAString).
 
SACommand *& setAsCursor ()
 Sets value as a pointer to SACommand object.
 
- Public Member Functions inherited from SAValueRead
 SAValueRead (SADataType_t eDataType)
 Initializes the object with specified data type.
 
 SAValueRead (const SAValueRead &vr)
 Copy constructor.
 
SAValueReadoperator= (const SAValueRead &vr)
 Copy operator.
 
SADataType_t DataType () const
 Returns the object's data type.
 
bool isNull () const
 Returns true if the value of current object is NULL; otherwise false.
 
void setLongOrLobReaderMode (SALongOrLobReaderModes_t eMode)
 Sets Long or Lob data reading mode.
 
SALongOrLobReaderModes_t LongOrLobReaderMode () const
 Returns Long or Lob data reading mode.
 
bool asBool () const
 Returns the value of current object. More...
 
short asShort () const
 Returns the value of current object. More...
 
unsigned short asUShort () const
 Returns the value of current object. More...
 
sa_int32_t asInt32 () const
 Returns the value of current object. More...
 
sa_uint32_t asUInt32 () const
 Returns the value of current object. More...
 
sa_int32_t asLong () const
 Returns the value of current object. More...
 
sa_uint32_t asULong () const
 Returns the value of current object. More...
 
sa_int64_t asInt64 () const
 Returns the value of current object. More...
 
sa_uint64_t asUInt64 () const
 Returns the value of current object. More...
 
double asDouble () const
 Returns the value of current object. More...
 
SANumeric asNumeric () const
 Returns the value of current object. More...
 
SADateTime asDateTime () const
 Returns the value of current object. More...
 
SAInterval asInterval () const
 Returns the value of current object. More...
 
SAString asString () const
 Returns the value of current object. More...
 
SAString asBytes () const
 Returns the value of current object. More...
 
SAString asLongBinary () const
 Returns the value of current object. More...
 
SAString asLongChar () const
 Returns the value of current object. More...
 
SAString asBLob () const
 Returns the value of current object. More...
 
SAString asCLob () const
 Returns the value of current object. More...
 
SACommandasCursor () const
 Returns the value of current object. More...
 
 operator bool () const
 Returns the value of current object. More...
 
 operator short () const
 Returns the value of current object. More...
 
 operator unsigned short () const
 Returns the value of current object. More...
 
 operator sa_int32_t () const
 Returns the value of current object. More...
 
 operator sa_uint32_t () const
 Returns the value of current object. More...
 
 operator sa_int64_t () const
 Returns the value of current object. More...
 
 operator sa_uint64_t () const
 Returns the value of current object. More...
 
 operator double () const
 Returns the value of current object. More...
 
 operator SANumeric () const
 Returns the value of current object. More...
 
 operator SADateTime () const
 Returns the value of current object. More...
 
 operator SAInterval () const
 Returns the value of current object. More...
 
 operator SAString () const
 Returns the value of current object. More...
 
 operator SACommand * () const
 Returns the value of current object. More...
 
- Public Member Functions inherited from SAOptions
 SAOptions ()
 Default constructor.
 
virtual SAStringsetOption (const SAString &sOptionName)
 Sets a string value of a specific option. More...
 
virtual int TotalOptions () const
 Returns the count of options.
 
virtual SAString OptionName (int nIndex) const
 Returns the string value of an option.
 

Detailed Description

Defines a specific command parameter that you assign and/or read the value.

Member Function Documentation

◆ setParamType()

void SAParam::setParamType ( SADataType_t  eParamType)

Sets the parameter's data type.

Remarks
Normally you should not call this method explicitly. The Library automatically detects parameter's data type and implicitly creates an appropriate SAParam object.

◆ ParamNativeType()

int SAParam::ParamNativeType ( ) const

Returns code of parameter's native data type.

Remarks
Use ParamNativeType method if you need to know the original data type code of the parameter as it was reported by native API.

◆ setParamNativeType()

void SAParam::setParamNativeType ( int  nNativeType)

Sets parameter's native data type type.

Remarks
Normally you should not call this method explicitly. The Library automatically detects parameter's native type and implicitly creates an appropriate SAParam object.
Parameters
nNativeTypeThe original data type code of the parameter as it is expected by native API.

◆ setParamSize()

void SAParam::setParamSize ( size_t  nParamSize)

Sets parameter's data size.

Remarks
Normally you should not call this method explicitly. The Library automatically detects parameter's data size and implicitly creates an appropriate SAParam object.

◆ ParamDirType()

SAParamDirType_t SAParam::ParamDirType ( ) const

Returns direction type of parameter (input, output, etc.)

Remarks
Usually the Library automatically detects parameter's direction type and implicitly creates an appropriate SAParam object. But not all of DBMS clients/servers provide complete parameters information.

◆ setParamDirType()

void SAParam::setParamDirType ( SAParamDirType_t  eParamDirType)

Sets direction type of parameter (input, output, etc.)

Remarks
Usually you should not define parameter's direction type by yourself. The Library automatically detects parameter's direction type and implicitly creates an appropriate SAParam object. But not all of DBMS clients/servers provide complete parameters information. In that situation programmer need to describe parameter's direction type explicitly. See server specific notes for details.

Server specific notes

Sybase

Sybase ASE server does not provide information about parameter's direction type, that's why SQLAPI++ Library defines all parameters (except status result code) as input (SA_ParamInput). If you have input-output parameters in the procedure you have to call SAParam::setParamDirType method for these parameters before command execution and set parameter's direction type explicitly. You shouldn't call this method for procedure status result code because it is detected correctly (as SA_ParamReturn) by the Library.

There is no need to call this method for Sybase ASA because all parameters are detected correctly automatically (including the direction type).

Parameters
eParamDirTypeDefines parameter's direction type.

◆ ParamPrecision()

int SAParam::ParamPrecision ( ) const

Returns parameter's precision.

Returns precision of the parameter value (the total number of allowable digits).

◆ setParamPrecision()

void SAParam::setParamPrecision ( int  nParamPrecision)

Sets precision of the parameter value.

Remarks
Normally you should not call this method explicitly. The Library automatically detects parameter's precision and implicitly creates an appropriate SAParam object.
Parameters
nParamPrecisionThe total number of allowable digits.

◆ ParamScale()

int SAParam::ParamScale ( ) const

Returns parameter's scale.

Remarks
Returns scale of the parameter value (the number of digits to the right of the decimal point).

◆ setParamScale()

void SAParam::setParamScale ( int  nParamScale)

Sets parameter's scale.

Remarks
Normally you should not call this method explicitly. The Library automatically detects parameter's scale and implicitly creates an appropriate SAParam object.
Parameters
nParamScaleThe number of digits to the right of the decimal point.

◆ ReadLongOrLob()

void SAParam::ReadLongOrLob ( saLongOrLobReader_t  fnReader,
size_t  nReaderWantedSize,
void *  pAddlData 
)

Starts reading of Long or BLob(CLob) value using user defined callback.

After a command execution all output parameters are updated by their values, including Long and BLob(CLob) parameters.

If you want to control piecewise reading of Long or BLob(CLob) data you should do the following:

  • Before a command execution set SA_LongOrLobReaderManual reading mode (see SAValueRead::setLongOrLobReaderMode) for Long or BLob(CLob) parameters you want to process by user defined function(s). After that SQLAPI++ will skip reading output Long and BLob(CLob) parameters that you set to be read manually.
  • After command execution use SAParam::ReadLongOrLob method for each output parameter defined to be read manually.

ReadLongOrLob method will repeatedly call user defined function of type saLongOrLobReader_t.

To get more information about reading Long and BLob(CLob) data see Query examples - Step 6.

Note, that if the command has result set(s) (it is possible in some servers, see Server Specific Guides then output parameters are available only after all result sets are completely processed using SACommand::FetchNext method.

Parameters
fnReaderThe name of user function used for Long or BLob(CLob) data reading.
nReaderWantedSizeSize of piece of data user want to get to callback function.
pAddlDataAdditional data, passed to callback function.