Lightweight 0.1.0
Loading...
Searching...
No Matches
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 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 {}
 
std::string sqlState = " "
 
std::string 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 28 of file SqlError.hpp.

Member Function Documentation

◆ fromConnectionHandle()

static SqlErrorInfo SqlErrorInfo::fromConnectionHandle ( SQLHDBC  hDbc)
inlinestatic

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

Definition at line 35 of file SqlError.hpp.

◆ fromStatementHandle()

static SqlErrorInfo SqlErrorInfo::fromStatementHandle ( SQLHSTMT  hStmt)
inlinestatic

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

Definition at line 41 of file SqlError.hpp.

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

Member Data Documentation

◆ nativeErrorCode

SQLINTEGER SqlErrorInfo::nativeErrorCode {}

Definition at line 30 of file SqlError.hpp.

◆ sqlState

std::string SqlErrorInfo::sqlState = " "

Definition at line 31 of file SqlError.hpp.

◆ message

std::string SqlErrorInfo::message

Definition at line 32 of file SqlError.hpp.


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