| 297 | |
| 298 | |
| 299 | void Sort::get(thread_db* tdbb, ULONG** record_address) |
| 300 | { |
| 301 | /************************************** |
| 302 | * |
| 303 | * Get a record from sort (in order, of course). |
| 304 | * The address of the record is returned in <record_address> |
| 305 | * If the stream is exhausted, SORT_get puts NULL in <record_address>. |
| 306 | * |
| 307 | **************************************/ |
| 308 | sort_record* record = NULL; |
| 309 | |
| 310 | try |
| 311 | { |
| 312 | record = getRecord(); |
| 313 | *record_address = (ULONG*) record; |
| 314 | |
| 315 | if (record) |
| 316 | { |
| 317 | diddleKey((UCHAR*) record->sort_record_key, false, false); |
| 318 | } |
| 319 | } |
| 320 | catch (const BadAlloc&) |
| 321 | { |
| 322 | Firebird::Arg::Gds(isc_sort_mem_err).raise(); |
| 323 | } |
| 324 | catch (const status_exception& ex) |
| 325 | { |
| 326 | Firebird::Arg::Gds status(isc_sort_err); |
| 327 | status.append(Firebird::Arg::StatusVector(ex.value())); |
| 328 | status.raise(); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | |
| 333 | void Sort::put(thread_db* tdbb, ULONG** record_address) |