private static extern RCODE xflaim_Db_setNextDictNum( IntPtr pDb, ReservedElmTag dictType, uint uiDictNumber);
private static extern RCODE xflaim_Db_getDictionaryDef( IntPtr pDb, ReservedElmTag dictType, uint uiDictNumber, ref IntPtr ppNode);
private static extern RCODE xflaim_Db_getDictionaryName( IntPtr pDb, ReservedElmTag dictType, uint uiDictNumber, out IntPtr ppuzDictName);
private static extern RCODE xflaim_Db_changeItemState( IntPtr pDb, ReservedElmTag dictType, uint uiDictNumber, [MarshalAs(UnmanagedType.LPStr)] string sState);
private static extern RCODE xflaim_Db_getDataType( IntPtr pDb, ReservedElmTag dictType, uint uiDictNumer, out FlmDataType dataType);
//----------------------------------------------------------------------------- // setNextDictNum //----------------------------------------------------------------------------- /// <summary> /// Set the next dictionary number that is to be assigned for a particular /// type if dictionary definition. The specified "next dictionary number" /// must be greater than the current "next dictionary number". Otherwise, /// no action is taken. /// </summary> /// <param name="dictType"> /// Type of dictionary definition whose "next dictionary number" is to /// be changed. /// </param> /// <param name="uiDictNumber"> /// Next dictionary number. /// </param> public void setNextDictNum( ReservedElmTag dictType, uint uiDictNumber) { RCODE rc; if ((rc = xflaim_Db_setNextDictNum( m_pDb, dictType, uiDictNumber)) != 0) { throw new XFlaimException(rc); } }
//----------------------------------------------------------------------------- // getDictionaryName //----------------------------------------------------------------------------- /// <summary> /// Get a dictionary definition's name. /// </summary> /// <param name="dictType"> /// The type of dictionary definition whose name is to be returned. /// </param> /// <param name="uiDictNumber"> /// The number of the dictionary definition. /// </param> /// <returns> /// Name of the dictionary item. /// </returns> public string getDictionaryName( ReservedElmTag dictType, uint uiDictNumber) { RCODE rc; IntPtr puzDictName; string sDictName; if ((rc = xflaim_Db_getDictionaryName( m_pDb, dictType, uiDictNumber, out puzDictName)) != 0) { throw new XFlaimException( rc); } sDictName = Marshal.PtrToStringUni( puzDictName); m_dbSystem.freeUnmanagedMem( puzDictName); return( sDictName); }
//----------------------------------------------------------------------------- // 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)); }
//----------------------------------------------------------------------------- // getDataType //----------------------------------------------------------------------------- /// <summary> /// Returns the data type that was specified for a particular dictionary /// definition. NOTE: This really only applies to element and attribute /// definitions. /// </summary> /// <param name="dictType"> /// The type of dictionary definition whose data type is to be returned. /// </param> /// <param name="uiDictNumber"> /// The number of the dictionary definition. /// </param> /// <returns> /// Data type of the dictionary object. /// </returns> public FlmDataType getDataType( ReservedElmTag dictType, uint uiDictNumber) { RCODE rc; FlmDataType dataType; if ((rc = xflaim_Db_getDataType( m_pDb, dictType, uiDictNumber, out dataType)) != 0) { throw new XFlaimException(rc); } return( dataType); }
//----------------------------------------------------------------------------- // changeItemState //----------------------------------------------------------------------------- /// <summary> /// Change a dictionary definition's state. This routine is used to determine if /// the dictionary item can be deleted. It may also be used to force the /// definition to be deleted - once the database has determined that the /// definition is not in use anywhere. This should only be used for /// element definitions and attribute definitions definitions. /// </summary> /// <param name="dictType"> /// Type of dictionary definition whose state is being changed. /// </param> /// <param name="uiDictNumber"> /// Number of element or attribute definition whose state /// is to be changed /// </param> /// <param name="eStateToChangeTo"> /// State the definition is to be changed to. /// </param> public void changeItemState( ReservedElmTag dictType, uint uiDictNumber, ChangeState eStateToChangeTo) { RCODE rc; string sState = ""; switch (eStateToChangeTo) { case ChangeState.STATE_CHECKING: sState = "checking"; break; case ChangeState.STATE_PURGE: sState = "purge"; break; case ChangeState.STATE_ACTIVE: sState = "active"; break; default: throw new XFlaimException( RCODE.NE_XFLM_INVALID_PARM); } if ((rc = xflaim_Db_changeItemState( m_pDb, dictType, uiDictNumber, sState)) != 0) { throw new XFlaimException(rc); } }