42 #define NCBI_USE_ERRCODE_X Dbapi_Odbc_Cmds
44 #undef NCBI_DATABASE_THROW
45 #define NCBI_DATABASE_THROW(ex_class, message, err_code, severity) \
46 NCBI_ODBC_THROW(ex_class, message, err_code, severity)
54 #define GetDbgInfo() 0
66 const string& proc_name) :
70 string extra_msg =
"Procedure Name: " + proc_name;
101 string main_exec_query(
"declare @STpROCrETURNsTATUS int;\nexec @STpROCrETURNsTATUS=");
103 string param_result_query;
113 bindGuard, indicator)) {
117 string err_message =
"Cannot assign params." +
GetDbgInfo();
124 q_str += main_exec_query +
";\nselect STpROCrETURNsTATUS=@STpROCrETURNsTATUS";
125 if(!param_result_query.empty()) {
126 q_str +=
";\nselect " + param_result_query;
147 string err_message =
"SQLExecDirect failed." +
GetDbgInfo();
161 string err_message =
"Some other query is executing on this connection." +
169 string err_message =
"The statement handler is invalid (memory corruption suspected)." +
179 string err_message =
"Unexpected error." +
GetDbgInfo();
214 enum {eNameStrLen = 64};
223 string err_message =
"A command has to be sent first." +
GetDbgInfo();
237 "SQLNumResultCols failed", 420011);
243 "SQLRowCount failed", 420013);
260 "SQLColAttribute failed", 420015);
326 q_exec +=
n ?
',':
' ';
330 sprintf(p_nm,
"@pR%d",
n);
341 q_exec += name+
'='+name;
342 cmd +=
"declare " + name +
' ' +
type +
";select " + name +
" = ?;";
351 const char* p_name = param_named? name.c_str() : p_nm;
352 if(!q_select.empty()) q_select +=
',';
353 q_select.append(p_name+1);
376 string err_message =
"SQLMoreResults failed." +
GetDbgInfo();
381 string err_message =
"SQLMoreResults failed (memory corruption suspected)." +
Convenience extension of basic_string, supporting implicit conversion to const TChar* in most situati...
void * Alloc(size_t nof_bytes)
virtual bool HasMoreResults(void) const
unique_ptr< CDBParams > m_InParams
virtual bool Send(void)
Send command to the server.
virtual bool Cancel(void)
Cancel the command execution.
virtual int RowCount(void) const
Get the number of rows affected by the command Special case: negative on error or if there is no way ...
virtual ~CODBC_RPCCmd(void)
bool x_AssignParams(string &cmd, string &q_exec, string &q_select, CMemPot &bind_guard, SQLLEN *indicator)
bool xCheck4MoreResults(void)
CODBC_RPCCmd(CODBC_Connection &conn, const string &proc_name)
virtual CDB_Result * Result(void)
Get result set.
virtual CDBParams & GetBindParams(void)
Binding.
const CODBC_Connection::TDbgInfo & GetDbgInfo(void) const
bool x_BindParam_ODBC(const CDB_Object ¶m, CMemPot &bind_guard, SQLLEN *indicator_base, unsigned int pos) const
string Type2String(const CDB_Object ¶m) const
SQLHSTMT GetHandle(void) const
int CheckSIE(int rc, const char *msg, unsigned int msg_num) const
bool ResetParams(void) const
EEncoding GetClientEncoding(void) const
void SetDbgInfo(const string &msg)
CODBC_Connection & GetConnection(void)
void ReportErrors(void) const
const string & GetQuery(void) const
virtual void SetHasFailed(bool flag=true)
const CDB_Params & GetBindParamsImpl(void) const
void DetachInterface(void)
bool NeedToRecompile(void) const
void SetWasSent(bool flag=true)
impl::CConnection & GetConnImpl(void) const
static CDB_Result * Create_Result(CResult &result)
void DropCmd(impl::CCommand &cmd)
CDB_Object * GetParam(unsigned int param_no) const
const string & GetParamName(unsigned int param_no) const
TStatus GetParamStatus(unsigned int param_no) const
unsigned int NofParams() const
static CS_CONNECTION * conn
#define DATABASE_DRIVER_ERROR(message, err_code)
#define NCBI_CURRENT_FUNCTION
Get current function name.
#define NCBI_CATCH_ALL_X(err_subcode, message)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
int strcmp(const char *str1, const char *str2)
TSqlString x_MakeTSqlString(const CTempString &s, EEncoding enc)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define SQL_STILL_EXECUTING
SQLRETURN SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
SQLRETURN SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
#define SQL_INVALID_HANDLE
#define SQL_SUCCESS_WITH_INFO
SQLRETURN SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
SQLRETURN SQLColAttribute(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLINTEGER *NumericAttribute)
SQLRETURN SQLMoreResults(SQLHSTMT hstmt)
signed short int SQLSMALLINT