コード例 #1
0
        public static bool ConfigLogFlush(XmlElement xmlElem,
                                          string name, ref TransactionConfig.LogFlush value,
                                          bool compulsory)
        {
            XmlNode xmlNode;
            string  logFlush;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
            {
                return(false);
            }
            else if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }

            logFlush = xmlNode.InnerText;
            if (logFlush == "DEFAULT")
            {
                value = TransactionConfig.LogFlush.DEFAULT;
            }
            else if (logFlush == "NOSYNC")
            {
                value = TransactionConfig.LogFlush.NOSYNC;
            }
            else if (logFlush == "WRITE_NOSYNC")
            {
                value = TransactionConfig.LogFlush.WRITE_NOSYNC;
            }
            else if (logFlush == "SYNC")
            {
                value = TransactionConfig.LogFlush.SYNC;
            }
            else
            {
                throw new InvalidConfigException(name);
            }

            return(true);
        }
コード例 #2
0
        public static void ConfirmLogFlush(XmlElement xmlElem,
                                           string name, TransactionConfig.LogFlush value,
                                           bool compulsory)
        {
            XmlNode xmlNode;
            string  logFlush;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }
            else if (xmlNode != null)
            {
                logFlush = xmlNode.InnerText;
                if (logFlush == "DEFAULT")
                {
                    Assert.AreEqual(TransactionConfig.LogFlush.DEFAULT, value);
                }
                else if (logFlush == "NOSYNC")
                {
                    Assert.AreEqual(TransactionConfig.LogFlush.NOSYNC, value);
                }
                else if (logFlush == "WRITE_NOSYNC")
                {
                    Assert.AreEqual(TransactionConfig.LogFlush.WRITE_NOSYNC, value);
                }
                else if (logFlush == "SYNC")
                {
                    Assert.AreEqual(TransactionConfig.LogFlush.SYNC, value);
                }
                else
                {
                    throw new InvalidConfigException(name);
                }
            }
        }