Exemplo n.º 1
0
        //-----------------------------------------------------------------------------
        // getPrev
        //-----------------------------------------------------------------------------
        /// <summary>
        /// Gets the previous <see cref="DOMNode"/> that satisfies the query criteria.
        /// This may be a document root node, or any node within the document.  What
        /// is returned depends on how the XPATH expression was constructed.
        /// </summary>
        /// <param name="nodeToReuse">
        /// An existing <see cref="DOMNode"/> object can optionally be passed in, and
        /// it will be reused instead of a new object being allocated.
        /// </param>
        /// <param name="uiTimeLimit">
        /// Time limit (in milliseconds) for operation to complete.
        /// A value of zero indicates that the operation should not time out.
        /// </param>
        /// <returns>
        /// Returns a <see cref="DOMNode"/> object.
        /// </returns>
        public DOMNode getPrev(
			DOMNode	nodeToReuse,
			uint		uiTimeLimit)
        {
            RCODE		rc = 0;
            DOMNode	newNode;
            IntPtr	pNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero;

            if ((rc = xflaim_Query_getPrev( m_pQuery, m_db.getDb(),
                uiTimeLimit, ref pNode)) != 0)
            {
                throw new XFlaimException( rc);
            }
            if (nodeToReuse == null)
            {
                newNode = new DOMNode( pNode, m_db);
            }
            else
            {
                newNode = nodeToReuse;
                newNode.setNodePtr( pNode, m_db);
            }

            return( newNode);
        }
Exemplo n.º 2
0
        //-----------------------------------------------------------------------------
        // positionTo
        //-----------------------------------------------------------------------------
        /// <summary>
        /// Position to the <see cref="DOMNode"/> in the result that is at
        /// the position specified by the searchKey parameter.
        /// </summary>
        /// <param name="nodeToReuse">
        /// An existing <see cref="DOMNode"/> object can optionally be
        /// passed in, and it will be reused instead of a new object being allocated.
        /// </param>
        /// <param name="uiTimeLimit">
        /// Time limit (in milliseconds) for operation to complete.  A value of zero
        /// indicates that the operation should not time out.
        /// </param>
        /// <param name="searchKey">
        /// This is a key that corresponds to the sort key that was specified using
        /// the addSortKey method.  This method looks up the node in the result set
        /// that has this search key and returns it.
        /// </param>
        /// <param name="retrieveFlags">
        /// The search flags that direct how the key is to be used to do positioning.
        /// This should be values from <see cref="RetrieveFlags"/> that are ORed together.
        /// </param>
        /// <returns>
        /// Returns a <see cref="DOMNode"/> object.
        /// </returns>
        public DOMNode positionTo(
			DOMNode			nodeToReuse,
			uint				uiTimeLimit,
			DataVector		searchKey,
			RetrieveFlags	retrieveFlags)
        {
            RCODE		rc;
            DOMNode	newNode;
            IntPtr	pNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero;

            if ((rc = xflaim_Query_positionToByKey( m_pQuery, m_db.getDb(),
                uiTimeLimit, searchKey.getDataVector(),
                retrieveFlags, ref pNode)) != 0)
            {
                throw new XFlaimException( rc);
            }
            if (nodeToReuse == null)
            {
                newNode = new DOMNode( pNode, m_db);
            }
            else
            {
                newNode = nodeToReuse;
                newNode.setNodePtr( pNode, m_db);
            }

            return( newNode);
        }
Exemplo n.º 3
0
        private DOMNode makeNode(
			DOMNode	nodeToReuse,
			IntPtr	pNode)
        {
            if (nodeToReuse == null)
            {
                return( new DOMNode( pNode, m_db));
            }
            else
            {
                nodeToReuse.setNodePtr( pNode, m_db);
                return( nodeToReuse);
            }
        }
Exemplo n.º 4
0
        //-----------------------------------------------------------------------------
        // importDocument
        //-----------------------------------------------------------------------------
        /// <summary>
        /// Imports an XML document into the XFlaim database.  The import requires
        /// an update transaction.
        /// </summary>
        /// <param name="istream">
        /// Input stream containing the document(s) to be imported
        /// </param>
        /// <param name="uiCollection">
        /// Destination collection for imported document(s).
        /// </param>
        /// <param name="nodeToReuse">
        /// An existing DOM node object can optionally be passed in.  It will
        /// be reused rather than allocating a new object.
        /// </param>
        /// <param name="importStats">
        /// Import statistics is returned here if a non-null value is passed in.
        /// </param>
        /// <returns>
        /// Returns a <see cref="DOMNode"/> that is the root of the imported document.
        /// </returns>
        public DOMNode importDocument(
			IStream					istream,
			uint						uiCollection,
			DOMNode					nodeToReuse,
			CS_XFLM_IMPORT_STATS	importStats)
        {
            RCODE		rc;
            IntPtr	pDocumentNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero;

            if (importStats == null)
            {
                importStats = new CS_XFLM_IMPORT_STATS();
            }

            if ((rc = xflaim_Db_importDocument( m_pDb, istream.getIStream(),
                            uiCollection, ref pDocumentNode, importStats)) != 0)
            {
                throw new XFlaimException(rc);
            }

            if( nodeToReuse != null)
            {
                nodeToReuse.setNodePtr( pDocumentNode, this);
                return( nodeToReuse);
            }

            return( new DOMNode( pDocumentNode, this));
        }
Exemplo n.º 5
0
        //-----------------------------------------------------------------------------
        // getNode
        //-----------------------------------------------------------------------------
        /// <summary>
        /// Retrieves the specified node from the specified collection. 
        /// </summary>
        /// <param name="uiCollection">
        /// The collection where the node is stored.
        /// </param>
        /// <param name="ulNodeId">
        /// The ID number of the node to be retrieved.
        /// </param>
        /// <param name="nodeToReuse">
        /// </param>
        /// <returns></returns>
        public DOMNode getNode(
			uint			uiCollection,
			ulong			ulNodeId,
			DOMNode		nodeToReuse)
        {
            RCODE		rc;
            IntPtr	pNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero;

            if ((rc = xflaim_Db_getNode( m_pDb, uiCollection, ulNodeId,
                ref pNode)) != 0)
            {
                throw new XFlaimException(rc);
            }

            if (nodeToReuse != null)
            {
                nodeToReuse.setNodePtr(pNode, this);
                return( nodeToReuse);
            }

            return( new DOMNode(pNode, this));
        }
Exemplo n.º 6
0
        //-----------------------------------------------------------------------------
        // getDictionaryDef
        //-----------------------------------------------------------------------------
        /// <summary>
        /// Retrieve a dictionary definition document.
        /// </summary>
        /// <param name="dictType">
        /// The type of dictionary definition being retrieved.
        /// </param>
        /// <param name="uiDictNumber">
        /// The number the dictionary definition being retrieved.
        /// </param>
        /// <param name="nodeToReuse">
        /// An existing DOM node object can optionally be passed in.  It will
        /// be reused rather than allocating a new object.
        /// </param>
        /// <returns>
        /// Returns the root <see cref="DOMNode"/> of the document.
        /// </returns>
        public DOMNode getDictionaryDef(
			ReservedElmTag	dictType,
			uint				uiDictNumber,
			DOMNode			nodeToReuse)
        {
            RCODE		rc;
            IntPtr	pNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero;

            if ((rc = xflaim_Db_getDictionaryDef( m_pDb, dictType,
                uiDictNumber, ref pNode)) != 0)
            {
                throw new XFlaimException(rc);
            }

            if (nodeToReuse != null)
            {
                nodeToReuse.setNodePtr(pNode, this);
                return( nodeToReuse);
            }

            return( new DOMNode(pNode, this));
        }