Data Structures | Enumerations | Functions
sql_statement.h File Reference

Prepared statement. More...

Data Structures

struct  vtm_sql_stmt
 

Enumerations

enum  vtm_sql_stmt_state { VTM_SQL_STMT_STATE_READY, VTM_SQL_STMT_STATE_OPEN_RESULT }
 

Functions

VTM_API int vtm_sql_stmt_bind (struct vtm_sql_stmt *stmt, vtm_dataset *bind)
 
VTM_API int vtm_sql_stmt_execute (struct vtm_sql_stmt *stmt)
 
VTM_API int vtm_sql_stmt_query (struct vtm_sql_stmt *stmt, struct vtm_sql_result *result)
 
VTM_API void vtm_sql_stmt_release (struct vtm_sql_stmt *stmt)
 

Function Documentation

VTM_API int vtm_sql_stmt_bind ( struct vtm_sql_stmt stmt,
vtm_dataset bind 
)

Bind parameters to statement.

Parameters
stmtthe statement where the parameters should be bound to
bindthe dataset containing the parameter values
Returns
VTM_OK if parameter successfully bound
VTM_E_SQL_PENDING_RESULT if there is an open resultset from this statement that has not been processed yet
VTM_E_SQL_UNKOWN or VTM_ERROR if an unknown error occured
VTM_API int vtm_sql_stmt_execute ( struct vtm_sql_stmt stmt)

Executes the statement.

Parameters
stmtthe statement that should be executed
Returns
VTM_OK if the statment was successfully executed
VTM_E_SQL_PENDING_RESULT if there is an open resultset from this statement that has not been processed yet
VTM_E_SQL_UNKOWN or VTM_ERROR if an unknown error occured
VTM_API int vtm_sql_stmt_query ( struct vtm_sql_stmt stmt,
struct vtm_sql_result result 
)

Executes the statement and returns a result set.

Parameters
stmtthe statement that should be executed
resultresult set that should be initialized
Returns
VTM_OK if the statment was successfully executed
VTM_E_SQL_PENDING_RESULT if there is already an open resultset from this statement that has not been processed yet
VTM_E_SQL_NO_RESULT if the executed statement does not return rows for example an INSERT or UPDATE statement
VTM_E_SQL_UNKOWN or VTM_ERROR if an unknown error occured
VTM_API void vtm_sql_stmt_release ( struct vtm_sql_stmt stmt)

Releases the statement.

After this call the statement is no longer valid for use in other functions.

Parameters
stmtthe statement that should be released