DCL 4.0
Loading...
Searching...
No Matches
SQL Class Reference

#include <SQLCore.h>

Classes

class  Connection
struct  Date
struct  DRIVER_MODULE
class  Field
struct  Interval
class  Param
class  Query
struct  Time
struct  TimeStamp

Public Types

enum  Error {
  eNoError = 0 , eServerError , eBadAddress , eOutOfMemory ,
  eNotSupportMethod , eNotSupportStatement , eInvalidConnectionString , eConnected ,
  eNotConnected , eInTransaction , eNotInTransaction , eHaveChildQuery ,
  eNoChildQuery , eNotAvailable , eNotPrepared , eNotExecuted ,
  eNotFetched , eInvalidIndex , eValueIsNull , eNotSupportDataType ,
  eInvalidDataType , eInvalidBufferSize , eOutOfRange , eInvalidData ,
  eInvalidDataSize
}
enum  DataType {
  typeUnknown = 0 , typeInteger , typeUInteger , typeFloat ,
  typeNumeric , typeDate , typeTime , typeTimeStamp ,
  typeTimeStampTz , typeInterval , typeIntervalYm , typeIntervalDs ,
  typeText , typeBinary , typeLongText , typeLongBinary ,
  typeClob , typeBlob , typeInputStream , typeOutputStream
}

Static Public Member Functions

static bool getErrorMessage (wchar_t *_buf, size_t *_buflen, Error _errorCode)
static const wchar_t * dataTypeName (DataType _dataType)

Detailed Description

Definition at line 14 of file SQLCore.h.

Member Enumeration Documentation

◆ DataType

Enumerator
typeUnknown 
typeInteger 
typeUInteger 
typeFloat 
typeNumeric 
typeDate 
typeTime 
typeTimeStamp 
typeTimeStampTz 
typeInterval 
typeIntervalYm 
typeIntervalDs 
typeText 
typeBinary 
typeLongText 
typeLongBinary 
typeClob 
typeBlob 
typeInputStream 
typeOutputStream 

Definition at line 61 of file SQLCore.h.

62{
63 typeUnknown = 0, // C-DataType SQL-Type
64 typeInteger, // int32_t, int64_t TINYINT, SMALLINT, INTEGER, BIGINT
65 typeUInteger, // uint32_t, uint64_t BIT, UTINYINT, USMALLINT, UINTEGER, UBIGINT
66 typeFloat, // float, double REAL, DOUBLE, FLOAT
67 typeNumeric, // INTx, UINTx, float, double, char* NUMBER, DECIMAL
68 typeDate, // SQL::Date DATE
69 typeTime, // SQL::Time TIME
70 typeTimeStamp, // SQL::TimeStamp TIMESTAMP
71 typeTimeStampTz, // SQL::TimeStamp TIMESTAMP WITH TIMEZONE, Oracle 9 Only
72 typeInterval, // SQL::Interval
73 typeIntervalYm, // SQL::Interval INTERVAL YEAR TO SECOND, Oracle 9 Only
74 typeIntervalDs, // SQL::Interval INTERVAL DAY TO SECOND
75 typeText, // char* CHAR, VARCHAR,
76 typeBinary, // byte_t* BINARY, RAW
77 typeLongText, // char* LONG
78 typeLongBinary, // byte_t* LONG RAW
79 typeClob, // Clob direct accessible CLOB
80 typeBlob, // Blob direct accessible BLOB
81
82 // buffer type
83 typeInputStream, // InputStream
84 typeOutputStream // OutputStream
85};
@ typeBinary
Definition SQLCore.h:76
@ typeClob
Definition SQLCore.h:79
@ typeNumeric
Definition SQLCore.h:67
@ typeTime
Definition SQLCore.h:69
@ typeLongBinary
Definition SQLCore.h:78
@ typeUInteger
Definition SQLCore.h:65
@ typeUnknown
Definition SQLCore.h:63
@ typeTimeStamp
Definition SQLCore.h:70
@ typeBlob
Definition SQLCore.h:80
@ typeInputStream
Definition SQLCore.h:83
@ typeTimeStampTz
Definition SQLCore.h:71
@ typeInterval
Definition SQLCore.h:72
@ typeIntervalDs
Definition SQLCore.h:74
@ typeDate
Definition SQLCore.h:68
@ typeOutputStream
Definition SQLCore.h:84
@ typeText
Definition SQLCore.h:75
@ typeFloat
Definition SQLCore.h:66
@ typeInteger
Definition SQLCore.h:64
@ typeIntervalYm
Definition SQLCore.h:73
@ typeLongText
Definition SQLCore.h:77

◆ Error

enum SQL::Error
Enumerator
eNoError 
eServerError 
eBadAddress 
eOutOfMemory 
eNotSupportMethod 
eNotSupportStatement 
eInvalidConnectionString 
eConnected 
eNotConnected 
eInTransaction 
eNotInTransaction 
eHaveChildQuery 
eNoChildQuery 
eNotAvailable 
eNotPrepared 
eNotExecuted 
eNotFetched 
eInvalidIndex 
eValueIsNull 
eNotSupportDataType 
eInvalidDataType 
eInvalidBufferSize 
eOutOfRange 
eInvalidData 
eInvalidDataSize 

Definition at line 18 of file SQLCore.h.

19{
20 eNoError = 0,
21 eServerError, // 서버 혹은 서버 API 호출 에러이다.
22
23 eBadAddress, // 버퍼 혹은 파라메터의 주소가 잘못되었다.
24 eOutOfMemory, // 메모리 할당이 불가능 하다.
25 eNotSupportMethod, // 서버 혹은 드라이버에서 지원하지 않는 메소드 입니다.
26
27 // Connection, Query
29
30 // Connection Errors
32 eConnected, // Connection이 이미 연결되었다.
33 eNotConnected, // 먼저 Connection::open을 호출해야 한다.
34 eInTransaction, // 이미 트랜잭션이 시작되었다.
35 eNotInTransaction, // 트랜잭션 상태가 아니다.
36 eHaveChildQuery, // 이 연결을 사용하는 Query가 있다.
37 eNoChildQuery, // 파괴하려는 Query는 다른곳에서 생성되었다.
38 eNotAvailable, // 값을 얻을 수 없다. for geServerInfo
39
40 // Query Errors
41 eNotPrepared, // 먼저 Query::prepare 를 호출해야 한다.
42 eNotExecuted, // 먼저 Query::execute 를 호출해야 한다.
43 eNotFetched, // 먼저 Query::fetch 를 호출해야 한다.
44 eInvalidIndex, // Field나 Param을 참조하는 잘못된 Index값이다.
45
46 // Field
47 eValueIsNull, // 값이 null 이다
48 eNotSupportDataType, // 서버 혹은 드라이버에서 지원하지 않는 데이터타입이다.
49 eInvalidDataType, // 필드값을 얻거나 파라메터 값을 설정하기 위한 데이터타입이 잘못되었다.
50 eInvalidBufferSize, // 필드 혹은 아웃바인드의 값을 읽고자 하는 버퍼의 크기가 유효하지 않다.
51 // Field::getValue *_pn에 필요한 버퍼의 크기를 리턴
52 eOutOfRange, // typeNumeric에서 버퍼의 데이터타입과 사이즈에 적용하는데 범위를 초과했다.
53
54 // Param
55 eInvalidData, // Param::setData, 잘못된 데이터이다.
56 // 서버API로의 데이터 변환에 실패하였다.
57 eInvalidDataSize // 데이터타입에 해당하는 데이터의 사이즈가 유효하지 않다.
58 // for SQLParam::setValue
59};
@ eOutOfRange
Definition SQLCore.h:52
@ eNotSupportStatement
Definition SQLCore.h:28
@ eOutOfMemory
Definition SQLCore.h:24
@ eNotExecuted
Definition SQLCore.h:42
@ eInvalidBufferSize
Definition SQLCore.h:50
@ eInvalidData
Definition SQLCore.h:55
@ eInvalidConnectionString
Definition SQLCore.h:31
@ eNotSupportDataType
Definition SQLCore.h:48
@ eInvalidIndex
Definition SQLCore.h:44
@ eServerError
Definition SQLCore.h:21
@ eInvalidDataSize
Definition SQLCore.h:57
@ eBadAddress
Definition SQLCore.h:23
@ eInvalidDataType
Definition SQLCore.h:49
@ eNotFetched
Definition SQLCore.h:43
@ eNotConnected
Definition SQLCore.h:33
@ eConnected
Definition SQLCore.h:32
@ eNotInTransaction
Definition SQLCore.h:35
@ eNotSupportMethod
Definition SQLCore.h:25
@ eValueIsNull
Definition SQLCore.h:47
@ eInTransaction
Definition SQLCore.h:34
@ eNotAvailable
Definition SQLCore.h:38
@ eNotPrepared
Definition SQLCore.h:41
@ eHaveChildQuery
Definition SQLCore.h:36
@ eNoError
Definition SQLCore.h:20
@ eNoChildQuery
Definition SQLCore.h:37

Member Function Documentation

◆ dataTypeName()

const wchar_t * SQL::dataTypeName ( DataType _dataType)
static

Definition at line 108 of file SQLCore.cpp.

◆ getErrorMessage()

bool SQL::getErrorMessage ( wchar_t * _buf,
size_t * _buflen,
Error _errorCode )
static

Definition at line 40 of file SQLCore.cpp.

45{
46 static const SQL_ERROR errors[] = {
47 // Core Error
48 __SQLERROR_MSG(eNoError, "No Error"),
49 __SQLERROR_MSG(eServerError, "서버 혹은 서버 API 호출중에 에러가 발생했습니다."),
50 __SQLERROR_MSG(eBadAddress, "버퍼 혹은 파라메터의 주소가 잘못되었습니다."),
51 __SQLERROR_MSG(eOutOfMemory, "메모리 할당이 불가능합니다."),
52 __SQLERROR_MSG(eNotSupportMethod, "서버 혹은 드라이버에서 지원하지 않는 메소드 입니다."),
53
54 // SQL::Connection::execute, SQL::Query::prepare, execute
55 __SQLERROR_MSG(eNotSupportStatement, "이 인터페이스를 통해 실행할 수 없는 SQL 입니다"),
56
57 // SQL::Connection Errors
58 __SQLERROR_MSG(eInvalidConnectionString, "서버 연결을위한 연결문자열의 값이 잘못되었습니다."),
59 __SQLERROR_MSG(eConnected, "서버와 연결되어 있는 상태입니다. 다시 연결할 수 없습니다."),
60 __SQLERROR_MSG(eNotConnected, "서버에 연결되어 있지 않습니다. 연결을 끊을 수 없습니다."),
61 __SQLERROR_MSG(eInTransaction, "트랜잭션 중 입니다. 트랜잭션을 시작할 수 없습니다."),
62 __SQLERROR_MSG(eNotInTransaction, "트랜잭션 상태가 아닙니다. 트랜잭션을 종료할 수 없습니다."),
63 __SQLERROR_MSG(eHaveChildQuery, "이 연결을 사용하는 쿼리 인터페이스가 있습니다."),
64 __SQLERROR_MSG(eNoChildQuery, "이 연결을 사용하는 쿼리 인터페이스가 아닙니다."),
65 __SQLERROR_MSG(eNotAvailable, "서버의 정보를 얻을 수 없습니다."),
66
67 // SQL::Query Errors
68 __SQLERROR_MSG(eNotPrepared, "쿼리가 준비되지 있지 않습니다."),
69 __SQLERROR_MSG(eNotExecuted, "쿼리가 실행되어 있지 않습니다."),
70 __SQLERROR_MSG(eNotFetched, "쿼리가 fetch되어 있지 않습니다."),
71 __SQLERROR_MSG(eInvalidIndex, "필드나 파라메터를 참조하는 인덱스가 잘못되었습니다."),
72
73 // SQL::Field Errors
74 __SQLERROR_MSG(eValueIsNull, "필드의 값이 null 입니다."),
75 __SQLERROR_MSG(eNotSupportDataType, "서버 혹은 드라이버에서 지원하지 않는 데이터타입입니다."),
76 __SQLERROR_MSG(eInvalidDataType, "필드값을 얻거나 파라메터 값을 설정하기 위한 데이터타입이 잘못되었습니다."),
77 __SQLERROR_MSG(eInvalidBufferSize, "필드 혹은 아웃바인드의 값을 읽고자 하는 버퍼의 크기가 잘못되었습니다."),
78 __SQLERROR_MSG(eOutOfRange, "데이터타입과 사이즈로 Numeric 데이터를 얻는데 범위를 초과했습니다."),
79
80 // SQL::Param Errors
81 __SQLERROR_MSG(eInvalidData, "데이터가 잘못되었거나 서버에 적용할수 없는 형식입니다."),
82 __SQLERROR_MSG(eInvalidDataSize, "데이터타입에 적절한 데이터 크기가 아닙니다.")
83 };
84
85 __DCL_ASSERT(_buf != NULL && _buflen != NULL);
86
87 const wchar_t* psz = L"Unknown error code";
88 for(size_t i = 0; i < __countof(errors, SQL_ERROR); i++) {
89 if (_errorCode == errors[i].error) {
90 psz = errors[i].message;
91 break;
92 }
93 }
94
95 size_t len = wcslen(psz);
96 if (*_buflen >= len) {
97 wcsncpy(_buf, psz, len);
98 *_buflen = len;
99 return true;
100 }
101
102 *_buflen = len;
103 return false;
104}
#define NULL
Definition Config.h:340
#define __countof(array, type)
Definition Config.h:365
size_t len
__DCL_BEGIN_NAMESPACE struct __SQL_ERROR SQL_ERROR
#define __SQLERROR_MSG(code, msg)
Definition SQLCore.cpp:37

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