Executes a SQL SELECT statement string, along with a list of substitution values.
public virtual bool ExecuteScalarV(
void * dstPtr,
size_t dstSize,
ul_column_storage_type dstType,
const char * sql,
va_list args
)
dstPtr A pointer to a variable of the required type to receive the value.
dstSize The size of variable to receive value, if applicable.
dstType The type of value to retrieve. This value must match the variable type.
sql The SELECT statement, optionally containing '?' parameters.
args A list of string (char *) values to substitute.
True if the query is successfully executed and a value is successfully retrieved; otherwise, returns false when a value is not fetched. Check the SQLCODE error code to determine why false is returned. The selected value is NULL if no warning or error (SQLE_NOERROR) is indicated.
The dstPtr value must point to a variable of the correct type, matching the dstType value. The dstSize parameter is only required for variable-sized values, such as strings and binaries, and is otherwise ignored. The variable list of parameter values must correspond to parameters in the statement, and all values are assumed to be strings. (internally, UltraLite casts the parameter values as required for the statement)
The following types are supported:
UL_TYPE_BIT/UL_TYPE_TINY Use variable type ul_byte (8 bit, unsigned).
UL_TYPE_U_SHORT/UL_TYPE_S_SHORT Use variable type ul_u_short/ul_s_short (16 bit).
UL_TYPE_U_LONG/UL_TYPE_S_LONG Use variable type ul_u_long/ul_s_long (32 bit).
UL_TYPE_U_BIG/UL_TYPE_S_BIG Use variable type ul_u_big/ul_s_big (64 bit).
UL_TYPE_DOUBLE Use variable type ul_double (double).
UL_TYPE_REAL Use variable type ul_real (float).
UL_TYPE_BINARY Use variable type ul_binary and specify dstSize (as in GetBinary()).
UL_TYPE_TIMESTAMP_STRUCT Use variable type DECL_DATETIME.
UL_TYPE_CHAR Use variable type char [] (a character buffer), and set dstSize to the size of the buffer (as in GetString()).
UL_TYPE_WCHAR Use variable type ul_wchar [] (a wide character buffer), and set dstSize to the size of the buffer (as in GetString()).
UL_TYPE_TCHAR Same as UL_TYPE_CHAR or UL_TYPE_WCHAR, depending on which version of the method is called.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |