Lightweight 0.20260303.0
Loading...
Searching...
No Matches
Lightweight::SqlErrorInfo Struct Reference

Represents an ODBC SQL error. More...

#include <SqlError.hpp>

Static Public Member Functions

static SqlErrorInfo FromConnectionHandle (SQLHDBC hDbc)
 Constructs an ODBC error info object from the given ODBC connection handle.
 
static SqlErrorInfo FromStatementHandle (SQLHSTMT hStmt)
 Constructs an ODBC error info object from the given ODBC statement handle.
 
static SqlErrorInfo FromEnvironmentHandle (SQLHENV hEnv)
 Constructs an ODBC error info object from the given ODBC environment handle.
 
static void RequireStatementSuccess (SQLRETURN result, SQLHSTMT hStmt, std::string_view message)
 Asserts that the given result is a success code, otherwise throws an exception.
 

Public Attributes

SQLINTEGER nativeErrorCode {}
 The native ODBC error code.
 
std::string sqlState = " "
 The SQLSTATE diagnostic code (5 characters).
 
std::string message
 The human-readable error message.
 

Detailed Description

Represents an ODBC SQL error.

NOTE: This is a simple wrapper around the SQL return codes. It is not meant to be comprehensive, but rather to provide a simple way to convert SQL return codes to std::error_code.

The code below is DRAFT and may be subject to change.

Definition at line 32 of file SqlError.hpp.

Member Function Documentation

◆ FromConnectionHandle()

static SqlErrorInfo Lightweight::SqlErrorInfo::FromConnectionHandle ( SQLHDBC  hDbc)
inlinestatic

Constructs an ODBC error info object from the given ODBC connection handle.

Definition at line 42 of file SqlError.hpp.

◆ FromStatementHandle()

static SqlErrorInfo Lightweight::SqlErrorInfo::FromStatementHandle ( SQLHSTMT  hStmt)
inlinestatic

Constructs an ODBC error info object from the given ODBC statement handle.

Definition at line 48 of file SqlError.hpp.

Referenced by Lightweight::SqlStatement::Execute(), and Lightweight::SqlStatement::LastError().

◆ FromEnvironmentHandle()

static SqlErrorInfo Lightweight::SqlErrorInfo::FromEnvironmentHandle ( SQLHENV  hEnv)
inlinestatic

Constructs an ODBC error info object from the given ODBC environment handle.

Definition at line 54 of file SqlError.hpp.

Member Data Documentation

◆ nativeErrorCode

SQLINTEGER Lightweight::SqlErrorInfo::nativeErrorCode {}

The native ODBC error code.

Definition at line 35 of file SqlError.hpp.

◆ sqlState

std::string Lightweight::SqlErrorInfo::sqlState = " "

The SQLSTATE diagnostic code (5 characters).

Definition at line 37 of file SqlError.hpp.

◆ message

std::string Lightweight::SqlErrorInfo::message

The human-readable error message.

Definition at line 39 of file SqlError.hpp.


The documentation for this struct was generated from the following file: