Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

AlpSALStatement APIs
[SQL Abstraction Layer]


Functions

alp_status_t alp_sal_statement_initialize (AlpSALHandle sal, AlpSALStatement **stmt, const char *sql)
AlpSALHandle alp_sal_statement_get_handle (AlpSALStatement *stmt)
alp_status_t alp_sal_statement_set_text (AlpSALStatement *stmt, int16_t pos, const char *s, bool copy)
alp_status_t alp_sal_statement_set_int (AlpSALStatement *stmt, int16_t pos, int32_t n)
alp_status_t alp_sal_statement_set_int64 (AlpSALStatement *stmt, int16_t pos, int64_t n)
alp_status_t alp_sal_statement_set_blob (AlpSALStatement *stmt, int16_t pos, void *blob, int32_t size, bool copy)
alp_status_t alp_sal_statement_set_float (AlpSALStatement *stmt, int16_t pos, float f)
int32_t alp_sal_statement_get_int (AlpSALStatement *stmt, int pos)
int64_t alp_sal_statement_get_int64 (AlpSALStatement *stmt, int pos)
float alp_sal_statement_get_float (AlpSALStatement *stmt, int pos)
char * alp_sal_statement_get_text (AlpSALStatement *stmt, int pos, bool copy)
void * alp_sal_statement_get_blob (AlpSALStatement *stmt, int pos, int32_t *size, bool copy)
bool alp_sal_statement_is_null (AlpSALStatement *stmt, int pos)
alp_status_t alp_sal_statement_execute (AlpSALStatement *stmt)
alp_status_t alp_sal_statement_destroy (AlpSALStatement *stmt)
alp_status_t alp_sal_statement_next_result (AlpSALStatement *stmt)
alp_status_t alp_sal_statement_reset (AlpSALStatement *stmt)


Function Documentation

alp_status_t alp_sal_statement_destroy AlpSALStatement stmt  ) 
 

Destroys a AlpSALStatement. Should always be called after you are done using a AlpSALStatement.

Parameters:
[in] stmt The AlpSALStatement to destroy
Returns:
alp_status_t

alp_status_t alp_sal_statement_execute AlpSALStatement stmt  ) 
 

Executes a AlpSALStatement that has been initalized with alp_sal_statement_initialize, and bound to any host parameters required by its SQL statement using AlpSALStatementSet commands.

Parameters:
[in] stmt AlpSALStatement to execute.
Returns:
alp_status_t

void* alp_sal_statement_get_blob AlpSALStatement stmt,
int  pos,
int32_t *  size,
bool  copy
 

Retrieves blob value from column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with SALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
[in] copy true if a copy of the blob should be made before assigning to the text parameter
Returns:
pointer to data in indicated column of current row of stmt, or NULL if statement parameter was invalid

float alp_sal_statement_get_float AlpSALStatement stmt,
int  pos
 

Retrieves float value from column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with SALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
Returns:
float in indicated column of current row of stmt

AlpSALHandle alp_sal_statement_get_handle AlpSALStatement stmt  ) 
 

Returns the AlpSALHandle bound to the statement, or NULL, if the stmt handle is invalid

int32_t alp_sal_statement_get_int AlpSALStatement stmt,
int  pos
 

Retrieves integer value from column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with AlpSALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
Returns:
integer in indicated column of current row of stmt

int64_t alp_sal_statement_get_int64 AlpSALStatement stmt,
int  pos
 

Retrieves 64 bit integer value from column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with AlpSALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
Returns:
integer in indicated column of current row of stmt

char* alp_sal_statement_get_text AlpSALStatement stmt,
int  pos,
bool  copy
 

Retrieves text value from column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with SALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
[in] copy true if a copy of the string should be made before assigning to the text parameter
Returns:
string (or copy) in indicated column of current row of stmt

alp_status_t alp_sal_statement_initialize AlpSALHandle  sal,
AlpSALStatement **  stmt,
const char *  sql
 

Mallocs and initializes a AlpSALStatement pointed to by the AlpSALStatement handle parameter. The AlpSALStatement is only valid for the lifetime of the SALHandle. Once a SALHandle is closed or destroyed, or the AlpSALStatement is no longer, needed, it should be destroyed with AlpSALStatementDestroy.

After initializing a AlpSALStatement, the user should call the appropriate AlpSALStatementSet API's, in order, once for each host variable that needs to be bound to a variable in the given sql string (ie, variables of the form "FieldName = ?").

Parameters:
[in] sal Handle to datamodel statement will execute against
[out] stmt A newly allocated AlpSALStatement that will contain a copy of the given string.
[in] sql A sql statement possibly containing substitution variables ("X = ?")
Returns:
alp_status_t

bool alp_sal_statement_is_null AlpSALStatement stmt,
int  pos
 

Checks for NULL value in column of current result in stmt.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly prepared and stepped with SALStatementNextResult()
[in] pos column to retrieve from current row (0 is the first row). Passing -1 causes the statement to use and increment an internal counter; useful if you want to retrieve all column values in the order they were specified in the SQL statement
Returns:
bool true if the value is NULL

alp_status_t alp_sal_statement_next_result AlpSALStatement stmt  ) 
 

Given a prepared statement containing a single SELECT statement, any substitution variable it contains bound to the appropriate host variables, this routine will advance to the next result matching the query.

Although this function will execute any statement without producing an error, it is important for the caller to only use this function to advance to the next result in a selection statement to ensure that notifications are handled properly

Parameters:
[in] stmt containing SELECT statement with substitution variables bound to the appropriate host variables
Returns:
alp_status_t: ALP_STATUS_SAL_NORECORDS if no records match the select statement or the statement has already found the last matching record. ALP_STATUS_OK, if a matching row is found

alp_status_t alp_sal_statement_reset AlpSALStatement stmt  ) 
 

Resets a SQL query in a AlpSALStatement so it's ready to be re-executed. Any variables set in the statement retain their values, but SALStatementNextResult will return the first result in the query again.

Parameters:
[in] stmt AlpSALStatement handle for a query statement that has been properly
Returns:
alp_status_t

alp_status_t alp_sal_statement_set_blob AlpSALStatement stmt,
int16_t  pos,
void *  blob,
int32_t  size,
bool  copy
 

Given a AlpSALStatement and a host blob variable, we bind the variable to the statement.

Parameters:
[in] stmt to bind the host variable to. of the given string.
[in] pos Position of the substitution variable in the AlpSALStatement's SQL command (ie "?"). Position indicies start at 1 for the first variable. Pass a -1 will cause the AlpSALStatement to use and increment an internal counter which is useful if you plan to set all substitution variables in order.
[in] blob A host varabile that will be bound into the statement
[in] size Number of bytes in blob
[in] copy true if the Data Model should make it's own copy of the data provided.
Returns:
alp_status_t

alp_status_t alp_sal_statement_set_float AlpSALStatement stmt,
int16_t  pos,
float  f
 

Given a AlpSALStatement and a host float variable, we bind the variable to the statement.

Parameters:
[in] stmt to bind the host variable to. of the given string.
[in] pos Position of the substitution variable in the AlpSALStatement's SQL command (ie "?"). Position indicies start at 1 for the first variable. Pass a -1 will cause the AlpSALStatement to use and increment an internal counter which is useful if you plan to set all substitution variables in order.
[in] f A host varabile that will be bound into the statement
Returns:
alp_status_t

alp_status_t alp_sal_statement_set_int AlpSALStatement stmt,
int16_t  pos,
int32_t  n
 

Given a AlpSALStatement and a host integer variable, we bind the variable to the statement.

Parameters:
[in] stmt to bind the host variable to. of the given string.
[in] pos Position of the substitution variable in the AlpSALStatement's SQL command (ie "?"). Position indicies start at 1 for the first variable. Pass a -1 will cause the AlpSALStatement to use and increment an internal counter which is useful if you plan to set all substitution variables in order.
[in] n A host varabiale that will be bound into the statement
Returns:
alp_status_t

alp_status_t alp_sal_statement_set_int64 AlpSALStatement stmt,
int16_t  pos,
int64_t  n
 

Given a AlpSALStatement and a host integer variable, we bind the variable to the statement.

Parameters:
[in] stmt to bind the host variable to. of the given string.
[in] pos Position of the substitution variable in the AlpSALStatement's SQL command (ie "?"). Position indicies start at 1 for the first variable. Pass a -1 will cause the AlpSALStatement to use and increment an internal counter which is useful if you plan to set all substitution variables in order.
[in] n A host varabiale that will be bound into the statement
Returns:
alp_status_t

alp_status_t alp_sal_statement_set_text AlpSALStatement stmt,
int16_t  pos,
const char *  s,
bool  copy
 

Given a AlpSALStatement and a host text variable, we bind the variable to the statement.

Parameters:
[in] stmt to bind the host variable to. of the given string.
[in] pos Position of the substitution variable in the AlpSALStatement's SQL command (ie "?"). Position indicies start at 1 for the first variable. Pass a -1 will cause the AlpSALStatement to use and increment an internal counter which is useful if you plan to set all substitution variables in order.
[in] s A text host varabile that will be bound into the statement
[in] copy true if the Data Model should make it's own copy of the data provided.
Returns:
alp_status_t


Generated on Sat Dec 16 20:29:50 2006 for hiker-0.9 by  doxygen 1.4.4