public void OneOutputOneInput() { //arrange const string sql = @"SELECT Name:string FROM Users WHERE Id= @id:int"; //act var input = new ANTLRStringStream(sql); var lexer = new TypeSqlLexer(input); var tokenStream = new CommonTokenStream(lexer); var parser = new TypeSqlParser(tokenStream); var parseResult = parser.typesql(); }
public void Template() { //arrange const string sql = @"SELECT UserId:int FROM Users"; //act var input = new ANTLRStringStream(sql); var lexer = new TypeSqlLexer(input); var tokenStream = new CommonTokenStream(lexer); var parser = new TypeSqlParser(tokenStream); var parseResult = parser.typesql(); var templateGroup = new StringTemplateGroup( new StreamReader(new FileStream(@"..\..\..\TypeSql\Parsing\DapperDao.stg", FileMode.Open)), typeof (TemplateLexer)); var dapperDaoTransform = new DaoTransform(new CommonTreeNodeStream(parseResult.Tree)) { TemplateGroup = templateGroup }; //var result = dapperDaoTransform.sql("UserIds").Template.ToString(); }
public void TwoOutputs() { //arrange const string sql = @"SELECT UserId:int, UserName:string FROM Users"; //act var input = new ANTLRStringStream(sql); var lexer = new TypeSqlLexer(input); var tokenStream = new CommonTokenStream(lexer); var parser = new TypeSqlParser(tokenStream); var parseResult = parser.typesql(); }