| 925 | } |
| 926 | |
| 927 | ULONG DsqlBatch::DataCache::get(UCHAR** buffer) |
| 928 | { |
| 929 | if (m_used > m_got) |
| 930 | { |
| 931 | // get data from tempspace |
| 932 | ULONG dlen = m_cache.getCount(); |
| 933 | ULONG delta = m_cacheCapacity - dlen; |
| 934 | if (delta > m_used - m_got) |
| 935 | delta = m_used - m_got; |
| 936 | UCHAR* buf = m_cache.getBuffer(dlen + delta); |
| 937 | buf += dlen; |
| 938 | const FB_UINT64 readBytes = m_space->read(m_got, buf, delta); |
| 939 | fb_assert(readBytes == delta); |
| 940 | m_got += delta; |
| 941 | } |
| 942 | |
| 943 | if (m_cache.getCount()) |
| 944 | { |
| 945 | if (m_shift) |
| 946 | m_cache.removeCount(0, m_shift); |
| 947 | |
| 948 | // return buffer full of data |
| 949 | *buffer = m_cache.begin(); |
| 950 | fb_assert(intptr_t(*buffer) % FB_ALIGNMENT == 0); |
| 951 | return m_cache.getCount(); |
| 952 | } |
| 953 | |
| 954 | // no more data |
| 955 | *buffer = nullptr; |
| 956 | return 0; |
| 957 | } |
| 958 | |
| 959 | ULONG DsqlBatch::DataCache::reget(ULONG remains, UCHAR** buffer, ULONG alignment) |
| 960 | { |
no test coverage detected