| 1952 | |
| 1953 | |
| 1954 | static ArrayField* alloc_array(jrd_tra* transaction, Ods::InternalArrayDesc* proto_desc) |
| 1955 | { |
| 1956 | /************************************** |
| 1957 | * |
| 1958 | * a l l o c _ a r r a y |
| 1959 | * |
| 1960 | ************************************** |
| 1961 | * |
| 1962 | * Functional description |
| 1963 | * Allocate an array block based on a prototype array descriptor. |
| 1964 | * |
| 1965 | **************************************/ |
| 1966 | fb_assert(!transaction->tra_outer); |
| 1967 | |
| 1968 | // Compute size and allocate block |
| 1969 | |
| 1970 | const USHORT n = MAX(proto_desc->iad_struct_count, proto_desc->iad_dimensions); |
| 1971 | ArrayField* array = FB_NEW_RPT(*transaction->tra_pool, n) ArrayField(); |
| 1972 | |
| 1973 | // Copy prototype descriptor |
| 1974 | |
| 1975 | memcpy(&array->arr_desc, proto_desc, proto_desc->iad_length); |
| 1976 | |
| 1977 | // Link into transaction block |
| 1978 | |
| 1979 | array->arr_next = transaction->tra_arrays; |
| 1980 | transaction->tra_arrays = array; |
| 1981 | array->arr_transaction = transaction; |
| 1982 | |
| 1983 | // Allocate large block to hold array |
| 1984 | |
| 1985 | array->arr_data = FB_NEW_POOL(*transaction->tra_pool) UCHAR[array->arr_desc.iad_total_length]; |
| 1986 | array->arr_temp_id = ++transaction->tra_next_blob_id; |
| 1987 | |
| 1988 | return array; |
| 1989 | } |
| 1990 | |
| 1991 | |
| 1992 | blb* blb::allocate_blob(thread_db* tdbb, jrd_tra* transaction) |