DCL 3.7.4
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 , eBytesTruncated ,
  eInvalidData , eInvalidDataSize
}
enum  DataType {
  typeUnknown = 0 , typeInteger , typeUInteger , typeFloat ,
  typeNumeric , typeDate , typeTime , typeTimeTz ,
  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 
typeTimeTz 
typeTimeStamp 
typeTimeStampTz 
typeInterval 
typeIntervalYm 
typeIntervalDs 
typeText 
typeBinary 
typeLongText 
typeLongBinary 
typeClob 
typeBlob 
typeInputStream 
typeOutputStream 

Definition at line 58 of file SQLCore.h.

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

◆ 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 
eBytesTruncated 
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, Param
47 eValueIsNull, // 값이 null 이다
48 eNotSupportDataType, // 서버 혹은 드라이버에서 지원하지 않는 데이터타입이다.
49 eInvalidDataType, // 필드값을 얻거나 파라메터 값을 설정하기 위한 데이터타입이 잘못되었다.
50 eInvalidBufferSize, // 필드 혹은 아웃바인드의 값을 읽고자 하는 버퍼의 크기가 유효하지 않다.
51 // Field::getValue *_size에 필요한 버퍼의 크기를 리턴
52 eOutOfRange, // typeNumeric에서 버퍼의 데이터타입과 사이즈에 적용하는데 범위를 초과했다.
53 eBytesTruncated, // 문자열 또는 바이트 데이터가 크거나, 버퍼의 크기가 작다.
54 eInvalidData, // 수신된 데이터가 잘못되었거나, 서버에 적용하는데 실패하였다.
55 eInvalidDataSize // 데이터타입에 해당하는 데이터의 사이즈가 유효하지 않다.
56};
@ 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:54
@ eInvalidConnectionString
Definition SQLCore.h:31
@ eNotSupportDataType
Definition SQLCore.h:48
@ eInvalidIndex
Definition SQLCore.h:44
@ eServerError
Definition SQLCore.h:21
@ eInvalidDataSize
Definition SQLCore.h:55
@ 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
@ eBytesTruncated
Definition SQLCore.h:53
@ eNoChildQuery
Definition SQLCore.h:37

Member Function Documentation

◆ dataTypeName()

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

◆ getErrorMessage()

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

Definition at line 38 of file SQLCore.cpp.

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

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