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

#include <SQL.h>

Inheritance diagram for SQLFields:
Object

Public Member Functions

_CONST SQLFieldat (size_t _index) const
_CONST SQLFieldbyName (const wchar_t *_name) _CONST __DCL_THROWS1(InvalidIndexException *)
_CONST SQLFieldoperator[] (size_t _index) const
size_t count () const
bool isEmpty () const
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

 SQLFields ()
virtual ~SQLFields ()
void clear ()
void initialize (SQLQuery *_query)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Friends

class SQLQuery

Detailed Description

Definition at line 208 of file SQL.h.

Constructor & Destructor Documentation

◆ SQLFields()

SQLFields::SQLFields ( )
protected

◆ ~SQLFields()

SQLFields::~SQLFields ( )
protectedvirtual

Definition at line 36 of file SQLQuery.cpp.

37{
38 clear();
39}
void clear()
Definition SQLQuery.cpp:41

Member Function Documentation

◆ at()

_CONST SQLField & SQLFields::at ( size_t _index) const
inline

Definition at line 79 of file SQL.inl.

80{
81 __DCL_ASSERT_PARAM(_index >= 0);
82 __DCL_ASSERT_PARAM(_index < __count);
83 return __fields[_index];
84}
#define __DCL_ASSERT_PARAM(expr)
Definition Object.h:384

◆ byName()

_CONST SQLField & SQLFields::byName ( const wchar_t * _name)

Definition at line 77 of file SQLQuery.cpp.

79{
80 __DCL_ASSERT(_name != NULL);
82
83 SQLField* _field = NULL;
84
85 if (__count >= 7) { // 순차검색 n*n/2 Hashing 3*n
86 if (__fieldMap.isEmpty()) {
87 __fieldMap.initBuckets(__count);
88 for(size_t i = 0; i < __count; i++)
89 __fieldMap[__fields[i].name()] = &__fields[i];
90 }
91 _field = (SQLField*)(__fieldMap[_name]);
92 }
93 else {
94 for(size_t i = 0; i < __count; i++) {
95// if (__fields[i].fieldName() == strFieldName)
96 if (String::compare(__fields[i].name(), _name) == 0) {
97 _field = &__fields[i];
98 break;
99 }
100 }
101 }
102
103 if (_field == NULL) {
104 throw new InvalidIndexException(_name);
105 }
106
107 return *_field;
108}
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371
bool isEmpty() const
Definition SQL.inl:98

◆ clear()

void SQLFields::clear ( )
protected

Definition at line 41 of file SQLQuery.cpp.

42{
43 if (__fields) {
44 __DCL_ASSERT(__count > 0);
45 delete[] __fields;
46 __fields = NULL;
47 __count = 0;
48 }
49 __fieldMap.clear();
50}

◆ count()

size_t SQLFields::count ( ) const
inline

Definition at line 93 of file SQL.inl.

94{
95 return __count;
96}

◆ initialize()

void SQLFields::initialize ( SQLQuery * _query)
protected

Definition at line 52 of file SQLQuery.cpp.

54{
55 SQL::Query* hQuery = _query->handle();
56
57 __DCL_ASSERT(hQuery->fieldCount() > 0);
58 __DCL_ASSERT((__fields == NULL) && (__count == 0));
59
60 clear();
61
62 __count = hQuery->fieldCount();
63 __fields = new SQLField[__count];
64 __DCL_ASSERT(__fields != NULL);
65
66 SQLField* _field = NULL;
67 for(size_t i = 0; i < hQuery->fieldCount(); i++) {
68 _field = &(__fields[i]);
69 _field->__query = _query;
70 if (!hQuery->getField(i, &(_field->__handle))) {
71 throw new SQLException(_query);
72 }
73 }
74}
SQL::Field * __handle
Definition SQL.h:117
SQLQuery * __query
Definition SQL.h:118
SQL::Query * handle() const
Definition SQL.inl:149

◆ isEmpty()

bool SQLFields::isEmpty ( ) const
inline

Definition at line 98 of file SQL.inl.

99{
100 return __count == 0;
101}

◆ operator[]()

_CONST SQLField & SQLFields::operator[] ( size_t _index) const
inline

Definition at line 86 of file SQL.inl.

87{
88 __DCL_ASSERT_PARAM(_index >= 0);
89 __DCL_ASSERT_PARAM(_index < __count);
90 return __fields[_index];
91}

◆ SQLQuery

friend class SQLQuery
friend

Definition at line 222 of file SQL.h.


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