#include <AbsSqlStatement.h>
Inheritance diagram for AbsSqlStatement:
Public Member Functions | |
void | setInnerStatement (AbsSqlStatement *stmt) |
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. | |
virtual | ~AbsSqlStatement () |
Protected Member Functions | |
AbsSqlStatement () | |
Protected Attributes | |
AbsSqlStatement * | innerStmt |
AbsSqlConnection * | con |
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.
Definition at line 43 of file AbsSqlStatement.h.
AbsSqlStatement::AbsSqlStatement | ( | ) | [inline, protected] |
virtual AbsSqlStatement::~AbsSqlStatement | ( | ) | [inline, virtual] |
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. |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::bindField(), SqlGwStatement::bindField(), getRecordsFromTargetDb(), insert(), verifyCount(), and verifyPrimKeyFldVal().
Here is the caller graph for this function:
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. |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::bindParam().
Here is the caller graph for this function:
virtual DbRetVal AbsSqlStatement::close | ( | ) | [pure virtual] |
Closes the iterator and makes the statement ready for another execution.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::close(), SqlGwStatement::close(), getInput(), getRecordsFromTargetDb(), Java_csql_jdbc_JSqlStatement_close(), main(), and CSqlOdbcStmt::SQLCloseCursor().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::execute(), SqlGwStatement::execute(), getInput(), getRecordsFromTargetDb(), insert(), Java_csql_jdbc_JSqlStatement_execute(), main(), CSqlOdbcStmt::SQLExecute(), verifyCount(), and verifyPrimKeyFldVal().
Here is the caller graph for this function:
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.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::fetch(), SqlGwStatement::fetch(), getRecordsFromTargetDb(), insert(), verifyCount(), and verifyPrimKeyFldVal().
Here is the caller graph for this function:
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.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::fetchAndPrint(), SqlGwStatement::fetchAndPrint(), getInput(), and main().
Here is the caller graph for this function:
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.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::free(), SqlGwStatement::free(), getInput(), getRecordsFromTargetDb(), insert(), Java_csql_jdbc_JSqlStatement_freeStmt(), main(), CSqlOdbcStmt::resetStmt(), and CSqlOdbcStmt::SQLFreeStmt().
Here is the caller graph for this function:
virtual void* AbsSqlStatement::getFieldValuePtr | ( | int | pos | ) | [pure virtual] |
get FieldValue->value ptr after fetch is done.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::getFieldValuePtr(), SqlGwStatement::getFieldValuePtr(), Java_csql_jdbc_JSqlStatement_getByte(), Java_csql_jdbc_JSqlStatement_getDate(), Java_csql_jdbc_JSqlStatement_getDouble(), Java_csql_jdbc_JSqlStatement_getFloat(), Java_csql_jdbc_JSqlStatement_getInt(), Java_csql_jdbc_JSqlStatement_getLong(), Java_csql_jdbc_JSqlStatement_getShort(), Java_csql_jdbc_JSqlStatement_getString(), Java_csql_jdbc_JSqlStatement_getTime(), Java_csql_jdbc_JSqlStatement_getTimestamp(), and CSqlOdbcStmt::SQLFetch().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::getParamFldInfo(), SqlGwStatement::getParamFldInfo(), SqlLogStatement::prepare(), CSqlOdbcStmt::SQLDescribeParam(), and CSqlOdbcStmt::SQLExecute().
Here is the caller graph for this function:
Retrieves the field info for the required projection field position in statement.
projPos | int - projection field position | |
info | FieldInfo*& - OUT parameter |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by getInput(), SqlLogStatement::getProjFldInfo(), SqlGwStatement::getProjFldInfo(), CSqlOdbcStmt::SQLColAttribute(), CSqlOdbcStmt::SQLDescribeCol(), and CSqlOdbcStmt::SQLFetch().
Here is the caller graph for this function:
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.
Reimplemented in SqlStatement.
Definition at line 69 of file AbsSqlStatement.h.
Referenced by SqlLogStatement::prepare().
Here is the caller graph for this function:
virtual bool AbsSqlStatement::isSelect | ( | ) | [pure virtual] |
Returns whether the statement prepared is select statement.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::isSelect(), SqlGwStatement::isSelect(), Java_csql_jdbc_JSqlStatement_isSelect(), CSqlOdbcStmt::SQLColAttribute(), CSqlOdbcStmt::SQLDescribeCol(), CSqlOdbcStmt::SQLExecute(), CSqlOdbcStmt::SQLFreeStmt(), CSqlOdbcStmt::SQLNumResultCols(), and CSqlOdbcStmt::SQLPrepare().
Here is the caller graph for this function:
virtual void* AbsSqlStatement::next | ( | ) | [pure virtual] |
same as fetch, but does not populate bindFieldValues
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by Java_csql_jdbc_JSqlStatement_next(), SqlLogStatement::next(), SqlGwStatement::next(), and CSqlOdbcStmt::SQLFetch().
Here is the caller graph for this function:
virtual int AbsSqlStatement::noOfParamFields | ( | ) | [pure virtual] |
Retrieves the total number of parameters in the statement.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by SqlLogStatement::execute(), SqlLogStatement::noOfParamFields(), SqlGwStatement::noOfParamFields(), SqlLogStatement::prepare(), CSqlOdbcStmt::SQLDescribeParam(), and CSqlOdbcStmt::SQLExecute().
Here is the caller graph for this function:
virtual int AbsSqlStatement::noOfProjFields | ( | ) | [pure virtual] |
Retrieves the total number of projection fields in the statement.
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by getInput(), SqlLogStatement::noOfProjFields(), SqlGwStatement::noOfProjFields(), CSqlOdbcStmt::SQLColAttribute(), CSqlOdbcStmt::SQLDescribeCol(), and CSqlOdbcStmt::SQLNumResultCols().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by getInput(), getRecordsFromTargetDb(), insert(), Java_csql_jdbc_JSqlStatement_prepare(), main(), SqlLogStatement::prepare(), SqlGwStatement::prepare(), SqlNetworkHandler::processPrepare(), CSqlOdbcStmt::SQLPrepare(), verifyCount(), and verifyPrimKeyFldVal().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setByte(), SqlLogStatement::setByteIntParam(), and SqlGwStatement::setByteIntParam().
Here is the caller graph for this function:
virtual void AbsSqlStatement::setConnection | ( | AbsSqlConnection * | conn | ) | [inline, virtual] |
sets connection handle to be used for subsequent operations
con | SqlConnection* |
Reimplemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Definition at line 54 of file AbsSqlStatement.h.
Referenced by getRecordsFromTargetDb(), insert(), Java_csql_jdbc_JSqlStatement_setConnectionPtr(), main(), SqlNetworkHandler::processPrepare(), remove(), SqlOdbcStatement::setConnection(), SqlLogStatement::setConnection(), SqlGwStatement::setConnection(), CSqlOdbcStmt::SQLPrepare(), verifyCount(), and verifyPrimKeyFldVal().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setDate(), SqlLogStatement::setDateParam(), and SqlGwStatement::setDateParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setDouble(), SqlLogStatement::setDoubleParam(), and SqlGwStatement::setDoubleParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setFloat(), SqlLogStatement::setFloatParam(), and SqlGwStatement::setFloatParam().
Here is the caller graph for this function:
void AbsSqlStatement::setInnerStatement | ( | AbsSqlStatement * | stmt | ) | [inline] |
Definition at line 50 of file AbsSqlStatement.h.
References innerStmt, and stmt.
Referenced by SqlFactory::createStatement().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), getRecordsFromTargetDb(), Java_csql_jdbc_JSqlStatement_setInt(), SqlLogStatement::setIntParam(), and SqlGwStatement::setIntParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), SqlLogStatement::setLongLongParam(), and SqlGwStatement::setLongLongParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setLong(), SqlLogStatement::setLongParam(), and SqlGwStatement::setLongParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setShort(), SqlLogStatement::setShortParam(), and SqlGwStatement::setShortParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setString(), SqlLogStatement::setStringParam(), and SqlGwStatement::setStringParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setTime(), SqlLogStatement::setTimeParam(), and SqlGwStatement::setTimeParam().
Here is the caller graph for this function:
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 |
Implemented in SqlGwStatement, SqlLogStatement, SqlOdbcStatement, and SqlStatement.
Referenced by copyFromOdbc(), Java_csql_jdbc_JSqlStatement_setTimestamp(), SqlLogStatement::setTimeStampParam(), and SqlGwStatement::setTimeStampParam().
Here is the caller graph for this function:
AbsSqlConnection* AbsSqlStatement::con [protected] |
Definition at line 48 of file AbsSqlStatement.h.
Referenced by SqlLogStatement::execute(), SqlLogStatement::free(), SqlOdbcStatement::getPrimaryKeyFieldName(), SqlLogStatement::prepare(), SqlGwStatement::prepare(), SqlOdbcStatement::prepare(), SqlLogStatement::setByteIntParam(), SqlStatement::setConnection(), SqlOdbcStatement::setConnection(), SqlLogStatement::setConnection(), SqlGwStatement::setConnection(), setConnection(), SqlLogStatement::setDateParam(), SqlLogStatement::setDoubleParam(), SqlLogStatement::setFloatParam(), SqlLogStatement::setIntParam(), SqlLogStatement::setLongLongParam(), SqlLogStatement::setLongParam(), SqlLogStatement::setShortParam(), SqlLogStatement::setStringParam(), SqlLogStatement::setTimeParam(), SqlLogStatement::setTimeStampParam(), SqlGwStatement::SqlGwStatement(), SqlLogStatement::SqlLogStatement(), and SqlOdbcStatement::SqlOdbcStatement().
AbsSqlStatement* AbsSqlStatement::innerStmt [protected] |
Definition at line 47 of file AbsSqlStatement.h.
Referenced by SqlLogStatement::bindField(), SqlGwStatement::bindField(), SqlLogStatement::bindParam(), SqlLogStatement::close(), SqlGwStatement::close(), SqlLogStatement::execute(), SqlGwStatement::execute(), SqlLogStatement::fetch(), SqlGwStatement::fetch(), SqlLogStatement::fetchAndPrint(), SqlGwStatement::fetchAndPrint(), SqlLogStatement::free(), SqlGwStatement::free(), SqlLogStatement::getFieldValuePtr(), SqlGwStatement::getFieldValuePtr(), SqlLogStatement::getParamFldInfo(), SqlGwStatement::getParamFldInfo(), SqlLogStatement::getProjFldInfo(), SqlGwStatement::getProjFldInfo(), SqlLogStatement::isSelect(), SqlGwStatement::isSelect(), SqlLogStatement::next(), SqlGwStatement::next(), SqlLogStatement::noOfParamFields(), SqlGwStatement::noOfParamFields(), SqlLogStatement::noOfProjFields(), SqlGwStatement::noOfProjFields(), SqlLogStatement::prepare(), SqlGwStatement::prepare(), SqlOdbcStatement::prepare(), SqlLogStatement::setByteIntParam(), SqlGwStatement::setByteIntParam(), SqlOdbcStatement::setConnection(), SqlLogStatement::setConnection(), SqlGwStatement::setConnection(), SqlLogStatement::setDateParam(), SqlGwStatement::setDateParam(), SqlLogStatement::setDoubleParam(), SqlGwStatement::setDoubleParam(), SqlLogStatement::setFloatParam(), SqlGwStatement::setFloatParam(), setInnerStatement(), SqlLogStatement::setIntParam(), SqlGwStatement::setIntParam(), SqlLogStatement::setLongLongParam(), SqlGwStatement::setLongLongParam(), SqlLogStatement::setLongParam(), SqlGwStatement::setLongParam(), SqlLogStatement::setShortParam(), SqlGwStatement::setShortParam(), SqlLogStatement::setStringParam(), SqlGwStatement::setStringParam(), SqlLogStatement::setTimeParam(), SqlGwStatement::setTimeParam(), SqlLogStatement::setTimeStampParam(), SqlGwStatement::setTimeStampParam(), SqlGwStatement::SqlGwStatement(), SqlLogStatement::SqlLogStatement(), and SqlOdbcStatement::SqlOdbcStatement().