41 #define NCBI_USE_ERRCODE_X Dbapi_Odbc_Cmds
43 #undef NCBI_DATABASE_THROW
44 #define NCBI_DATABASE_THROW(ex_class, message, err_code, severity) \
45 NCBI_ODBC_THROW(ex_class, message, err_code, severity)
53 #define GetDbgInfo() 0
65 const string& lang_query
75 SetDbgInfo(
"SQL Command: \"" + lang_query +
"\"");
97 string err_message =
"Cannot assign params." +
GetDbgInfo();
102 const string* real_query;
129 string err_message =
"SQLExecDirect failed." +
GetDbgInfo();
143 string err_message =
"Some other query is executing on this connection." +
GetDbgInfo();
150 string err_message =
"The statement handler is invalid (memory corruption suspected)." +
GetDbgInfo();
159 string err_message =
"Unexpected error." +
GetDbgInfo();
201 string err_message =
"A command has to be sent first." +
GetDbgInfo();
214 "SQLNumResultCols failed", 420011);
220 "SQLRowCount failed", 420013);
276 cmd +=
"declare " + name +
' ' +
type +
";select " + name +
" = ?;";
302 string err_message =
"SQLMoreResults failed." +
GetDbgInfo();
307 string err_message =
"SQLMoreResults failed (memory corruption suspected)." +
GetDbgInfo();
326 "SQLSetStmtAttr(SQL_ATTR_CONCURRENCY) failed", 420017);
328 "SQLSetStmtAttr(SQL_ATTR_CURSOR_TYPE) failed", 420018);
334 "SQLSetCursorName failed", 420016);
345 "SQLCloseCursor failed", 420017);
Convenience extension of basic_string, supporting implicit conversion to const TChar* in most situati...
void * Alloc(size_t nof_bytes)
void SetCursorName(const string &name) const
CODBC_LangCmd(CODBC_Connection &conn, const string &lang_query)
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 bool Cancel(void)
Cancel the command execution.
virtual ~CODBC_LangCmd(void)
bool xCheck4MoreResults(void)
virtual bool HasMoreResults(void) const
virtual CDB_Result * Result(void)
Get result set.
virtual bool Send(void)
Send command to the server.
virtual bool CloseCursor(void)
Close the cursor.
bool x_AssignParams(string &cmd, CMemPot &bind_guard, SQLLEN *indicator)
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)
void SetWasSent(bool flag=true)
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).
TSqlString x_MakeTSqlString(const CTempString &s, EEncoding enc)
#define SQL_STILL_EXECUTING
SQLRETURN SQLRowCount(SQLHSTMT StatementHandle, SQLINTEGER *RowCount)
SQLRETURN SQLExecDirect(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)
SQLRETURN SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength)
#define SQL_INVALID_HANDLE
#define SQL_SUCCESS_WITH_INFO
SQLRETURN SQLNumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT *ColumnCount)
SQLRETURN SQLCloseCursor(SQLHSTMT StatementHandle)
SQLRETURN SQLSetCursorName(SQLHSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength)
#define SQL_CURSOR_FORWARD_ONLY
#define SQL_CONCUR_VALUES
#define SQL_ATTR_CURSOR_TYPE
SQLRETURN SQLMoreResults(SQLHSTMT hstmt)
#define SQL_ATTR_CONCURRENCY
signed short int SQLSMALLINT