-
Notifications
You must be signed in to change notification settings - Fork 0
/
Attribute.cpp
executable file
·79 lines (69 loc) · 1.24 KB
/
Attribute.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "Attribute.h"
Attribute::Attribute(int id, int position, const std::string & name,
const std::string & table, size_t size, field_type_t type) :
m_id(id), m_position(position), m_name(name), m_table(table), m_qname(table + "." + name),
m_size(size), m_type(type)
{
}
int Attribute::id() const
{
return m_id;
}
int Attribute::position() const
{
return m_position;
}
const std::string & Attribute::name() const
{
return m_name;
}
const std::string & Attribute::table() const
{
return m_table;
}
const std::string & Attribute::qualified_name() const
{
return m_qname;
}
size_t Attribute::size() const
{
return m_size;
}
field_type_t Attribute::type() const
{
return m_type;
}
field_type_t Attribute::type(const std::string & t)
{
switch (t[0])
{
case 'I':
return INTEGER;
case 'R':
return REAL;
case 'C':
return CHAR;
case 'S':
return STRING;
case 'B':
default:
return BIT;
}
}
const char * Attribute::description(field_type_t t)
{
switch (t)
{
case INTEGER:
return "INTEGER";
case REAL:
return "REAL";
case CHAR:
return "CHAR";
case STRING:
return "STRING";
case BIT:
default:
return "BIT";
}
}