| 31 | class JResultSet; |
| 32 | |
| 33 | class DsqlCursor |
| 34 | { |
| 35 | enum State { BOS, POSITIONED, EOS }; |
| 36 | |
| 37 | public: |
| 38 | DsqlCursor(DsqlDmlRequest* req, ULONG flags); |
| 39 | ~DsqlCursor(); |
| 40 | |
| 41 | jrd_tra* getTransaction() const; |
| 42 | Attachment* getAttachment() const; |
| 43 | void setInterfacePtr(JResultSet* interfacePtr) throw(); |
| 44 | |
| 45 | static void close(thread_db* tdbb, DsqlCursor* cursor); |
| 46 | |
| 47 | int fetchNext(thread_db* tdbb, UCHAR* buffer); |
| 48 | int fetchPrior(thread_db* tdbb, UCHAR* buffer); |
| 49 | int fetchFirst(thread_db* tdbb, UCHAR* buffer); |
| 50 | int fetchLast(thread_db* tdbb, UCHAR* buffer); |
| 51 | int fetchAbsolute(thread_db* tdbb, UCHAR* buffer, SLONG position); |
| 52 | int fetchRelative(thread_db* tdbb, UCHAR* buffer, SLONG offset); |
| 53 | |
| 54 | bool isBof() const |
| 55 | { |
| 56 | return (m_state == BOS); |
| 57 | } |
| 58 | |
| 59 | bool isEof() const |
| 60 | { |
| 61 | return (m_state == EOS); |
| 62 | } |
| 63 | |
| 64 | void getInfo(thread_db* tdbb, |
| 65 | unsigned int itemsLength, const unsigned char* items, |
| 66 | unsigned int bufferLength, unsigned char* buffer); |
| 67 | |
| 68 | private: |
| 69 | int fetchFromCache(thread_db* tdbb, UCHAR* buffer, FB_UINT64 position); |
| 70 | bool cacheInput(thread_db* tdbb, FB_UINT64 position = MAX_UINT64); |
| 71 | |
| 72 | DsqlDmlRequest* const m_dsqlRequest; |
| 73 | const dsql_msg* const m_message; |
| 74 | JResultSet* m_resultSet; |
| 75 | const ULONG m_flags; |
| 76 | TempSpace m_space; |
| 77 | State m_state; |
| 78 | bool m_eof; |
| 79 | FB_UINT64 m_position; |
| 80 | FB_UINT64 m_cachedCount; |
| 81 | }; |
| 82 | |
| 83 | } // namespace |
| 84 | |