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 
)

◆ 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 Fri Sep 20 14:57:45 2024 by modify_doxy.py rev. 669887