| 1899 | |
| 1900 | |
| 1901 | void blb::scalar(thread_db* tdbb, |
| 1902 | jrd_tra* transaction, |
| 1903 | const bid* blob_id, |
| 1904 | USHORT count, |
| 1905 | const SLONG* subscripts, |
| 1906 | impure_value* value) |
| 1907 | { |
| 1908 | /************************************** |
| 1909 | * |
| 1910 | * b l b : : s c a l a r |
| 1911 | * |
| 1912 | ************************************** |
| 1913 | * |
| 1914 | * Functional description |
| 1915 | * |
| 1916 | **************************************/ |
| 1917 | transaction = transaction->getOuter(); |
| 1918 | |
| 1919 | SLONG stuff[IAD_LEN(16) / 4]; |
| 1920 | |
| 1921 | SET_TDBB(tdbb); |
| 1922 | |
| 1923 | Ods::InternalArrayDesc* array_desc = (Ods::InternalArrayDesc*) stuff; |
| 1924 | blb* blob = get_array(tdbb, transaction, blob_id, array_desc); |
| 1925 | |
| 1926 | // Get someplace to put data. |
| 1927 | // We need DOUBLE_ALIGNed buffer, that's why some tricks |
| 1928 | HalfStaticArray<double, 64> temp; |
| 1929 | dsc desc = array_desc->iad_rpt[0].iad_desc; |
| 1930 | desc.dsc_address = reinterpret_cast<UCHAR*>(temp.getBuffer((desc.dsc_length / sizeof(double)) + |
| 1931 | (desc.dsc_length % sizeof(double) ? 1 : 0))); |
| 1932 | |
| 1933 | const SLONG number = SDL_compute_subscript(tdbb->tdbb_status_vector, array_desc, count, subscripts); |
| 1934 | if (number < 0) |
| 1935 | { |
| 1936 | blob->BLB_close(tdbb); |
| 1937 | ERR_punt(); |
| 1938 | } |
| 1939 | |
| 1940 | const SLONG offset = number * array_desc->iad_element_length; |
| 1941 | blob->BLB_lseek(0, offset + (SLONG) array_desc->iad_length); |
| 1942 | blob->BLB_get_segment(tdbb, desc.dsc_address, desc.dsc_length); |
| 1943 | |
| 1944 | // If we have run out of data, then clear the data buffer. |
| 1945 | |
| 1946 | if (blob->blb_flags & BLB_eof) { |
| 1947 | memset(desc.dsc_address, 0, (int) desc.dsc_length); |
| 1948 | } |
| 1949 | EVL_make_value(tdbb, &desc, value); |
| 1950 | blob->BLB_close(tdbb); |
| 1951 | } |
| 1952 | |
| 1953 | |
| 1954 | static ArrayField* alloc_array(jrd_tra* transaction, Ods::InternalArrayDesc* proto_desc) |
nothing calls this directly
no test coverage detected