Inherited by SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Public Member Functions | |
| virtual void | setConnection (AbsSqlConnection *conn) |
| sets connection handle to be used for subsequent operations | |
| virtual DbRetVal | prepare (char *stmt)=0 |
| compiles the sql statement. | |
| virtual char * | getTableName () |
| Retrieves the tablename of the prepared statement Used internally to get the tablename of the non select DML stmts. | |
| virtual DbRetVal | execute (int &rowsAffect)=0 |
| executes the sql statement. | |
| virtual void * | fetch ()=0 |
| fetches the next tuple from the result of the execution of sql select query. | |
| virtual void * | fetchAndPrint (bool SQL)=0 |
| fetches the next tuple from the result of the execution of sql select query and prints it to stdout. | |
| virtual DbRetVal | bindParam (int pos, void *)=0 |
| binds application buffer to the specified parameter position in the sql statement. | |
| virtual DbRetVal | bindField (int pos, void *val)=0 |
| binds application buffer to the specified field position of the projection list in the select query or for fields in the insert statement. | |
| virtual void * | next ()=0 |
| same as fetch, but does not populate bindFieldValues | |
| virtual DbRetVal | close ()=0 |
| Closes the iterator and makes the statement ready for another execution. | |
| virtual void * | getFieldValuePtr (int pos)=0 |
| get FieldValue->value ptr after fetch is done. | |
| virtual DbRetVal | free ()=0 |
| Frees all the resources held for the sql statement. | |
| virtual int | noOfProjFields ()=0 |
| Retrieves the total number of projection fields in the statement. | |
| virtual int | noOfParamFields ()=0 |
| Retrieves the total number of parameters in the statement. | |
| virtual DbRetVal | getProjFldInfo (int projPos, FieldInfo *&info)=0 |
| Retrieves the field info for the required projection field position in statement. | |
| virtual DbRetVal | getParamFldInfo (int paramPos, FieldInfo *&info)=0 |
| Retrieves the field info for the required parameter position in statement. | |
| virtual void | setShortParam (int paramPos, short value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setIntParam (int paramPos, int value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setLongParam (int paramPos, long value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setLongLongParam (int paramPos, long long value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setByteIntParam (int paramPos, ByteInt value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setFloatParam (int paramPos, float value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setDoubleParam (int paramPos, double value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setStringParam (int paramPos, char *value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setDateParam (int paramPos, Date value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setTimeParam (int paramPos, Time value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual void | setTimeStampParam (int paramPos, TimeStamp value)=0 |
| Sets the value for the required parameter position in statement. | |
| virtual bool | isSelect ()=0 |
| Returns whether the statement prepared is select statement. | |
It is used to execute queries and return the values from the database
Sql Statement is fed to the prepare method first and then it should be executed.
Functionality:
1.Input values for insert statement
2.Iterator for retrieving rows from the table
3.Parameter support for performance.
| virtual DbRetVal AbsSqlStatement::bindField | ( | int | pos, | |
| void * | val | |||
| ) | [pure virtual] |
binds application buffer to the specified field position of the projection list in the select query or for fields in the insert statement.
This method should be called for select queries, insert, update statements. Before executing select queries, required fields must be binded first. Before executing insert statement, required fields must be binded first. Before executing update statement, required fields to be updated must be binded first.
| pos | position in the projection list | |
| val | address of the application buffer. Memory should be allocated by the application before binding the buffer. |
| virtual DbRetVal AbsSqlStatement::bindParam | ( | int | pos, | |
| void * | ||||
| ) | [pure virtual] |
binds application buffer to the specified parameter position in the sql statement.
This method should be called for all the parameters in the sql statement. Parameters shall be specified for predicate for select, update, delete statements. Parameters shall be specified for field list value in SET of update statements. If value is not set for all parameters, execute will return error.
| pos | position of the parameter in the statement | |
| val | address of the application buffer. Memory should be allocated by the application before binding the buffer. |
| virtual DbRetVal AbsSqlStatement::close | ( | ) | [pure virtual] |
| virtual DbRetVal AbsSqlStatement::execute | ( | int & | rowsAffect | ) | [pure virtual] |
executes the sql statement.
For insert, update, delete queries execute performs the required operation on the table. For Select queries, application should call execute before they start fetching the values from the table.This starts scan on the table.
| rowsAffect | number of rows affected by the sql statement |
| virtual void* AbsSqlStatement::fetch | ( | ) | [pure virtual] |
fetches the next tuple from the result of the execution of sql select query.
execute should be called before calling this method. Application buffer should be binded to get the tuple values.
| virtual void* AbsSqlStatement::fetchAndPrint | ( | bool | SQL | ) | [pure virtual] |
fetches the next tuple from the result of the execution of sql select query and prints it to stdout.
execute should be called before calling this method.
| virtual DbRetVal AbsSqlStatement::free | ( | ) | [pure virtual] |
Frees all the resources held for the sql statement.
Needs to be called before calling prepare again on the same statement handle.
| virtual void* AbsSqlStatement::getFieldValuePtr | ( | int | pos | ) | [pure virtual] |
get FieldValue->value ptr after fetch is done.
| virtual DbRetVal AbsSqlStatement::getParamFldInfo | ( | int | paramPos, | |
| FieldInfo *& | info | |||
| ) | [pure virtual] |
Retrieves the field info for the required parameter position in statement.
| projPos | int - parameter position | |
| info | FieldInfo*& - OUT parameter |
| virtual DbRetVal AbsSqlStatement::getProjFldInfo | ( | int | projPos, | |
| FieldInfo *& | info | |||
| ) | [pure virtual] |
Retrieves the field info for the required projection field position in statement.
| projPos | int - projection field position | |
| info | FieldInfo*& - OUT parameter |
| virtual char* AbsSqlStatement::getTableName | ( | ) | [inline, virtual] |
Retrieves the tablename of the prepared statement Used internally to get the tablename of the non select DML stmts.
| virtual bool AbsSqlStatement::isSelect | ( | ) | [pure virtual] |
Returns whether the statement prepared is select statement.
| virtual void* AbsSqlStatement::next | ( | ) | [pure virtual] |
same as fetch, but does not populate bindFieldValues
| virtual int AbsSqlStatement::noOfParamFields | ( | ) | [pure virtual] |
Retrieves the total number of parameters in the statement.
| virtual int AbsSqlStatement::noOfProjFields | ( | ) | [pure virtual] |
Retrieves the total number of projection fields in the statement.
| virtual DbRetVal AbsSqlStatement::prepare | ( | char * | stmt | ) | [pure virtual] |
compiles the sql statement.
It calls the parser and tokenizes the statement into logical plan. This method sets the statement string which needs to be executed. free method needs to be called, if application wants to use the same handle to compile another sql statement.
| stmt | sql statement string |
| virtual void AbsSqlStatement::setByteIntParam | ( | int | paramPos, | |
| ByteInt | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | ByteInt - value to be set |
| virtual void AbsSqlStatement::setConnection | ( | AbsSqlConnection * | conn | ) | [inline, virtual] |
sets connection handle to be used for subsequent operations
| con | SqlConnection* |
| virtual void AbsSqlStatement::setDateParam | ( | int | paramPos, | |
| Date | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | Date - value to be set |
| virtual void AbsSqlStatement::setDoubleParam | ( | int | paramPos, | |
| double | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | double - value to be set |
| virtual void AbsSqlStatement::setFloatParam | ( | int | paramPos, | |
| float | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | float - value to be set |
| virtual void AbsSqlStatement::setIntParam | ( | int | paramPos, | |
| int | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | int - value to be set |
| virtual void AbsSqlStatement::setLongLongParam | ( | int | paramPos, | |
| long long | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | long long - value to be set |
| virtual void AbsSqlStatement::setLongParam | ( | int | paramPos, | |
| long | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | long - value to be set |
| virtual void AbsSqlStatement::setShortParam | ( | int | paramPos, | |
| short | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | short - value to be set |
| virtual void AbsSqlStatement::setStringParam | ( | int | paramPos, | |
| char * | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | char* - value to be set |
| virtual void AbsSqlStatement::setTimeParam | ( | int | paramPos, | |
| Time | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | Time - value to be set |
| virtual void AbsSqlStatement::setTimeStampParam | ( | int | paramPos, | |
| TimeStamp | value | |||
| ) | [pure virtual] |
Sets the value for the required parameter position in statement.
| paramPos | int - parameter position | |
| value | TimeStamp - value to be set |