| 185 | // Index retrieval block -- hold stuff for index retrieval |
| 186 | |
| 187 | class IndexRetrieval |
| 188 | { |
| 189 | public: |
| 190 | IndexRetrieval(jrd_rel* relation, const index_desc* idx, USHORT count, temporary_key* key) |
| 191 | : irb_relation(relation), irb_index(idx->idx_id), |
| 192 | irb_generic(0), irb_lower_count(count), irb_upper_count(count), irb_key(key), |
| 193 | irb_name(nullptr), irb_value(nullptr), irb_list(nullptr), irb_scale(nullptr) |
| 194 | { |
| 195 | memcpy(&irb_desc, idx, sizeof(irb_desc)); |
| 196 | } |
| 197 | |
| 198 | IndexRetrieval(MemoryPool& pool, jrd_rel* relation, const index_desc* idx, |
| 199 | const MetaName& name) |
| 200 | : irb_relation(relation), irb_index(idx->idx_id), |
| 201 | irb_generic(0), irb_lower_count(0), irb_upper_count(0), irb_key(NULL), |
| 202 | irb_name(FB_NEW_POOL(pool) MetaName(name)), |
| 203 | irb_value(FB_NEW_POOL(pool) ValueExprNode*[idx->idx_count * 2]), |
| 204 | irb_list(nullptr), irb_scale(nullptr) |
| 205 | { |
| 206 | memcpy(&irb_desc, idx, sizeof(irb_desc)); |
| 207 | } |
| 208 | |
| 209 | ~IndexRetrieval() |
| 210 | { |
| 211 | delete irb_name; |
| 212 | delete[] irb_value; |
| 213 | delete[] irb_scale; |
| 214 | } |
| 215 | |
| 216 | index_desc irb_desc; // Index descriptor |
| 217 | jrd_rel* irb_relation; // Relation for retrieval |
| 218 | USHORT irb_index; // Index id |
| 219 | USHORT irb_generic; // Flags for generic search |
| 220 | USHORT irb_lower_count; // Number of segments for retrieval |
| 221 | USHORT irb_upper_count; // Number of segments for retrieval |
| 222 | temporary_key* irb_key; // Key for equality retrieval |
| 223 | MetaName* irb_name; // Index name |
| 224 | ValueExprNode** irb_value; // Matching value (for equality search) |
| 225 | LookupValueList* irb_list; // Matching values list (for IN <list>) |
| 226 | SSHORT* irb_scale; // Scale for int64/int128 key |
| 227 | }; |
| 228 | |
| 229 | // Flag values for irb_generic |
| 230 | const int irb_partial = 1; // Partial match: not all segments or starting of key only |