コード例 #1
0
        /**
         * Method declaration
         *
         *
         * @param c
         * @param channel
         *
         * @return
         *
         * @throws Exception
         */
        private Result processScript(Tokenizer c,
                                     Channel channel)
        {
            string sToken = c.getstring();

            if (c.wasValue())
            {
                sToken = (string)c.getAsValue();

                Log.scriptToFile(this, sToken, true, channel);

                return(new Result());
            }
            else
            {
                c.back();

                // try to script all: drop, insert; but no positions for cached tables
                return(getScript(true, true, false, channel));
            }
        }
コード例 #2
0
        /**
         * Method declaration
         *
         *
         * @param c
         * @param channel
         *
         * @return
         *
         * @throws Exception
         */
        private Result processSet(Tokenizer c,
                                  Channel channel)
        {
            string sToken = c.getstring();

            if (sToken.Equals("PASSWORD"))
            {
                channel.checkReadWrite();
                channel.setPassword(c.getstringToken());
            }
            else if (sToken.Equals("READONLY"))
            {
                channel.commit();
                channel.setReadOnly(processTrueOrFalse(c));
            }
            else if (sToken.Equals("LOGSIZE"))
            {
                channel.checkAdmin();

                int i = Int32.FromString(c.getstring());

                if (lLog != null)
                {
                    lLog.setLogSize(i);
                }
            }
            else if (sToken.Equals("IGNORECASE"))
            {
                channel.checkAdmin();

                bIgnoreCase = processTrueOrFalse(c);
            }
            else if (sToken.Equals("MAXROWS"))
            {
                int i = Int32.FromString(c.getstring());

                channel.setMaxRows(i);
            }
            else if (sToken.Equals("AUTOCOMMIT"))
            {
                channel.setAutoCommit(processTrueOrFalse(c));
            }
            else if (sToken.Equals("TABLE"))
            {
                channel.checkReadWrite();
                channel.checkAdmin();

                Table t = getTable(c.getstring(), channel);

                c.getThis("INDEX");
                c.getstring();
                t.setIndexRoots((string)c.getAsValue());
            }
            else if (sToken.Equals("REFERENCIAL_INTEGRITY") ||
                     sToken.Equals("REFERENTIAL_INTEGRITY"))
            {
                channel.checkAdmin();

                bReferentialIntegrity = processTrueOrFalse(c);
            }
            else if (sToken.Equals("WRITE_DELAY"))
            {
                channel.checkAdmin();

                bool delay = processTrueOrFalse(c);

                if (lLog != null)
                {
                    lLog.setWriteDelay(delay);
                }
            }
            else
            {
                throw Trace.error(Trace.UNEXPECTED_TOKEN, sToken);
            }

            return(new Result());
        }