コード例 #1
0
    public override void CustomRead()
    {
        OplDataHandler handler = DataHandler;

        // Get the element of the predefined name.
        // If no such element is defined then exit early.
        // The element must be either a tuple or a set of tuples.
        // Any custom load specification specified by the element is then processed.
        OplElement spec = handler.getElement(ELEM_NAME);

        if (spec == null)
        {
            return;
        }
        if (spec.ElementType == OplElementType.Type.TUPLE)
        {
            loadSpec(handler, spec.AsTuple());
        }
        else if (spec.ElementType == OplElementType.Type.SET_TUPLE)
        {
            foreach (ITuple tuple in spec.AsTupleSet())
            {
                loadSpec(handler, tuple);
            }
        }
        else
        {
            throw new NotImplementedException(ELEM_NAME + " must be (set of) tuple");
        }
    }
コード例 #2
0
    /// <summary>
    ///  Load an element that is a plain tuple.
    /// </summary>
    private void loadTuple(OplDataHandler handler, string name, IEnumerator <IRow> rows)
    {
        OplElement elem  = handler.getElement(name);
        ITuple     tuple = elem.AsTuple();

        handler.StartElement(name);
        rows.MoveNext();
        fillTuple(handler, tuple.Schema, rows.Current, 0);
        handler.EndElement();
    }