DCL 3.7.4
Loading...
Searching...
No Matches
SQLException Class Reference

#include <SQL.h>

Inheritance diagram for SQLException:
Exception Object

Public Member Functions

 SQLException (SQLConnection *_conn, Exception *_cause)
 SQLException (SQLConnection *_conn, const String &_message)
 SQLException (SQLQuery *_query, Exception *_cause)
 SQLException (SQLQuery *_query, const String &_message)
 SQLException (SQLField *_field, Exception *_cause)
 SQLException (SQLField *_field, const wchar_t *_cast, AsErrorCode errorCode)
 SQLException (SQLField *_field, const wchar_t *_cast, Exception *_cause)
virtual String toString () const
Public Member Functions inherited from Exception
 Exception (Exception *_cause=NULL)
const Exceptioncause () const
String toStringAll () const
virtual void destroy ()
Public Member Functions inherited from Object
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

String getServerMessage (SQL::Connection *_connHandle)
Protected Member Functions inherited from Exception
virtual ~Exception ()
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Additional Inherited Members

Protected Attributes inherited from Exception
Exception__cause

Detailed Description

Definition at line 385 of file SQL.h.

Constructor & Destructor Documentation

◆ SQLException() [1/7]

SQLException::SQLException ( SQLConnection * _conn,
Exception * _cause )

Definition at line 81 of file SQLException.cpp.

83{
84 __DCL_ASSERT(_conn && _conn->handle());
85 __message = _cause ? _cause->toString() :
86 getServerMessage(_conn->handle());
87}
#define NULL
Definition Config.h:312
#define __DCL_ASSERT(expr)
Definition Object.h:394
virtual String toString() const
Definition Exception.cpp:40
Exception(Exception *_cause=NULL)
SQL::Connection * handle() const
Definition SQL.inl:122
String getServerMessage(SQL::Connection *_connHandle)

◆ SQLException() [2/7]

SQLException::SQLException ( SQLConnection * _conn,
const String & _message )

Definition at line 89 of file SQLException.cpp.

91{
92 __DCL_ASSERT(_conn && _conn->handle());
93 __message = getServerMessage(_conn->handle()) + __T(": ");
94 __message = __message + _message;
95}
#define __T(str)
Definition Object.h:60

◆ SQLException() [3/7]

SQLException::SQLException ( SQLQuery * _query,
Exception * _cause )

Definition at line 97 of file SQLException.cpp.

98 : Exception(_cause)
99{
100 __DCL_ASSERT(_query && _query->handle()->connection());
101 __message = _cause ? _cause->toString()
102 : getServerMessage(_query->connection()->handle());
103
104}
SQLConnection * connection() const
Definition SQL.inl:116
SQL::Query * handle() const
Definition SQL.inl:111

◆ SQLException() [4/7]

SQLException::SQLException ( SQLQuery * _query,
const String & _message )

Definition at line 106 of file SQLException.cpp.

107 : Exception(NULL)
108{
109 __DCL_ASSERT(_query && _query->handle()->connection());
110 __message = getServerMessage(_query->connection()->handle()) + __T(": ");
111 __message = __message + _message;
112}

◆ SQLException() [5/7]

SQLException::SQLException ( SQLField * _field,
Exception * _cause )

Definition at line 114 of file SQLException.cpp.

115 : Exception(_cause)
116{
117 __DCL_ASSERT(_field && _field->handle()->connection());
118 StringBuilder sb;
119 sb += _cause ? _cause->toString()
120 : getServerMessage(_field->handle()->connection());
121 sb += __T(": ");
122 sb += _field->name();
123 sb += __T("(");
124 sb += _field->dataTypeName();
125 sb += __T(",");
126 sb += _field->handle()->serverDataTypeName();
127 sb += __T(")");
128 __message = sb.toString();
129}

◆ SQLException() [6/7]

SQLException::SQLException ( SQLField * _field,
const wchar_t * _cast,
AsErrorCode errorCode )

Definition at line 146 of file SQLException.cpp.

150 : Exception(NULL)
151{
152 StringBuilder sb = __T("SQLData access type error: ");
153 sb += _field->name();
154 sb += __T("(");
155 sb += _field->dataTypeName();
156 sb += __T("), access: ");
157 sb += _cast;
158 switch(_errorCode) {
159 case eInvalidCast: {
160 sb += __T(": Data convert impossible");
161 break;
162 }
163 case eOutOfRange: {
164 sb += __T(": Numeric convert out of range");
165 break;
166 }
167 default: {
168 __DCL_ASSERT(false);
169 }
170 }
171 __message = sb.toString();
172}

◆ SQLException() [7/7]

SQLException::SQLException ( SQLField * _field,
const wchar_t * _cast,
Exception * _cause )

Definition at line 131 of file SQLException.cpp.

135 : Exception(_cause)
136{
137 StringBuilder sb = __T("SQLData access type error: ");
138 sb += _field->name();
139 sb += __T("(");
140 sb += _field->dataTypeName();
141 sb += __T("), access: ");
142 sb += _cast;
143 __message = sb.toString();
144}

Member Function Documentation

◆ getServerMessage()

String SQLException::getServerMessage ( SQL::Connection * _connHandle)
protected

◆ toString()

String SQLException::toString ( ) const
virtual

Reimplemented from Exception.

Definition at line 174 of file SQLException.cpp.

175{
176 return __message;
177}

The documentation for this class was generated from the following files: