NCBI C++ ToolKit
Classes | Macros | Functions | Variables
error.c File Reference
#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"
+ Include dependency graph for error.c:

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 []
 

Macro Definition Documentation

◆ ODBCERR

#define ODBCERR (   s3,
  msg 
)    { msg, s3 }

Definition at line 54 of file error.c.

◆ SQLS_MAP

#define SQLS_MAP (   v2,
  v3 
)    if (strcmp(p,v2) == 0) {strcpy(p,v3); return;}

Definition at line 445 of file error.c.

Function Documentation

◆ _SQLError()

static SQLRETURN _SQLError ( SQLHENV  henv,
SQLHDBC  hdbc,
SQLHSTMT  hstmt,
SQLCHAR szSqlState,
SQLINTEGER FAR pfNativeError,
SQLCHAR szErrorMsg,
SQLSMALLINT  cbErrorMsgMax,
SQLSMALLINT FAR pcbErrorMsg 
)
static

◆ _SQLGetDiagField()

static SQLRETURN _SQLGetDiagField ( SQLSMALLINT  handleType,
SQLHANDLE  handle,
SQLSMALLINT  numRecord,
SQLSMALLINT  diagIdentifier,
SQLPOINTER  buffer,
SQLSMALLINT  cbBuffer,
SQLSMALLINT FAR pcbBuffer 
)
static

◆ _SQLGetDiagRec()

static SQLRETURN _SQLGetDiagRec ( SQLSMALLINT  handleType,
SQLHANDLE  handle,
SQLSMALLINT  numRecord,
SQLCHAR szSqlState,
SQLINTEGER FAR pfNativeError,
SQLCHAR szErrorMsg,
SQLSMALLINT  cbErrorMsgMax,
SQLSMALLINT FAR pcbErrorMsg 
)
static

◆ odbc_errs_add()

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, 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.

Referenced by _SQLAllocConnect(), _SQLAllocDesc(), _SQLAllocStmt(), _SQLBindParameter(), _SQLColAttribute(), _SQLConnect(), _SQLDescribeCol(), _SQLDriverConnect(), _SQLExecDirect(), _SQLExecute(), _SQLFetch(), _SQLFreeDesc(), _SQLFreeStmt(), _SQLGetConnectAttr(), _SQLGetCursorName(), _SQLGetDescField(), _SQLGetDescRec(), _SQLGetInfo(), _SQLGetStmtAttr(), _SQLNativeSql(), _SQLParamData(), _SQLSetConnectAttr(), _SQLSetCursorName(), _SQLSetDescField(), _SQLSetStmtAttr(), _SQLSpecialColumns(), _SQLStatistics(), _SQLTables(), change_autocommit(), change_database(), change_transaction(), change_txn(), continue_parse_prepared_query(), odbc_build_update_params(), odbc_col_setname(), odbc_connect(), odbc_convert_char(), odbc_convert_err_set(), odbc_cursor_execute(), odbc_errmsg_handler(), odbc_get_dsn_info(), odbc_lock_statement(), odbc_parse_connect_string(), odbc_populate_ird(), odbc_prepare(), odbc_process_tokens(), odbc_sql2tds(), odbc_stat_execute(), odbc_tds2sql(), odbc_wstr2str(), parse_prepared_query(), parse_server(), prepare_call(), prepared_rpc(), SQLBindCol(), SQLCopyDesc(), SQLExtendedFetch(), SQLGetData(), SQLGetTypeInfo(), SQLMoreResults(), SQLNumResultCols(), SQLPutData(), SQLSetDescRec(), SQLSetPos(), and SQLSetScrollOptions().

◆ odbc_errs_add_rdbms()

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 
)

◆ odbc_errs_pop()

static void odbc_errs_pop ( struct _sql_errors errs)
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().

◆ odbc_errs_reset()

void odbc_errs_reset ( struct _sql_errors errs)

◆ odbc_get_msg()

static const char * odbc_get_msg ( const char *  sqlstate)
static

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().

◆ odbc_get_v2state()

static void odbc_get_v2state ( const char *  sqlstate,
char *  dest_state 
)
static

Definition at line 327 of file error.c.

References strcasecmp, strlcpy, s_v3to2map::v2, s_v3to2map::v3, and v3to2map.

Referenced by odbc_errs_add().

◆ rank_errors()

static void rank_errors ( struct _sql_errors errs)
static

◆ sqlstate2to3()

static void sqlstate2to3 ( char *  state)
static

Definition at line 447 of file error.c.

References SQLS_MAP.

Referenced by odbc_errs_add_rdbms().

Variable Documentation

◆ SqlMsgMap

const struct s_SqlMsgMap SqlMsgMap[]
static

Definition at line 45 of file error.c.

Referenced by odbc_get_msg().

◆ v3to2map

const struct s_v3to2map v3to2map[]
static

Definition at line 45 of file error.c.

Referenced by odbc_get_v2state().

Modified on Mon Mar 04 05:14:17 2024 by modify_doxy.py rev. 669887