Exemplo n.º 1
0
        //At the moment parser only supports mysql,mariadb,postgresql
        //any other db i just execute all in one statement
        internal static List <string> convert(sqlbox.commons.DbType dbtype, string query)
        {
            List <string> statementList = null;

            if (dbtype == sqlbox.commons.DbType.MYSQL || dbtype == sqlbox.commons.DbType.MARIADB || dbtype == sqlbox.commons.DbType.POSTGRES)
            {
                var parser = new SqlStatementParserWrapper(query, (com.protectsoft.SqlStatementParser.DbType)(int) dbtype);
                statementList = SqlStatementParserWrapper.convert(parser.sql, parser.Parse());
            }
            else
            {
                statementList = new List <string>();
                statementList.Add(query);
            }
            return(statementList);
        }
Exemplo n.º 2
0
        public void TestMySqlConvert(string sql, int expectedStatements)
        {
            SqlStatementParserWrapper parser = new SqlStatementParserWrapper(sql, dbType);

            Assert.AreEqual(expectedStatements, SqlStatementParserWrapper.convert(parser.sql, parser.Parse()).Count);
        }