| 2873 | |
| 2874 | |
| 2875 | Record* VIO_gc_record(thread_db* tdbb, jrd_rel* relation) |
| 2876 | { |
| 2877 | /************************************** |
| 2878 | * |
| 2879 | * V I O _ g c _ r e c o r d |
| 2880 | * |
| 2881 | ************************************** |
| 2882 | * |
| 2883 | * Functional description |
| 2884 | * Allocate from a relation's vector of garbage |
| 2885 | * collect record blocks. Their scope is strictly |
| 2886 | * limited to temporary usage and should never be |
| 2887 | * copied to permanent record parameter blocks. |
| 2888 | * |
| 2889 | **************************************/ |
| 2890 | SET_TDBB(tdbb); |
| 2891 | Database* dbb = tdbb->getDatabase(); |
| 2892 | CHECK_DBB(dbb); |
| 2893 | |
| 2894 | const Format* const format = MET_current(tdbb, relation); |
| 2895 | |
| 2896 | // Set the active flag on an inactive garbage collect record block and return it |
| 2897 | |
| 2898 | for (Record** iter = relation->rel_gc_records.begin(); |
| 2899 | iter != relation->rel_gc_records.end(); |
| 2900 | ++iter) |
| 2901 | { |
| 2902 | Record* const record = *iter; |
| 2903 | fb_assert(record); |
| 2904 | |
| 2905 | if (!record->isTempActive()) |
| 2906 | { |
| 2907 | // initialize record for reuse |
| 2908 | record->reset(format); |
| 2909 | record->setTempActive(); |
| 2910 | return record; |
| 2911 | } |
| 2912 | } |
| 2913 | |
| 2914 | // Allocate a garbage collect record block if all are active |
| 2915 | |
| 2916 | Record* const record = FB_NEW_POOL(*relation->rel_pool) |
| 2917 | Record(*relation->rel_pool, format, true); |
| 2918 | relation->rel_gc_records.add(record); |
| 2919 | return record; |
| 2920 | } |
| 2921 | |
| 2922 | |
| 2923 | bool VIO_get(thread_db* tdbb, record_param* rpb, jrd_tra* transaction, MemoryPool* pool) |
no test coverage detected