Skip to content

RecollectionRequest

Dmitry Kochin edited this page Jul 13, 2018 · 1 revision

The RecollectionRequest allows to query Ties.DB for existing records. It supports sofisticated conditions to filter those records you need. However it is not necessary to issue RecollectionRequest manually. You can use TiQL supported by the client for your platform to compile SQL-like query language into RecollectionRequest. However for information purposes we can provide an example of RecollectionRequest here.

RecollectionRequest as well as ModificationRequest should be signed by a client and accompanied by Cheques (not yet implemented as of Alpha version).

<RecollectionRequest type="m">
    <Consistency type="u">0</Consistency>
    <MessageId type="u">2</MessageId>
    <RecollectionTablespaceName type="8">client-dev.test</RecollectionTablespaceName>
    <RecollectionTableName type="8">all_types</RecollectionTableName>
    <RetrieveList type="m">
        <RetField type="8">Id</RetField>
        <RetCompute type="m">
            <FunctionName type="8">CAST</FunctionName>
            <FunArgumentReference type="8">fDuration</FunArgumentReference>
            <FunArgumentStatic type="m">
                <ArgStaticType type="s">string</ArgStaticType>
                <ArgStaticValue type="b">6475726174696f6e</ArgStaticValue>
            </FunArgumentStatic>
        </RetCompute>
        <RetCompute type="m">
            <RetComputeAlias type="8">wtime</RetComputeAlias>
            <RetComputeType type="s">time</RetComputeType>
            <FunctionName type="8">CAST</FunctionName>
            <FunArgumentFunction type="m">
                <FunctionName type="8">writeTime</FunctionName>
                <FunArgumentReference type="8">fTime</FunArgumentReference>
            </FunArgumentFunction>
            <FunArgumentStatic type="m">
                <ArgStaticType type="s">string</ArgStaticType>
                <ArgStaticValue type="b">64617465</ArgStaticValue>
            </FunArgumentStatic>
        </RetCompute>
        <RetCompute type="m">
            <FunctionName type="8">CAST</FunctionName>
            <FunArgumentFunction type="m">
                <FunctionName type="8">writeTime</FunctionName>
                <FunArgumentReference type="8">fTime</FunArgumentReference>
            </FunArgumentFunction>
            <FunArgumentStatic type="m">
                <ArgStaticType type="s">string</ArgStaticType>
                <ArgStaticValue type="b">64617465</ArgStaticValue>
            </FunArgumentStatic>
        </RetCompute>
        <RetField type="8">fLong</RetField>
        <RetCompute type="m">
            <RetComputeAlias type="8">WriteTime</RetComputeAlias>
            <FunctionName type="8">bigIntAsBlob</FunctionName>
            <FunArgumentFunction type="m">
                <FunctionName type="8">toUnixTimestamp</FunctionName>
                <FunArgumentFunction type="m">
                    <FunctionName type="8">CAST</FunctionName>
                    <FunArgumentFunction type="m">
                        <FunctionName type="8">writeTime</FunctionName>
                        <FunArgumentReference type="8">fTime</FunArgumentReference>
                    </FunArgumentFunction>
                    <FunArgumentStatic type="m">
                        <ArgStaticType type="s">string</ArgStaticType>
                        <ArgStaticValue type="b">64617465</ArgStaticValue>
                    </FunArgumentStatic>
                </FunArgumentFunction>
            </FunArgumentFunction>
        </RetCompute>
        <RetCompute type="m">
            <RetComputeAlias type="8">TestValue</RetComputeAlias>
            <FunctionName type="8">intAsBlob</FunctionName>
            <FunArgumentStatic type="m">
                <ArgStaticType type="s">integer</ArgStaticType>
                <ArgStaticValue type="b">0309</ArgStaticValue>
            </FunArgumentStatic>
        </RetCompute>
    </RetrieveList>
    <FilterList type="m">
        <Filter type="m">
            <FilterField type="8">Id</FilterField>
            <FunctionName type="8">IN</FunctionName>
            <FunArgumentStatic type="m">
                <ArgStaticType type="s">uuid</ArgStaticType>
                <ArgStaticValue type="b">86ee31dfb1664ceb97b6375ee76cffc3</ArgStaticValue>
            </FunArgumentStatic>
        </Filter>
    </FilterList>
</RecollectionRequest>

This RecollectionRequest can be compiled from the following TiQL query.

    SELECT
        Id,
        CAST(fDuration as duration),
        CAST(writeTime(/*fsdf*/fTime) as date)::time as wtime,
        CAST(writeTime(fTime) AS date),
        fLong,
        bigIntAsBlob(toUnixTimestamp(CAST(writeTime(fTime) AS date))) AS WriteTime, 
        intAsBlob(0x309) AS TestValue 
    FROM "client-dev.test"."all_types"
    WHERE
        Id IN (86ee31df-b166-4ceb-97b6-375ee76cffc3)

In response to RecollectionRequest you get RecollectionResponse.

Clone this wiki locally