NCBI C++ ToolKit
|
Search Toolkit Book for CCallableStatement
#include "cstmt_impl.hpp"
(Private to src/dbapi
.)
Public Member Functions | |
CCallableStatement (const string &proc, CConnection *conn) | |
virtual | ~CCallableStatement () |
virtual bool | HasMoreResults () |
Check for more results available. More... | |
virtual int | GetReturnStatus () |
Get return status from the stored procedure. More... | |
virtual void | SetParam (const CVariant &v, const CDBParamVariant ¶m) |
Set input parameters. More... | |
virtual void | SetOutputParam (const CVariant &v, const CDBParamVariant ¶m) |
Set output parameter, which will be returned as resultset. More... | |
virtual void | Execute () |
Execute stored procedure. More... | |
virtual void | ExecuteUpdate () |
Executes stored procedure no results returned. More... | |
virtual void | Close () |
Close statement. More... | |
![]() | |
CStatement (class CConnection *conn) | |
virtual | ~CStatement () |
virtual IResultSet * | GetResultSet () |
Get resulset. More... | |
virtual bool | HasRows () |
Check if resultset has rows. More... | |
virtual bool | Failed () |
Check if the statement failed. More... | |
virtual int | GetRowCount () |
Get total of rows returned. More... | |
virtual void | ExecuteLast () |
Executes the last command (with changed parameters, if any). More... | |
virtual void | PurgeResults () |
Purge results. More... | |
virtual void | Cancel () |
Cancel statement. More... | |
virtual void | ClearParamList () |
Clear parameter list. More... | |
virtual const IResultSetMetaData & | GetParamsMetaData (void) |
Get input parameters metadata. More... | |
virtual IConnection * | GetParentConn () |
Get the parent connection. More... | |
virtual IWriter * | GetBlobWriter (I_BlobDescriptor &d, size_t blob_size, TBlobOStreamFlags flags) |
Get a writer for writing BLOBs using previously created CDB_BlobDescriptor. More... | |
virtual IWriter * | GetBlobWriter (I_BlobDescriptor &d, size_t blob_size, EAllowLog log_it) |
virtual CNcbiOstream & | GetBlobOStream (I_BlobDescriptor &d, size_t blob_size, TBlobOStreamFlags flags, size_t buf_size) |
Get an ostream for writing BLOBs using previously created CDB_BlobDescriptor. More... | |
virtual CNcbiOstream & | GetBlobOStream (I_BlobDescriptor &d, size_t blob_size, EAllowLog log_it, size_t buf_size) |
CConnection * | GetConnection () |
CDB_Result * | GetCDB_Result () |
CDB_LangCmd * | GetLangCmd () |
virtual void | Action (const CDbapiEvent &e) |
virtual void | SetAutoClearInParams (bool flag=true) |
Set auto-clear input parameter flag. More... | |
virtual bool | IsAutoClearInParams (void) const |
Get auto-clear input parameter flag value. More... | |
![]() | |
CActiveObject () | |
virtual | ~CActiveObject () |
void | AddListener (CActiveObject *obj) |
void | RemoveListener (CActiveObject *obj) |
void | Notify (const CDbapiEvent &e) |
string | GetIdent () const |
![]() | |
virtual | ~IEventListener () |
![]() | |
virtual | ~IStatement () |
Destructor. More... | |
![]() | |
virtual | ~ICallableStatement () |
Destructor. More... | |
Protected Member Functions | |
CDB_RPCCmd * | GetRpcCmd () |
virtual void | SendSql (const string &) |
Sends one or more SQL statements to the SQL server. More... | |
virtual void | Execute (const string &) |
Sends one or more SQL statements to the SQL server (NOTE: replaced by the SendSql()) More... | |
virtual void | ExecuteUpdate (const string &) |
Executes SQL statement with no results returned. More... | |
virtual IResultSet * | ExecuteQuery (const string &) |
Exectues SQL statement and returns the first resultset. More... | |
![]() | |
void | x_Send (const string &sql) |
void | SetBaseCmd (I_BaseCmd *cmd) |
I_BaseCmd * | GetBaseCmd () |
void | CacheResultSet (CDB_Result *rs) |
void | SetFailed (bool f) |
void | FreeResources () |
![]() | |
void | SetIdent (const string &name) |
TLList & | GetListenerList () |
![]() | |
IEventListener () | |
Private Attributes | |
int | m_status |
bool | m_StatusIsAvailable |
Additional Inherited Members | |
![]() | |
typedef list< CActiveObject * > | TLList |
Definition at line 43 of file cstmt_impl.hpp.
CCallableStatement::CCallableStatement | ( | const string & | proc, |
CConnection * | conn | ||
) |
Definition at line 47 of file cstmt_impl.cpp.
References conn, proc, CStatement::SetBaseCmd(), and CActiveObject::SetIdent().
|
virtual |
Definition at line 57 of file cstmt_impl.cpp.
References kEmptyStr, NCBI_CATCH_ALL_X, and CActiveObject::Notify().
|
virtual |
Close statement.
Reimplemented from CStatement.
Definition at line 160 of file cstmt_impl.cpp.
References CStatement::FreeResources(), and CActiveObject::Notify().
|
virtual |
Execute stored procedure.
Implements ICallableStatement.
Definition at line 122 of file cstmt_impl.cpp.
References _TRACE, CStatement::ClearParamList(), GetRpcCmd(), CStatement::IsAutoClearInParams(), m_status, m_StatusIsAvailable, CDB_RPCCmd::Send(), and CStatement::SetFailed().
Referenced by ExecuteUpdate().
Sends one or more SQL statements to the SQL server (NOTE: replaced by the SendSql())
sql | SQL statement to execute. |
Reimplemented from ICallableStatement.
Definition at line 69 of file cstmt_impl.hpp.
|
inlineprotectedvirtual |
Exectues SQL statement and returns the first resultset.
If there is more than one resultset, the rest remain pending unless either PurgeResults() is called or next statement is run or the statement is closed. NOTE: Provided only for queries containing a single sql statement returning rows.
sql | SQL statement to execute. |
Reimplemented from ICallableStatement.
Definition at line 71 of file cstmt_impl.hpp.
|
virtual |
Executes stored procedure no results returned.
NOTE: All resultsets are discarded.
Implements ICallableStatement.
Definition at line 139 of file cstmt_impl.cpp.
References Execute(), and CStatement::PurgeResults().
Executes SQL statement with no results returned.
All resultsets are discarded.
sql | SQL statement to execute. |
Reimplemented from ICallableStatement.
Definition at line 70 of file cstmt_impl.hpp.
|
virtual |
Get return status from the stored procedure.
Implements ICallableStatement.
Definition at line 146 of file cstmt_impl.cpp.
References CHECK_NCBI_DBAPI, m_status, and m_StatusIsAvailable.
|
protected |
Definition at line 65 of file cstmt_impl.cpp.
References CStatement::GetBaseCmd().
Referenced by Execute(), SetOutputParam(), and SetParam().
|
virtual |
Check for more results available.
Each call advances to the next result and the current one will be cancelled it not retrieved before next call. The amount of retured results may be bigger than the expected amount due to auxiliary results returned depending on the driver and server platform.
Reimplemented from CStatement.
Definition at line 70 of file cstmt_impl.cpp.
References _TRACE, eDB_StatusResult, CStatement::GetCDB_Result(), CDB_Result::GetItem(), CStatement::HasMoreResults(), m_status, m_StatusIsAvailable, and CDB_Int::Value().
Sends one or more SQL statements to the SQL server.
sql | SQL statement to execute. |
Reimplemented from ICallableStatement.
Definition at line 68 of file cstmt_impl.hpp.
|
virtual |
Set output parameter, which will be returned as resultset.
NOTE: Use CVariant(EDB_Type type) constructor or factory method CVariant::<type>(0) to create empty object of a particular type.
v | Parameter value. |
name | Parameter name. |
Implements ICallableStatement.
Definition at line 110 of file cstmt_impl.cpp.
References CDB_RPCCmd::GetBindParams(), CVariant::GetData(), CDBParamVariant::GetPosition(), GetRpcCmd(), CDBParamVariant::IsPositional(), and CDBParams::Set().
|
virtual |
Set input parameters.
v | Parameter value. |
name | Parameter name. |
Implements ICallableStatement.
Definition at line 99 of file cstmt_impl.cpp.
References CDB_RPCCmd::GetBindParams(), CVariant::GetData(), CDBParamVariant::GetPosition(), GetRpcCmd(), CDBParamVariant::IsPositional(), and CDBParams::Set().
|
private |
Definition at line 74 of file cstmt_impl.hpp.
Referenced by Execute(), GetReturnStatus(), and HasMoreResults().
|
private |
Definition at line 75 of file cstmt_impl.hpp.
Referenced by Execute(), GetReturnStatus(), and HasMoreResults().