NCBI C++ ToolKit
|
#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <freetds/odbc.h>
#include "odbcss.h"
#include <freetds/string.h>
#include "replacements.h"
#include "sqlwparams.h"
#include "error_export.h"
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | s_SqlMsgMap |
struct | s_v3to2map |
Macros | |
#define | ODBCERR(s3, msg) { msg, s3 } |
#define | SQLS_MAP(v2, v3) if (strcmp(p,v2) == 0) {strcpy(p,v3); return;} |
Functions | |
static void | odbc_errs_pop (struct _sql_errors *errs) |
Remove first element. More... | |
static const char * | odbc_get_msg (const char *sqlstate) |
static void | odbc_get_v2state (const char *sqlstate, char *dest_state) |
static void | sqlstate2to3 (char *state) |
static void | rank_errors (struct _sql_errors *errs) |
void | odbc_errs_reset (struct _sql_errors *errs) |
reset errors More... | |
void | odbc_errs_add (struct _sql_errors *errs, const char *sqlstate, const char *msg) |
add an error to list More... | |
void | odbc_errs_add_rdbms (struct _sql_errors *errs, TDS_UINT native, const char *sqlstate, const char *msg, int linenum, int msgstate, const char *server, int row) |
Add an error to list. More... | |
static SQLRETURN | _SQLGetDiagRec (SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLCHAR *szSqlState, SQLINTEGER FAR *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR *pcbErrorMsg) |
static SQLRETURN | _SQLError (SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR *szSqlState, SQLINTEGER FAR *pfNativeError, SQLCHAR *szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR *pcbErrorMsg) |
static SQLRETURN | _SQLGetDiagField (SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLSMALLINT diagIdentifier, SQLPOINTER buffer, SQLSMALLINT cbBuffer, SQLSMALLINT FAR *pcbBuffer) |
Variables | |
static const struct s_SqlMsgMap | SqlMsgMap [] |
static const struct s_v3to2map | v3to2map [] |
|
static |
Definition at line 571 of file error.c.
References _SQLGetDiagRec(), _wide, _sql_errors::errs, odbc_errs_pop(), result, SQL_HANDLE_DBC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_INVALID_HANDLE, SQL_SUCCESS, and type.
Referenced by SQLError().
|
static |
Definition at line 600 of file error.c.
References _SQLRowCount(), buffer, dbc, desc_get_dbc(), env, _sql_errors::errs, FAR, if(), _sql_error::linenum, _sql_error::msg, msg(), _sql_error::msgstate, _sql_error::native, NULL, odbc_set_string_oct, result, _sql_error::row, _sql_error::server, SQL_COLUMN_NUMBER_UNKNOWN, SQL_DIAG_CLASS_ORIGIN, SQL_DIAG_COLUMN_NUMBER, SQL_DIAG_CONNECTION_NAME, SQL_DIAG_CURSOR_ROW_COUNT, SQL_DIAG_DYNAMIC_FUNCTION, SQL_DIAG_DYNAMIC_FUNCTION_CODE, SQL_DIAG_MESSAGE_TEXT, SQL_DIAG_NATIVE, SQL_DIAG_NUMBER, SQL_DIAG_RETURNCODE, SQL_DIAG_ROW_COUNT, SQL_DIAG_ROW_NUMBER, SQL_DIAG_SERVER_NAME, SQL_DIAG_SQLSTATE, SQL_DIAG_SS_LINE, SQL_DIAG_SS_MSGSTATE, SQL_DIAG_SUBCLASS_ORIGIN, SQL_ERROR, SQL_HANDLE_DBC, SQL_HANDLE_DESC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_INVALID_HANDLE, SQL_NO_DATA_FOUND, SQL_OV_ODBC2, SQL_OV_ODBC3, SQL_ROW_NUMBER_UNKNOWN, SQL_SUCCESS, SQLLEN, _sql_error::state2, _sql_error::state3, stmt, switch(), and tmp.
Referenced by SQLGetDiagField().
|
static |
Definition at line 501 of file error.c.
References asprintf, dbc, desc_get_dbc(), _sql_errors::errs, free(), _sql_error::msg, msg(), _sql_error::native, NULL, odbc_set_string, rank_errors(), result, SQL_ERROR, SQL_HANDLE_DBC, SQL_HANDLE_DESC, SQL_HANDLE_ENV, SQL_HANDLE_STMT, SQL_INVALID_HANDLE, SQL_NO_DATA_FOUND, SQL_OV_ODBC2, SQL_OV_ODBC3, _sql_error::state2, _sql_error::state3, TDS_DBG_FUNC, and tdsdump_log.
Referenced by _SQLError(), and SQLGetDiagRec().
void odbc_errs_add | ( | struct _sql_errors * | errs, |
const char * | sqlstate, | ||
const char * | msg | ||
) |
add an error to list
Definition at line 382 of file error.c.
References assert, _sql_errors::errs, _sql_errors::lastrc, _sql_error::msg, msg(), n, _sql_error::native, _sql_errors::num_errors, odbc_get_msg(), odbc_get_v2state(), _sql_error::server, SQL_ERROR, SQL_SUCCESS_WITH_INFO, _sql_error::state2, _sql_error::state3, util::strcmp(), strdup, strlcpy, TDS_DBG_FUNC, TDS_RESIZE, and tdsdump_log.
void odbc_errs_add_rdbms | ( | struct _sql_errors * | errs, |
TDS_UINT | native, | ||
const char * | sqlstate, | ||
const char * | msg, | ||
int | linenum, | ||
int | msgstate, | ||
const char * | server, | ||
int | row | ||
) |
Add an error to list.
This functions is for error that came from server
Definition at line 419 of file error.c.
References _sql_errors::errs, _sql_error::linenum, _sql_error::msg, msg(), _sql_error::msgstate, n, _sql_error::native, _sql_errors::num_errors, odbc_get_msg(), _sql_error::row, row, _sql_error::server, sqlstate2to3(), _sql_error::state2, _sql_error::state3, strdup, strlcpy, and TDS_RESIZE.
|
static |
Remove first element.
Definition at line 363 of file error.c.
References _sql_errors::errs, free(), memmove, _sql_error::msg, _sql_errors::num_errors, odbc_errs_reset(), and _sql_error::server.
Referenced by _SQLError().
void odbc_errs_reset | ( | struct _sql_errors * | errs | ) |
reset errors
Definition at line 343 of file error.c.
References assert, _sql_errors::errs, free(), i, _sql_errors::lastrc, _sql_error::msg, _sql_errors::num_errors, _sql_errors::ranked, _sql_error::server, SQL_SUCCESS, and TDS_ZERO_FREE.
Referenced by odbc_errs_pop().
Definition at line 312 of file error.c.
References s_SqlMsgMap::msg, SqlMsgMap, s_SqlMsgMap::sqlstate, strcasecmp, and strdup.
Referenced by odbc_errs_add(), and odbc_errs_add_rdbms().
Definition at line 327 of file error.c.
References strcasecmp, strlcpy, s_v3to2map::v2, s_v3to2map::v3, and v3to2map.
Referenced by odbc_errs_add().
|
static |
Definition at line 237 of file error.c.
References _sql_errors::errs, _sql_error::msgstate, _sql_error::native, _sql_errors::num_errors, _sql_errors::ranked, _sql_error::row, _sql_error::state3, and util::strcmp().
Referenced by _SQLGetDiagRec().
|
static |
|
static |
Definition at line 45 of file error.c.
Referenced by odbc_get_msg().
|
static |
Definition at line 45 of file error.c.
Referenced by odbc_get_v2state().