DCL 3.7.4
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 219 of file SQL.h.

Constructor & Destructor Documentation

◆ SQLFields()

SQLFields::SQLFields ( )
protected

◆ ~SQLFields()

SQLFields::~SQLFields ( )
protectedvirtual

Definition at line 37 of file SQLQuery.cpp.

38{
39 clear();
40}
void clear()
Definition SQLQuery.cpp:42

Member Function Documentation

◆ at()

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

Definition at line 41 of file SQL.inl.

42{
43 __DCL_ASSERT_PARAM(_index >= 0);
44 __DCL_ASSERT_PARAM(_index < __count);
45 return __fields[_index];
46}
#define __DCL_ASSERT_PARAM(expr)
Definition Object.h:409

◆ 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:312
#define __DCL_ASSERT(expr)
Definition Object.h:394
bool isEmpty() const
Definition SQL.inl:60

◆ clear()

void SQLFields::clear ( )
protected

Definition at line 42 of file SQLQuery.cpp.

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

◆ count()

size_t SQLFields::count ( ) const
inline

Definition at line 55 of file SQL.inl.

56{
57 return __count;
58}

◆ initialize()

void SQLFields::initialize ( SQLQuery * _query)
protected

Definition at line 53 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, NULL);
72 }
73 }
74}
SQL::Field * __handle
Definition SQL.h:122
SQLQuery * __query
Definition SQL.h:123
SQL::Query * handle() const
Definition SQL.inl:111

◆ isEmpty()

bool SQLFields::isEmpty ( ) const
inline

Definition at line 60 of file SQL.inl.

61{
62 return __count == 0;
63}

◆ operator[]()

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

Definition at line 48 of file SQL.inl.

49{
50 __DCL_ASSERT_PARAM(_index >= 0);
51 __DCL_ASSERT_PARAM(_index < __count);
52 return __fields[_index];
53}

◆ SQLQuery

friend class SQLQuery
friend

Definition at line 233 of file SQL.h.


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