SQLAPI_C.cpp File Reference

SQLAPI++ C interface functions. More...

Functions

SAExceptionsqlapi_alloc_error ()
 Allocates the Library error handle. More...
 
void sqlapi_free_error (SAException **perr)
 Releases all error handle related resources. More...
 
SAStringsqlapi_error_text (const SAException *err)
 Gets the SAException error text. More...
 
const SACharsqlapi_error_message (const SAException *err)
 Gets the SAException error message. More...
 
int sqlapi_error_native_code (const SAException *err)
 Gets the SAException error native code. More...
 
int sqlapi_error_pos (const SAException *err)
 Gets the SAException error position. More...
 
SAErrorClass_t sqlapi_error_class (const SAException *err)
 Gets the SAException error class. More...
 
const SAExceptionsqlapi_error_nested (const SAException *err)
 Gets the SAException nested error. More...
 
SABool_t sqlapi_has_error (const SAException *err)
 Checks if SAException handle contains DBMS error information.
 
SAPIsqlapi_alloc_api ()
 Allocates new API handle. More...
 
void sqlapi_free_api (SAPI **papi)
 Releases all API handle related resources. More...
 
void sqlapi_set_api_option (SAPI *api, const SAChar *szOption, const SAChar *szValue)
 Sets SAPI handle option. More...
 
SAErrorClass_t sqlapi_init (SAPI *api, SAClient_t type, SAException *err)
 Initializes SAPI handle with specified DBMS client type. More...
 
SAConnectionsqlapi_alloc_connection (SAPI *api)
 Allocates new connection handle. More...
 
void sqlapi_free_connection (SAConnection **pcon)
 Releases all connection handle related resources. More...
 
void sqlapi_set_connection_option (SAConnection *conn, const SAChar *szOption, const SAChar *szValue)
 Sets SAConnection handle option. More...
 
SAErrorClass_t sqlapi_connect (SAConnection *conn, const SAChar *szConnectionStr, const SAChar *szUser, const SAChar *szPassword, SAException *err)
 Connects SAConnection handle. More...
 
SAErrorClass_t sqlapi_disconnect (SAConnection *conn, SAException *err)
 Disconnects SAConnection handle. More...
 
SABool_t sqlapi_is_connected (SAConnection *conn, SAException *err)
 Checks if SAConnection is connected. More...
 
SABool_t sqlapi_is_alive (SAConnection *conn, SAException *err)
 Checks if SAConnection is alive. More...
 
void sqlapi_reset_connection (SAConnection *conn)
 Resets SAConnection handle. More...
 
SAErrorClass_t sqlapi_commit (SAConnection *conn, SAException *err)
 Commits the database session changes. More...
 
SAErrorClass_t sqlapi_rollback (SAConnection *conn, SAException *err)
 Rollbacks the database session changes. More...
 
SAErrorClass_t sqlapi_set_auto_commit (SAConnection *conn, SAAutoCommit_t mode, SAException *err)
 Changes the database session auto-commit mode. More...
 
SAErrorClass_t sqlapi_set_isolation_level (SAConnection *conn, SAIsolationLevel_t level, SAException *err)
 Changes the database session isolation level. More...
 
SACommandsqlapi_alloc_command (SAConnection *conn)
 Allocates new command handle. More...
 
void sqlapi_free_command (SACommand **pcmd)
 Releases all command handle related resources. More...
 
void sqlapi_set_command_option (SACommand *cmd, const SAChar *szOption, const SAChar *szValue)
 Sets SACommand handle option. More...
 
SAErrorClass_t sqlapi_execute (SACommand *cmd, const SAChar *szQuery, SAException *err)
 Executes SQL command. More...
 
SAErrorClass_t sqlapi_close_command (SACommand *cmd, SAException *err)
 Closes the specified SACommand object. More...
 
sa_uint64_t sqlapi_rows_affected (SACommand *cmd, SAException *err)
 Returns number of rows affected by last DML operation. More...
 
void sqlapi_reset_command (SACommand *cmd)
 Resets SACommand handle. More...
 
SABool_t sqlapi_is_result_set (SACommand *cmd, SAException *err)
 Checks if any result set exists. More...
 
SABool_t sqlapi_fetch_next (SACommand *cmd, SAException *err)
 Fetches next row of the result set. More...
 
SABool_t sqlapi_fetch_prior (SACommand *cmd, SAException *err)
 Fetches previous row of the result set. More...
 
SABool_t sqlapi_fetch_first (SACommand *cmd, SAException *err)
 Fetches the first row of the result set. More...
 
SABool_t sqlapi_fetch_last (SACommand *cmd, SAException *err)
 Fetches the last row of the result set. More...
 
SABool_t sqlapi_fetch_pos (SACommand *cmd, int offset, SABool_t relative, SAException *err)
 Fetches the specified row of the result set. More...
 
int sqlapi_param_count (SACommand *cmd, SAException *err)
 Returns the command parameters count. More...
 
SAParamsqlapi_param_by_index (SACommand *cmd, int nIndex, SAException *err)
 Returns SAParam handle. More...
 
SAParamsqlapi_param_by_name (SACommand *cmd, const SAChar *szParamByName, SAException *err)
 Returns SAParam handle. More...
 
SADataType_t sqlapi_param_type (const SAParam *par)
 Returns SAParam type. More...
 
SAParamDirType_t sqlapi_param_direction (const SAParam *par)
 Returns SAParam direction. More...
 
int sqlapi_param_native_type (const SAParam *par)
 Returns SAParam native type. More...
 
size_t sqlapi_param_size (const SAParam *par)
 Returns SAParam size. More...
 
int sqlapi_param_precision (const SAParam *par)
 Returns SAParam precision. More...
 
int sqlapi_param_scale (const SAParam *par)
 Returns SAParam scale. More...
 
const SAValueReadsqlapi_param_value (SACommand *cmd, int nParamByID, SAException *err)
 Returns parameter value handle. More...
 
const SAValueReadsqlapi_param_value_by_name (SACommand *cmd, const SAChar *szParamByName, SAException *err)
 Returns parameter value handle. More...
 
void sqlapi_param_set_short (SAParam *par, short val)
 Sets the parameter value as short integer. More...
 
void sqlapi_param_set_ushort (SAParam *par, unsigned short val)
 Sets the parameter value as unsigned short integer. More...
 
void sqlapi_param_set_int32 (SAParam *par, sa_int32_t val)
 Sets the parameter value as integer. More...
 
void sqlapi_param_set_uint32 (SAParam *par, sa_uint32_t val)
 Sets the parameter value as unsigned integer. More...
 
void sqlapi_param_set_int64 (SAParam *par, sa_int64_t val)
 Sets the parameter value as 64-bit integer. More...
 
void sqlapi_param_set_uint64 (SAParam *par, sa_uint64_t val)
 Sets the parameter value as unsigned 64-bit integer. More...
 
void sqlapi_param_set_string (SAParam *par, const SAString *val)
 Sets the parameter value as string. More...
 
void sqlapi_param_set_numeric (SAParam *par, const SANumeric *val)
 Sets the parameter value as numeric. More...
 
void sqlapi_param_set_datetime (SAParam *par, const SADateTime *val)
 Sets the parameter value as date/time. More...
 
void sqlapi_param_set_double (SAParam *par, double val)
 Sets the parameter value as double. More...
 
void sqlapi_param_set_bytes (SAParam *par, const SAString *val)
 Sets the parameter value as binary data. More...
 
SAParamsqlapi_param (SACommand *cmd, int nParamByID, SAException *err)
 Returns parameter handle. More...
 
int sqlapi_field_count (SACommand *cmd, SAException *err)
 Returns the result set field count. More...
 
SABool_t sqlapi_field_exists (SACommand *cmd, const SAChar *szField, SAException *err)
 Checks if the field exists in the result set. More...
 
const SAFieldsqlapi_field (SACommand *cmd, int nField, SAException *err)
 Returns the result set field handle. More...
 
const SAValueReadsqlapi_field_value (SACommand *cmd, int nField, SAException *err)
 Returns the result set field value handle. More...
 
const SAFieldsqlapi_field_by_name (SACommand *cmd, const SAChar *szField, SAException *err)
 Returns the result set field handle. More...
 
const SAValueReadsqlapi_field_value_by_name (SACommand *cmd, const SAChar *szField, SAException *err)
 Returns the result set field value handle. More...
 
const SACharsqlapi_field_name (const SAField *field)
 Returns SAField name. More...
 
SADataType_t sqlapi_field_type (const SAField *field)
 Returns SAField type. More...
 
int sqlapi_field_native_type (const SAField *field)
 Returns SAField native type. More...
 
size_t sqlapi_field_data_size (const SAField *field)
 Returns SAField size. More...
 
int sqlapi_field_precision (const SAField *field)
 Returns SAField precision. More...
 
int sqlapi_field_scale (const SAField *field)
 Returns SAField scale. More...
 
SAStringsqlapi_value_as_bytes (const SAValueRead *val)
 Returns the binary data of the value. More...
 
const SACommandsqlapi_value_as_cursor (const SAValueRead *val)
 Returns the resultset associated with the value. More...
 
double sqlapi_value_as_double (const SAValueRead *val)
 Returns the double value. More...
 
SADateTimesqlapi_value_as_datetime (const SAValueRead *val)
 Returns the date/time value. More...
 
SANumericsqlapi_value_as_numeric (const SAValueRead *val)
 Returns the numeric value. More...
 
SAStringsqlapi_value_as_string (const SAValueRead *val)
 Returns the string value. More...
 
short sqlapi_value_as_short (const SAValueRead *val)
 Returns the short value. More...
 
unsigned short sqlapi_value_as_ushort (const SAValueRead *val)
 Returns the unsigned short value. More...
 
sa_int32_t sqlapi_value_as_int32 (const SAValueRead *val)
 Returns the 32-bit integer value. More...
 
sa_uint32_t sqlapi_value_as_uint32 (const SAValueRead *val)
 Returns the unsigned 32-bit integer value. More...
 
sa_int64_t sqlapi_value_as_int64 (const SAValueRead *val)
 Returns the 64-bit integer value. More...
 
sa_uint64_t sqlapi_value_as_uint64 (const SAValueRead *val)
 Returns the unsigned 64-bit integer value. More...
 
SAStringsqlapi_alloc_string (const SAString *src)
 Allocates new string handle. More...
 
void sqlapi_free_string (SAString **pstr)
 Releases the string handle. More...
 
const char * sqlapi_string_mb (const SAString *str)
 Returns the multi-byte string stored with SAString handle. More...
 
size_t sqlapi_string_mb_length (const SAString *str)
 Returns the multi-byte string length stored with SAString handle. More...
 
void sqlapi_string_set_mb_string (SAString *str, const char *src, size_t len)
 Sets the multi-byte string into SAString handle. More...
 
const wchar_t * sqlapi_string_wide (const SAString *str)
 Returns the wide string stored with SAString handle. More...
 
size_t sqlapi_string_wide_length (const SAString *str)
 Returns the wide string length stored with SAString handle. More...
 
void sqlapi_string_set_wide_string (SAString *str, const wchar_t *src, size_t len)
 Sets the wide string into SAString handle. More...
 
const char * sqlapi_string_utf8 (const SAString *str)
 Returns the UTF-8 string stored with SAString handle. More...
 
size_t sqlapi_string_utf8_length (const SAString *str)
 Returns the UTF-8 string length stored with SAString handle. More...
 
void sqlapi_string_set_utf8_string (SAString *str, const char *src, size_t len)
 Sets the UTF-8 string into SAString handle. More...
 
const void * sqlapi_string_binary (const SAString *str)
 Returns the binary data stored with SAString handle. More...
 
size_t sqlapi_string_binary_length (const SAString *str)
 Returns the binary data length stored with SAString handle. More...
 
void sqlapi_string_set_binary_string (SAString *str, const void *src, size_t len)
 Sets the binary data into SAString handle. More...
 
SANumericsqlapi_alloc_numeric (const SANumeric *src)
 Allocates new numeric handle. More...
 
void sqlapi_free_numeric (SANumeric **pnum)
 Releases the numeric handle. More...
 
SAStringsqlapi_numeric_string (const SANumeric *num)
 Converts SANumeric handle value into SAString. More...
 
unsigned char sqlapi_numeric_precision (const SANumeric *num)
 Returns SANumeric precision. More...
 
unsigned char sqlapi_numeric_scale (const SANumeric *num)
 Returns SANumeric scale. More...
 
unsigned char sqlapi_numeric_sign (const SANumeric *num)
 Returns SANumeric sign. More...
 
double sqlapi_numeric_double (const SANumeric *num)
 Converts SANumeric handle value into double. More...
 
sa_int64_t sqlapi_numeric_int64 (const SANumeric *num)
 Converts SANumeric handle value into 64-bit integer. More...
 
sa_uint64_t sqlapi_numeric_uint64 (const SANumeric *num)
 Converts SANumeric handle value into unsigned 64-bit integer. More...
 
void sqlapi_numeric_set_string (SANumeric *num, const SAChar *val)
 Converts character string into SANumeric handle value. More...
 
void sqlapi_numeric_set_double (SANumeric *num, double val)
 Converts double into SANumeric handle value. More...
 
void sqlapi_numeric_set_int64 (SANumeric *num, sa_int64_t val)
 Converts 64-bit integer into SANumeric handle value. More...
 
void sqlapi_numeric_set_uint64 (SANumeric *num, sa_uint64_t val)
 Converts unsigned 64-bit integer into SANumeric handle value. More...
 
SADateTimesqlapi_alloc_datetime (const SADateTime *src)
 Allocates new datetime handle. More...
 
void sqlapi_free_datetime (SADateTime **pdt)
 Releases the datetime handle. More...
 
SAStringsqlapi_datetime_string (const SADateTime *dt)
 Converts SADateTime handle value into SAString. More...
 
struct tm sqlapi_datetime_tm (const SADateTime *dt)
 Converts SADateTime handle value into struct tm. More...
 
double sqlapi_datetime_double (const SADateTime *dt)
 Converts SADateTime handle value into double. More...
 
int sqlapi_datetime_year (const SADateTime *dt)
 Returns the year of SADateTime handle value. More...
 
int sqlapi_datetime_month (const SADateTime *dt)
 Returns the month of SADateTime handle value. More...
 
int sqlapi_datetime_day (const SADateTime *dt)
 Returns the day of SADateTime handle value. More...
 
int sqlapi_datetime_week_day (const SADateTime *dt)
 Returns the week day of SADateTime handle value. More...
 
int sqlapi_datetime_year_day (const SADateTime *dt)
 Returns the year day of SADateTime handle value. More...
 
int sqlapi_datetime_hour (const SADateTime *dt)
 Returns the hour of SADateTime handle value. More...
 
int sqlapi_datetime_min (const SADateTime *dt)
 Returns the minute of SADateTime handle value. More...
 
int sqlapi_datetime_sec (const SADateTime *dt)
 Returns the second of SADateTime handle value. More...
 
const SACharsqlapi_datetime_timezone (const SADateTime *dt)
 Returns the timezone of SADateTime handle value. More...
 
unsigned int sqlapi_datetime_fraction (const SADateTime *dt)
 Returns the fraction of SADateTime handle value. More...
 
void sqlapi_datetime_set_tm (SADateTime *dt, struct tm val)
 Converts struct tm into SADateTime handle value. More...
 
void sqlapi_datetime_set_double (SADateTime *dt, double val)
 Converts double into SADateTime handle value. More...
 
void sqlapi_datetime_set_datetime (SADateTime *dt, int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, unsigned int nFraction, const SAChar *timezone)
 Sets SADateTime handle datetime value.
 
void sqlapi_datetime_set_date (SADateTime *dt, int nYear, int nMonth, int nDay)
 Sets SADateTime handle date value.
 
void sqlapi_datetime_set_time (SADateTime *dt, int nHour, int nMin, int nSec, unsigned int nFraction)
 Sets SADateTime handle time value.
 
SABool_t sqlapi_datetime_has_date (const SADateTime *dt)
 Checks if SADateTime handle value has date part.
 
SABool_t sqlapi_datetime_has_time (const SADateTime *dt)
 Checks if SADateTime handle value has time part.
 

Detailed Description

SQLAPI++ C interface functions.

SQLAPI++ C interface functions are built on C++ classes and methods. They are compiled by C++ compiler but can be used in pure C code - just include the same SQLAPI.h header file in your sources, compile and link them with SQLAPI++ library.

SQLAPI++ C functions interact with C++ interfaces by using 'handles' - pointers to SQLAPI++ objects that are declared as structs for C code.

Function Documentation

◆ sqlapi_alloc_error()

SAException* sqlapi_alloc_error ( )

Allocates the Library error handle.

This function allocates SAException* handle that can be used for getting error details.

After the work is done the received error handle should be released with sqlapi_free_error function.

◆ sqlapi_free_error()

void sqlapi_free_error ( SAException **  perr)

Releases all error handle related resources.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

...
sqlapi_free_error(&err);
Parameters
perrPointer to error handle

◆ sqlapi_error_text()

SAString* sqlapi_error_text ( const SAException err)

Gets the SAException error text.

This function returns the error text for related SAException* handle.

See also
SAException::ErrText

◆ sqlapi_error_message()

const SAChar* sqlapi_error_message ( const SAException err)

Gets the SAException error message.

This function returns the error message associated with SAException* handle.

See also
SAException::ErrText

◆ sqlapi_error_native_code()

int sqlapi_error_native_code ( const SAException err)

Gets the SAException error native code.

This function returns DBMS error native code associated with SAException* handle.

See also
SAException::ErrNativeCode

◆ sqlapi_error_pos()

int sqlapi_error_pos ( const SAException err)

Gets the SAException error position.

This function returns DBMS error position associated with SAException* handle.

See also
SAException::ErrPos

◆ sqlapi_error_class()

SAErrorClass_t sqlapi_error_class ( const SAException err)

Gets the SAException error class.

This function returns the error class associated with SAException* handle.

See also
SAException::ErrClass

◆ sqlapi_error_nested()

const SAException* sqlapi_error_nested ( const SAException err)

Gets the SAException nested error.

This function returns the nested error associated with SAException* handle.

See also
SAException::NestedException

◆ sqlapi_alloc_api()

SAPI* sqlapi_alloc_api ( )

Allocates new API handle.

After the work is done the received API handle should be released with sqlapi_free function.

◆ sqlapi_free_api()

void sqlapi_free_api ( SAPI **  papi)

Releases all API handle related resources.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
papiPointer to SAPI handle

◆ sqlapi_set_api_option()

void sqlapi_set_api_option ( SAPI api,
const SAChar szOption,
const SAChar szValue 
)

Sets SAPI handle option.

See also
SAPI::setOption

◆ sqlapi_init()

SAErrorClass_t sqlapi_init ( SAPI api,
SAClient_t  type,
SAException err 
)

Initializes SAPI handle with specified DBMS client type.

Parameters
apiSAPI handle for initialization
typeDBMS client type
errThe error handle for the detailed diagnostic or 0
Returns
SA_No_Error if success, actual error class if failure.

◆ sqlapi_alloc_connection()

SAConnection* sqlapi_alloc_connection ( SAPI api)

Allocates new connection handle.

After the work is done the received connection handle should be released with sqlapi_free_connection function.

◆ sqlapi_free_connection()

void sqlapi_free_connection ( SAConnection **  pcon)

Releases all connection handle related resources.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
pconPointer to SAConnection handle

◆ sqlapi_set_connection_option()

void sqlapi_set_connection_option ( SAConnection conn,
const SAChar szOption,
const SAChar szValue 
)

Sets SAConnection handle option.

See also
SAConnection::setOption

◆ sqlapi_connect()

SAErrorClass_t sqlapi_connect ( SAConnection conn,
const SAChar szConnectionStr,
const SAChar szUser,
const SAChar szPassword,
SAException err 
)

Connects SAConnection handle.

Parameters
connThe connection handle
szConnectionStrThe connection string (DBMS specific)
szUserThe username (or an empty string for OS authentication if supported)
szPasswordThe password
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::Connect

◆ sqlapi_disconnect()

SAErrorClass_t sqlapi_disconnect ( SAConnection conn,
SAException err 
)

Disconnects SAConnection handle.

Parameters
connThe connection handle
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::Disconnect

◆ sqlapi_is_connected()

SABool_t sqlapi_is_connected ( SAConnection conn,
SAException err 
)

Checks if SAConnection is connected.

Parameters
connThe connection handle
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::isConnected

◆ sqlapi_is_alive()

SABool_t sqlapi_is_alive ( SAConnection conn,
SAException err 
)

Checks if SAConnection is alive.

Parameters
connThe connection handle
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::isAlive

◆ sqlapi_reset_connection()

void sqlapi_reset_connection ( SAConnection conn)

Resets SAConnection handle.

Parameters
connThe connection handle
See also
SAConnection::Reset

◆ sqlapi_commit()

SAErrorClass_t sqlapi_commit ( SAConnection conn,
SAException err 
)

Commits the database session changes.

Parameters
connThe connection handle
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::Commit

◆ sqlapi_rollback()

SAErrorClass_t sqlapi_rollback ( SAConnection conn,
SAException err 
)

Rollbacks the database session changes.

Parameters
connThe connection handle
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::Rollback

◆ sqlapi_set_auto_commit()

SAErrorClass_t sqlapi_set_auto_commit ( SAConnection conn,
SAAutoCommit_t  mode,
SAException err 
)

Changes the database session auto-commit mode.

Parameters
connThe connection handle
modeThe auto-commit mode
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::setAutoCommit

◆ sqlapi_set_isolation_level()

SAErrorClass_t sqlapi_set_isolation_level ( SAConnection conn,
SAIsolationLevel_t  level,
SAException err 
)

Changes the database session isolation level.

Parameters
connThe connection handle
levelThe isolation level
errThe error handle for the detailed diagnostic or 0
See also
SAConnection::setIsolationLevel

◆ sqlapi_alloc_command()

SACommand* sqlapi_alloc_command ( SAConnection conn)

Allocates new command handle.

Parameters
connThe SAConnection handle

After the work is done the received command handle should be released with sqlapi_free_command function.

◆ sqlapi_free_command()

void sqlapi_free_command ( SACommand **  pcmd)

Releases all command handle related resources.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
pcmdPointer to SACommand handle

◆ sqlapi_set_command_option()

void sqlapi_set_command_option ( SACommand cmd,
const SAChar szOption,
const SAChar szValue 
)

Sets SACommand handle option.

See also
SACommand::setOption

◆ sqlapi_execute()

SAErrorClass_t sqlapi_execute ( SACommand cmd,
const SAChar szQuery,
SAException err 
)

Executes SQL command.

Parameters
cmdThe command handle
szQuerySQL command (or 0 - then he previously prepared command executed again)
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_close_command()

SAErrorClass_t sqlapi_close_command ( SACommand cmd,
SAException err 
)

Closes the specified SACommand object.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_rows_affected()

sa_uint64_t sqlapi_rows_affected ( SACommand cmd,
SAException err 
)

Returns number of rows affected by last DML operation.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_reset_command()

void sqlapi_reset_command ( SACommand cmd)

Resets SACommand handle.

Parameters
cmdThe command handle
See also
SACommand::Reset

◆ sqlapi_is_result_set()

SABool_t sqlapi_is_result_set ( SACommand cmd,
SAException err 
)

Checks if any result set exists.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::isResultSet

◆ sqlapi_fetch_next()

SABool_t sqlapi_fetch_next ( SACommand cmd,
SAException err 
)

Fetches next row of the result set.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FetchNext

◆ sqlapi_fetch_prior()

SABool_t sqlapi_fetch_prior ( SACommand cmd,
SAException err 
)

Fetches previous row of the result set.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FetchPrior

◆ sqlapi_fetch_first()

SABool_t sqlapi_fetch_first ( SACommand cmd,
SAException err 
)

Fetches the first row of the result set.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FetchFirst

◆ sqlapi_fetch_last()

SABool_t sqlapi_fetch_last ( SACommand cmd,
SAException err 
)

Fetches the last row of the result set.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FetchLast

◆ sqlapi_fetch_pos()

SABool_t sqlapi_fetch_pos ( SACommand cmd,
int  offset,
SABool_t  relative,
SAException err 
)

Fetches the specified row of the result set.

Parameters
cmdThe command handle
offsetThe row offset
relativeThe offset specified is relative or absolute
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FetchPos

◆ sqlapi_param_count()

int sqlapi_param_count ( SACommand cmd,
SAException err 
)

Returns the command parameters count.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::ParamCount

◆ sqlapi_param_by_index()

SAParam* sqlapi_param_by_index ( SACommand cmd,
int  nIndex,
SAException err 
)

Returns SAParam handle.

Parameters
cmdThe command handle
nIndexThe index of the parameter
errThe error handle for the detailed diagnostic or 0
See also
SACommand::ParamByIndex

◆ sqlapi_param_by_name()

SAParam* sqlapi_param_by_name ( SACommand cmd,
const SAChar szParamByName,
SAException err 
)

Returns SAParam handle.

Parameters
cmdThe command handle
szParamByNameThe name of the parameter
errThe error handle for the detailed diagnostic or 0
See also
SACommand::Param

◆ sqlapi_param_type()

SADataType_t sqlapi_param_type ( const SAParam par)

Returns SAParam type.

Parameters
parThe parameter handle
See also
SAParam::ParamType

◆ sqlapi_param_direction()

SAParamDirType_t sqlapi_param_direction ( const SAParam par)

Returns SAParam direction.

Parameters
parThe parameter handle
See also
SAParam::ParamDirType

◆ sqlapi_param_native_type()

int sqlapi_param_native_type ( const SAParam par)

Returns SAParam native type.

Parameters
parThe parameter handle
See also
SAParam::ParamNativeType

◆ sqlapi_param_size()

size_t sqlapi_param_size ( const SAParam par)

Returns SAParam size.

Parameters
parThe parameter handle
See also
SAParam::ParamSize

◆ sqlapi_param_precision()

int sqlapi_param_precision ( const SAParam par)

Returns SAParam precision.

Parameters
parThe parameter handle
See also
SAParam::ParamPrecision

◆ sqlapi_param_scale()

int sqlapi_param_scale ( const SAParam par)

Returns SAParam scale.

Parameters
parThe parameter handle
See also
SACommand::ParamScale

◆ sqlapi_param_value()

const SAValueRead* sqlapi_param_value ( SACommand cmd,
int  nParamByID,
SAException err 
)

Returns parameter value handle.

Parameters
cmdThe command handle
nParamByIDThe parameter index
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_param_value_by_name()

const SAValueRead* sqlapi_param_value_by_name ( SACommand cmd,
const SAChar szParamByName,
SAException err 
)

Returns parameter value handle.

Parameters
cmdThe command handle
szParamByNameThe parameter name
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_param_set_short()

void sqlapi_param_set_short ( SAParam par,
short  val 
)

Sets the parameter value as short integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_ushort()

void sqlapi_param_set_ushort ( SAParam par,
unsigned short  val 
)

Sets the parameter value as unsigned short integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_int32()

void sqlapi_param_set_int32 ( SAParam par,
sa_int32_t  val 
)

Sets the parameter value as integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_uint32()

void sqlapi_param_set_uint32 ( SAParam par,
sa_uint32_t  val 
)

Sets the parameter value as unsigned integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_int64()

void sqlapi_param_set_int64 ( SAParam par,
sa_int64_t  val 
)

Sets the parameter value as 64-bit integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_uint64()

void sqlapi_param_set_uint64 ( SAParam par,
sa_uint64_t  val 
)

Sets the parameter value as unsigned 64-bit integer.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_string()

void sqlapi_param_set_string ( SAParam par,
const SAString val 
)

Sets the parameter value as string.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_numeric()

void sqlapi_param_set_numeric ( SAParam par,
const SANumeric val 
)

Sets the parameter value as numeric.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_datetime()

void sqlapi_param_set_datetime ( SAParam par,
const SADateTime val 
)

Sets the parameter value as date/time.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_double()

void sqlapi_param_set_double ( SAParam par,
double  val 
)

Sets the parameter value as double.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param_set_bytes()

void sqlapi_param_set_bytes ( SAParam par,
const SAString val 
)

Sets the parameter value as binary data.

Parameters
parThe parameter handle
valThe parameter value

◆ sqlapi_param()

SAParam* sqlapi_param ( SACommand cmd,
int  nParamByID,
SAException err 
)

Returns parameter handle.

Parameters
cmdThe command handle
nParamByIDThe parameter index
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_field_count()

int sqlapi_field_count ( SACommand cmd,
SAException err 
)

Returns the result set field count.

Parameters
cmdThe command handle
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FieldCount

◆ sqlapi_field_exists()

SABool_t sqlapi_field_exists ( SACommand cmd,
const SAChar szField,
SAException err 
)

Checks if the field exists in the result set.

Parameters
cmdThe command handle
szFieldThe field name
errThe error handle for the detailed diagnostic or 0
See also
SACommand::FieldExists

◆ sqlapi_field()

const SAField* sqlapi_field ( SACommand cmd,
int  nField,
SAException err 
)

Returns the result set field handle.

Parameters
cmdThe command handle
nFieldThe field index (starts with 1)
errThe error handle for the detailed diagnostic or 0
See also
SACommand::Field

◆ sqlapi_field_value()

const SAValueRead* sqlapi_field_value ( SACommand cmd,
int  nField,
SAException err 
)

Returns the result set field value handle.

Parameters
cmdThe command handle
nFieldThe field index
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_field_by_name()

const SAField* sqlapi_field_by_name ( SACommand cmd,
const SAChar szField,
SAException err 
)

Returns the result set field handle.

Parameters
cmdThe command handle
szFieldThe field name
errThe error handle for the detailed diagnostic or 0
See also
SACommand::Field

◆ sqlapi_field_value_by_name()

const SAValueRead* sqlapi_field_value_by_name ( SACommand cmd,
const SAChar szField,
SAException err 
)

Returns the result set field value handle.

Parameters
cmdThe command handle
szFieldThe field name
errThe error handle for the detailed diagnostic or 0

◆ sqlapi_field_name()

const SAChar* sqlapi_field_name ( const SAField field)

Returns SAField name.

Parameters
fieldThe field handle
See also
SAField::Name

◆ sqlapi_field_type()

SADataType_t sqlapi_field_type ( const SAField field)

Returns SAField type.

Parameters
fieldThe field handle
See also
SAField::FieldType

◆ sqlapi_field_native_type()

int sqlapi_field_native_type ( const SAField field)

Returns SAField native type.

Parameters
fieldThe field handle
See also
SAField::FieldNativeType

◆ sqlapi_field_data_size()

size_t sqlapi_field_data_size ( const SAField field)

Returns SAField size.

Parameters
fieldThe field handle
See also
SAField::FieldSize

◆ sqlapi_field_precision()

int sqlapi_field_precision ( const SAField field)

Returns SAField precision.

Parameters
fieldThe field handle
See also
SAField::FieldPrecision

◆ sqlapi_field_scale()

int sqlapi_field_scale ( const SAField field)

Returns SAField scale.

Parameters
fieldThe field handle
See also
SAField::FieldScale

◆ sqlapi_value_as_bytes()

SAString* sqlapi_value_as_bytes ( const SAValueRead val)

Returns the binary data of the value.

Parameters
valThe value handle

◆ sqlapi_value_as_cursor()

const SACommand* sqlapi_value_as_cursor ( const SAValueRead val)

Returns the resultset associated with the value.

Parameters
valThe value handle

◆ sqlapi_value_as_double()

double sqlapi_value_as_double ( const SAValueRead val)

Returns the double value.

Parameters
valThe value handle

◆ sqlapi_value_as_datetime()

SADateTime* sqlapi_value_as_datetime ( const SAValueRead val)

Returns the date/time value.

Parameters
valThe value handle

◆ sqlapi_value_as_numeric()

SANumeric* sqlapi_value_as_numeric ( const SAValueRead val)

Returns the numeric value.

Parameters
valThe value handle

◆ sqlapi_value_as_string()

SAString* sqlapi_value_as_string ( const SAValueRead val)

Returns the string value.

Parameters
valThe value handle

◆ sqlapi_value_as_short()

short sqlapi_value_as_short ( const SAValueRead val)

Returns the short value.

Parameters
valThe value handle

◆ sqlapi_value_as_ushort()

unsigned short sqlapi_value_as_ushort ( const SAValueRead val)

Returns the unsigned short value.

Parameters
valThe value handle

◆ sqlapi_value_as_int32()

sa_int32_t sqlapi_value_as_int32 ( const SAValueRead val)

Returns the 32-bit integer value.

Parameters
valThe value handle

◆ sqlapi_value_as_uint32()

sa_uint32_t sqlapi_value_as_uint32 ( const SAValueRead val)

Returns the unsigned 32-bit integer value.

Parameters
valThe value handle

◆ sqlapi_value_as_int64()

sa_int64_t sqlapi_value_as_int64 ( const SAValueRead val)

Returns the 64-bit integer value.

Parameters
valThe value handle

◆ sqlapi_value_as_uint64()

sa_uint64_t sqlapi_value_as_uint64 ( const SAValueRead val)

Returns the unsigned 64-bit integer value.

Parameters
valThe value handle

◆ sqlapi_alloc_string()

SAString* sqlapi_alloc_string ( const SAString src)

Allocates new string handle.

After the work is done the received string handle should be released with sqlapi_free_string function.

◆ sqlapi_free_string()

void sqlapi_free_string ( SAString **  pstr)

Releases the string handle.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
pstrPointer to SAString handle

◆ sqlapi_string_mb()

const char* sqlapi_string_mb ( const SAString str)

Returns the multi-byte string stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_mb_length()

size_t sqlapi_string_mb_length ( const SAString str)

Returns the multi-byte string length stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_set_mb_string()

void sqlapi_string_set_mb_string ( SAString str,
const char *  src,
size_t  len 
)

Sets the multi-byte string into SAString handle.

Parameters
strThe string handle
srcThe source multi-byte string
lenThe source string data length

◆ sqlapi_string_wide()

const wchar_t* sqlapi_string_wide ( const SAString str)

Returns the wide string stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_wide_length()

size_t sqlapi_string_wide_length ( const SAString str)

Returns the wide string length stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_set_wide_string()

void sqlapi_string_set_wide_string ( SAString str,
const wchar_t *  src,
size_t  len 
)

Sets the wide string into SAString handle.

Parameters
strThe string handle
srcThe source wide string
lenThe source string data length

◆ sqlapi_string_utf8()

const char* sqlapi_string_utf8 ( const SAString str)

Returns the UTF-8 string stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_utf8_length()

size_t sqlapi_string_utf8_length ( const SAString str)

Returns the UTF-8 string length stored with SAString handle.

Parameters
strThe string handle

◆ sqlapi_string_set_utf8_string()

void sqlapi_string_set_utf8_string ( SAString str,
const char *  src,
size_t  len 
)

Sets the UTF-8 string into SAString handle.

Parameters
strThe string handle
srcThe source UTF-8 string
lenThe source string data length

◆ sqlapi_string_binary()

const void* sqlapi_string_binary ( const SAString str)

Returns the binary data stored with SAString handle.

Parameters
strSAString handle

◆ sqlapi_string_binary_length()

size_t sqlapi_string_binary_length ( const SAString str)

Returns the binary data length stored with SAString handle.

Parameters
strSAString handle

◆ sqlapi_string_set_binary_string()

void sqlapi_string_set_binary_string ( SAString str,
const void *  src,
size_t  len 
)

Sets the binary data into SAString handle.

Parameters
strSAString handle
srcThe source binary buffer
lenThe source binary buffer length

◆ sqlapi_alloc_numeric()

SANumeric* sqlapi_alloc_numeric ( const SANumeric src)

Allocates new numeric handle.

After the work is done the received numeric handle should be released with sqlapi_free_numeric function.

◆ sqlapi_free_numeric()

void sqlapi_free_numeric ( SANumeric **  pnum)

Releases the numeric handle.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
pnumPointer to SANumeric handle

◆ sqlapi_numeric_string()

SAString* sqlapi_numeric_string ( const SANumeric num)

Converts SANumeric handle value into SAString.

After the work is done the received SAString handle should be released with sqlapi_free function.

◆ sqlapi_numeric_precision()

unsigned char sqlapi_numeric_precision ( const SANumeric num)

Returns SANumeric precision.

Parameters
numSANumeric handle

◆ sqlapi_numeric_scale()

unsigned char sqlapi_numeric_scale ( const SANumeric num)

Returns SANumeric scale.

Parameters
numSANumeric handle

◆ sqlapi_numeric_sign()

unsigned char sqlapi_numeric_sign ( const SANumeric num)

Returns SANumeric sign.

Parameters
numSANumeric handle

◆ sqlapi_numeric_double()

double sqlapi_numeric_double ( const SANumeric num)

Converts SANumeric handle value into double.

Parameters
numSANumeric handle

◆ sqlapi_numeric_int64()

sa_int64_t sqlapi_numeric_int64 ( const SANumeric num)

Converts SANumeric handle value into 64-bit integer.

Parameters
numSANumeric handle

◆ sqlapi_numeric_uint64()

sa_uint64_t sqlapi_numeric_uint64 ( const SANumeric num)

Converts SANumeric handle value into unsigned 64-bit integer.

Parameters
numSANumeric handle

◆ sqlapi_numeric_set_string()

void sqlapi_numeric_set_string ( SANumeric num,
const SAChar val 
)

Converts character string into SANumeric handle value.

Parameters
numSANumeric handle
valcharacter string

◆ sqlapi_numeric_set_double()

void sqlapi_numeric_set_double ( SANumeric num,
double  val 
)

Converts double into SANumeric handle value.

Parameters
numSANumeric handle
valcharacter string

◆ sqlapi_numeric_set_int64()

void sqlapi_numeric_set_int64 ( SANumeric num,
sa_int64_t  val 
)

Converts 64-bit integer into SANumeric handle value.

Parameters
numSANumeric handle
valcharacter string

◆ sqlapi_numeric_set_uint64()

void sqlapi_numeric_set_uint64 ( SANumeric num,
sa_uint64_t  val 
)

Converts unsigned 64-bit integer into SANumeric handle value.

Parameters
numSANumeric handle
valcharacter string

◆ sqlapi_alloc_datetime()

SADateTime* sqlapi_alloc_datetime ( const SADateTime src)

Allocates new datetime handle.

After the work is done the received datetime handle should be released with sqlapi_free_datetime function.

◆ sqlapi_free_datetime()

void sqlapi_free_datetime ( SADateTime **  pdt)

Releases the datetime handle.

Function checks that the parameter passed to it points to non-zero handle.

After all handle related structures are successfully released the handle pointer is set to 0.

Parameters
pdtPointer to SADateTime handle

◆ sqlapi_datetime_string()

SAString* sqlapi_datetime_string ( const SADateTime dt)

Converts SADateTime handle value into SAString.

After the work is done the received SAString handle should be released with sqlapi_free function.

◆ sqlapi_datetime_tm()

struct tm sqlapi_datetime_tm ( const SADateTime dt)

Converts SADateTime handle value into struct tm.

Parameters
dtSADateTime handle

◆ sqlapi_datetime_double()

double sqlapi_datetime_double ( const SADateTime dt)

Converts SADateTime handle value into double.

Parameters
dtSADateTime handle

◆ sqlapi_datetime_year()

int sqlapi_datetime_year ( const SADateTime dt)

Returns the year of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetYear

◆ sqlapi_datetime_month()

int sqlapi_datetime_month ( const SADateTime dt)

Returns the month of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetMonth

◆ sqlapi_datetime_day()

int sqlapi_datetime_day ( const SADateTime dt)

Returns the day of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetDay

◆ sqlapi_datetime_week_day()

int sqlapi_datetime_week_day ( const SADateTime dt)

Returns the week day of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetDayOfWeek

◆ sqlapi_datetime_year_day()

int sqlapi_datetime_year_day ( const SADateTime dt)

Returns the year day of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetDayOfYear

◆ sqlapi_datetime_hour()

int sqlapi_datetime_hour ( const SADateTime dt)

Returns the hour of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetHour

◆ sqlapi_datetime_min()

int sqlapi_datetime_min ( const SADateTime dt)

Returns the minute of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetHour

◆ sqlapi_datetime_sec()

int sqlapi_datetime_sec ( const SADateTime dt)

Returns the second of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::GetSecond

◆ sqlapi_datetime_timezone()

const SAChar* sqlapi_datetime_timezone ( const SADateTime dt)

Returns the timezone of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::Timezone

◆ sqlapi_datetime_fraction()

unsigned int sqlapi_datetime_fraction ( const SADateTime dt)

Returns the fraction of SADateTime handle value.

Parameters
dtSADateTime handle
See also
SADateTime::Fraction

◆ sqlapi_datetime_set_tm()

void sqlapi_datetime_set_tm ( SADateTime dt,
struct tm  val 
)

Converts struct tm into SADateTime handle value.

Parameters
dtSADateTime handle
valstruct tm

◆ sqlapi_datetime_set_double()

void sqlapi_datetime_set_double ( SADateTime dt,
double  val 
)

Converts double into SADateTime handle value.

Parameters
dtSADateTime handle
valstruct tm