Beispiel #1
0
        public virtual void Testdesc()
        {
            var           sql    = "desc tb1";
            var           lexer  = new MySqlLexer(sql);
            var           parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            ISqlStatement desc   = parser.Desc();

            parser.Match(MySqlToken.Eof);
            var output = Output2MySql(desc, sql);

            Assert.AreEqual("DESC tb1", output);
            sql    = "desc db.tb1";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            desc   = parser.Desc();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(desc, sql);
            Assert.AreEqual("DESC db.tb1", output);
            sql    = "describe db.tb1";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            desc   = parser.Desc();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(desc, sql);
            Assert.AreEqual("DESC db.tb1", output);
        }
Beispiel #2
0
        public virtual void TestSet()
        {
            var           sql    = "seT sysVar1 = ? ";
            var           lexer  = new MySqlLexer(sql);
            var           parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            ISqlStatement set    = (DalSetStatement)parser.Set();

            parser.Match(MySqlToken.Eof);
            var output = Output2MySql(set, sql);

            Assert.AreEqual("SET @@sysVar1 = ?", output);
            sql    = "SET `sysVar1` = ?, @@gloBal . `var2` :=1 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET @@`sysVar1` = ?, @@global.`var2` = 1", output);
            sql    = "SET @usrVar1 := ?, @@`var2` =1, @@var3:=?, @'var\\'3'=? ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET @usrVar1 = ?, @@`var2` = 1, @@var3 = ?, @'var\\'3' = ?", output);
            sql    = "SET GLOBAL var1=1, SESSION var2:=2";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET @@global.var1 = 1, @@var2 = 2", output);
            sql    = "SET @@GLOBAL. var1=1, SESSION var2:=2";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET @@global.var1 = 1, @@var2 = 2", output);
            sql    = "SET transaction ISOLATION LEVEL READ UNCOMMITTED ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (MTSSetTransactionStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED", output);
            sql    = "SET global transaction ISOLATION LEVEL READ COMMITTED ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (MTSSetTransactionStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED", output);
            sql    = "SET transaction ISOLATION LEVEL REPEATABLE READ ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (MTSSetTransactionStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ", output);
            sql    = "SET session transaction ISOLATION LEVEL SERIALIZABLE ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (MTSSetTransactionStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE", output);
            sql    = "SET names default ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetNamesStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET NAMES DEFAULT", output);
            sql    = "SET NAMEs 'utf8' collatE \"latin1_danish_ci\" ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetNamesStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET NAMES utf8 COLLATE latin1_danish_ci", output);
            sql    = "SET NAMEs utf8  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetNamesStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET NAMES utf8", output);
            sql    = "SET CHARACTEr SEt 'utf8'  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetCharacterSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET CHARACTER SET utf8", output);
            sql    = "SET CHARACTEr SEt DEFaULT  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            set    = (DalSetCharacterSetStatement)parser.Set();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(set, sql);
            Assert.AreEqual("SET CHARACTER SET DEFAULT", output);
        }
Beispiel #3
0
        public virtual void TestShow()
        {
            var sql    = "shoW authors  ";
            var lexer  = new MySqlLexer(sql);
            var parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            var show   = parser.Show();

            parser.Match(MySqlToken.Eof);
            var output = Output2MySql(show, sql);

            Assert.AreEqual("SHOW AUTHORS", output);
            sql    = "SHOW BINARY LOGS  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW BINARY LOGS", output);
            sql    = "SHOW MASTER LOGS  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW BINARY LOGS", output);
            sql    = "SHOW binlog events in 'a' from 1 limit 1,2  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW BINLOG EVENTS IN 'a' FROM 1 LIMIT 1, 2", output);
            sql    = "SHOW binlog events from 1 limit 1,2  ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW BINLOG EVENTS FROM 1 LIMIT 1, 2", output);
            sql    = "SHOW binlog events ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW BINLOG EVENTS", output);
            sql    = "SHOW CHARACTER SET like 'var' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CHARACTER SET LIKE 'var'", output);
            sql    = "SHOW CHARACTER SET where (select a from tb)in(a) ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CHARACTER SET WHERE (SELECT a FROM tb) IN (a)", output);
            sql    = "SHOW CHARACTER SET ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CHARACTER SET", output);
            sql    = "SHOW collation ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COLLATION", output);
            sql    = "SHOW Collation like 'var1' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COLLATION LIKE 'var1'", output);
            sql    = "SHOW collation where avg((select * from (tb1,tb2)))!=100 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COLLATION WHERE AVG(SELECT * FROM tb1, tb2) != 100", output);
            sql    = "SHOW full columns from tb1 from db1 like 'var' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL COLUMNS FROM db1.tb1 LIKE 'var'", output);
            sql    = "SHOW full columns from tb1 from db1 where Count(col)>10 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL COLUMNS FROM db1.tb1 WHERE COUNT(col) > 10", output);
            sql    = "SHOW columns from tb1 from db1 like 'var' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COLUMNS FROM db1.tb1 LIKE 'var'", output);
            sql    = "SHOW columns from tb1 like 'var' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COLUMNS FROM tb1 LIKE 'var'", output);
            sql    = "SHOW full columns from tb1 from db1 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL COLUMNS FROM db1.tb1", output);
            sql    = "SHOW contributors ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CONTRIBUTORS", output);
            sql    = "SHOW CREATE DATABASE db_name ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE DATABASE db_name", output);
            sql    = "SHOW create event expr ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE EVENT expr", output);
            sql    = "SHOW create function func ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE FUNCTION func", output);
            sql    = "SHOW create procedure pro ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE PROCEDURE pro", output);
            sql    = "SHOW create table tb ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE TABLE tb", output);
            sql    = "SHOW create trigger tri ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE TRIGGER tri", output);
            sql    = "SHOW create view view";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW CREATE VIEW view", output);
            sql    = "SHOW databases like 'var'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW DATABASES LIKE 'var'", output);
            sql    = "SHOW databases where (select * from `select`)is not null";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW DATABASES WHERE (SELECT * FROM `select`) IS NOT NULL", output);
            sql    = "SHOW databases ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW DATABASES", output);
            sql    = "SHOW engine innodb status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ENGINE INNODB STATUS", output);
            sql    = "SHOW engine innodb mutex";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ENGINE INNODB MUTEX", output);
            sql    = "SHOW engine performance_schema status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ENGINE PERFORMANCE SCHEMA STATUS", output);
            sql    = "SHOW engines";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ENGINES", output);
            sql    = "SHOW storage engines";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ENGINES", output);
            sql    = "SHOW errors";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ERRORS", output);
            sql    = "SHOW errors limit 1 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW ERRORS LIMIT 0, 1", output);
            sql    = "SHOW Count(*) errors";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COUNT(*) ERRORS", output);
            sql    = "SHOW events";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW EVENTS", output);
            sql    = "SHOW events from expr like 'var' ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW EVENTS FROM expr LIKE 'var'", output);
            sql    = "SHOW events from expr where expr1";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW EVENTS FROM expr WHERE expr1", output);
            sql    = "SHOW function code expr";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FUNCTION CODE expr", output);
            sql    = "SHOW function status like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FUNCTION STATUS LIKE 'expr'", output);
            sql    = "SHOW function status where a is true";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FUNCTION STATUS WHERE a IS TRUE", output);
            sql    = "SHOW function status ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FUNCTION STATUS", output);
            sql    = "SHOW grants for 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GRANTS FOR 'expr'", output);
            sql    = "SHOW grants";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GRANTS", output);
            sql    = "SHOW index from tb1 from db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW INDEX IN db.tb1", output);
            sql    = "SHOW index from tb1 in db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW INDEX IN db.tb1", output);
            sql    = "SHOW index in tb1 from db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW INDEX IN db.tb1", output);
            sql    = "SHOW index in tb1 in db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW INDEX IN db.tb1", output);
            sql    = "SHOW indexes from tb1";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW INDEXES IN tb1", output);
            sql    = "SHOW keys in tb1";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW KEYS IN tb1", output);
            sql    = "SHOW master status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW MASTER STATUS", output);
            sql    = "SHOW open tables from db like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW OPEN TABLES FROM db LIKE 'expr'", output);
            sql    = "SHOW open tables from db where tb is not null";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW OPEN TABLES FROM db WHERE tb IS NOT NULL",
                            output);
            sql    = "SHOW open tables from db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW OPEN TABLES FROM db", output);
            sql    = "SHOW open tables in db";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW OPEN TABLES FROM db", output);
            sql    = "SHOW open tables";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW OPEN TABLES", output);
            sql    = "SHOW plugins";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PLUGINS", output);
            sql    = "SHOW privileges";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PRIVILEGES", output);
            sql    = "SHOW procedure code proc";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROCEDURE CODE proc", output);
            sql    = "SHOW procedure status like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROCEDURE STATUS LIKE 'expr'", output);
            sql    = "SHOW procedure status where (a||b)*(a&&b)";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROCEDURE STATUS WHERE (a OR b) * (a AND b)", output);
            sql    = "SHOW procedure status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROCEDURE STATUS", output);
            sql    = "SHOW processlist";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROCESSLIST", output);
            sql    = "SHOW full processlist";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL PROCESSLIST", output);
            sql    = "SHOW profiles";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROFILES", output);
            sql = "SHOW profile all,block io,context switches,cpu,ipc,memory," +
                  "page faults,source,swaps for query 2 limit 1 offset 2";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, MEMORY, "
                            + "PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2 LIMIT 2, 1", output);
            sql    = "SHOW profile";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROFILE", output);
            sql    = "SHOW profile all,block io,context switches,cpu,ipc," + "memory,page faults,source,swaps for query 2";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROFILE ALL, BLOCK IO, CONTEXT SWITCHES, CPU, IPC, "
                            + "MEMORY, PAGE FAULTS, SOURCE, SWAPS FOR QUERY 2", output);
            sql    = "SHOW profile all for query 2";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW PROFILE ALL FOR QUERY 2", output);
            sql    = "SHOW slave hosts";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SLAVE HOSTS", output);
            sql    = "SHOW slave status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SLAVE STATUS", output);
            sql    = "SHOW global status like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL STATUS LIKE 'expr'", output);
            sql    = "SHOW global status where ${abc}";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL STATUS WHERE ${abc}", output);
            sql    = "SHOW session status like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS LIKE 'expr'", output);
            sql    = "SHOW session status where ?";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS WHERE ?", output);
            sql    = "SHOW status like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS LIKE 'expr'", output);
            sql    = "SHOW status where 0b10^b'11'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS WHERE b'10' ^ b'11'", output);
            sql    = "SHOW status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS", output);
            sql    = "SHOW global status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL STATUS", output);
            sql    = "SHOW session status";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION STATUS", output);
            sql    = "SHOW table status from db like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLE STATUS FROM db LIKE 'expr'", output);
            sql    = "SHOW table status in db where (select a)>(select b)";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLE STATUS FROM db WHERE (SELECT a) > (SELECT b)", output);
            sql    = "SHOW table status from db where id1=a||b";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLE STATUS FROM db WHERE id1 = a OR b", output);
            sql    = "SHOW table status ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLE STATUS", output);
            sql    = "SHOW tables from db like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLES FROM db LIKE 'expr'", output);
            sql    = "SHOW tables in db where !a";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLES FROM db WHERE ! a", output);
            sql    = "SHOW tables like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLES LIKE 'expr'", output);
            sql    = "SHOW tables where log((select a))=b";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLES WHERE LOG(SELECT a) = b", output);
            sql    = "SHOW tables ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TABLES", output);
            sql    = "SHOW full tables from db like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL TABLES FROM db LIKE 'expr'", output);
            sql    = "SHOW full tables in db where id1=abs((select a))";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL TABLES FROM db WHERE id1 = ABS(SELECT a)", output);
            sql    = "SHOW full tables ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW FULL TABLES", output);
            sql    = "SHOW triggers from db like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TRIGGERS FROM db LIKE 'expr'", output);
            sql    = "SHOW triggers in db where strcmp('test1','test2')";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TRIGGERS FROM db WHERE STRCMP('test1', 'test2')", output);
            sql    = "SHOW triggers ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW TRIGGERS", output);
            sql    = "SHOW global variables like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL VARIABLES LIKE 'expr'", output);
            sql    = "SHOW global variables where ~a is null";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL VARIABLES WHERE ~ a IS NULL", output);
            sql    = "SHOW session variables like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES LIKE 'expr'", output);
            sql    = "SHOW session variables where a*b+1=c";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES WHERE a * b + 1 = c", output);
            sql    = "SHOW variables like 'expr'";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES LIKE 'expr'", output);
            sql    = "SHOW variables where a&&b";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES WHERE a AND b", output);
            sql    = "SHOW variables";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES", output);
            sql    = "SHOW global variables";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW GLOBAL VARIABLES", output);
            sql    = "SHOW session variables";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW SESSION VARIABLES", output);
            sql    = "SHOW warnings limit 1,2 ";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW WARNINGS LIMIT 1, 2", output);
            sql    = "SHOW warnings";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW WARNINGS", output);
            sql    = "SHOW Count(*) warnings";
            lexer  = new MySqlLexer(sql);
            parser = new MySqlDalParser(lexer, new MySqlExprParser(lexer));
            show   = parser.Show();
            parser.Match(MySqlToken.Eof);
            output = Output2MySql(show, sql);
            Assert.AreEqual("SHOW COUNT(*) WARNINGS", output);
        }