1 <?php
2
3 4 5 6 7 8 9
10 class rex_sql_column
11 {
12 private $name;
13 private $type;
14 private $nullable;
15 private $default;
16 private ;
17
18 private $modified = false;
19
20 21 22 23 24 25 26
27 public function __construct($name, $type, $nullable = false, $default = null, $extra = null)
28 {
29 $this->name = $name;
30 $this->type = $type;
31 $this->nullable = $nullable;
32 $this->default = $default;
33 $this->extra = $extra;
34 }
35
36 37 38 39 40
41 public function setModified($modified)
42 {
43 $this->modified = $modified;
44
45 return $this;
46 }
47
48 49 50
51 public function isModified()
52 {
53 return $this->modified;
54 }
55
56 57 58 59 60
61 public function setName($name)
62 {
63 $this->name = $name;
64
65 return $this->setModified(true);
66 }
67
68 69 70
71 public function getName()
72 {
73 return $this->name;
74 }
75
76 77 78 79 80
81 public function setType($type)
82 {
83 $this->type = $type;
84
85 return $this->setModified(true);
86 }
87
88 89 90
91 public function getType()
92 {
93 return $this->type;
94 }
95
96 97 98 99 100
101 public function setNullable($nullable)
102 {
103 $this->nullable = $nullable;
104
105 return $this->setModified(true);
106 }
107
108 109 110
111 public function isNullable()
112 {
113 return $this->nullable;
114 }
115
116 117 118 119 120
121 public function setDefault($default)
122 {
123 $this->default = $default;
124
125 return $this->setModified(true);
126 }
127
128 129 130
131 public function getDefault()
132 {
133 return $this->default;
134 }
135
136 137 138 139 140
141 public function ($extra)
142 {
143 $this->extra = $extra;
144
145 return $this->setModified(true);
146 }
147
148 149 150
151 public function ()
152 {
153 return $this->extra;
154 }
155
156 157 158
159 public function equals(self $column)
160 {
161 return
162 $this->name === $column->name &&
163 $this->type === $column->type &&
164 $this->nullable === $column->nullable &&
165 $this->default === $column->default &&
166 $this->extra === $column->extra;
167 }
168 }
169