This commit is contained in:
温少
2012-04-12 16:02:35 +08:00
13 changed files with 72 additions and 1516 deletions
@@ -38,6 +38,7 @@ public class OracleSelectTest34 extends OracleTest {
OracleSchemaStatVisitor visitor = new OracleSchemaStatVisitor();
statemen.accept(visitor);
System.out.println("Tables : " + visitor.getTables());
System.out.println("fields : " + visitor.getColumns());
@@ -27,4 +27,6 @@ public class OracleTest extends TestCase {
}
System.out.println(text);
}
}
@@ -28,4 +28,29 @@ public class SQLLexerTest2 extends TestCase {
}
}
}
public void test_lexer2() throws Exception {
String sql = "SELECT substr('''a''bc',0,3) FROM dual";
Lexer lexer = new Lexer(sql);
for (;;) {
lexer.nextToken();
Token tok = lexer.token();
if (tok == Token.IDENTIFIER) {
System.out.println(tok.name() + "\t\t" + lexer.stringVal());
} else if (tok == Token.LITERAL_INT) {
System.out.println(tok.name() + "\t\t" + lexer.numberString());
} else if (tok == Token.LITERAL_CHARS) {
System.out.println(tok.name() + "\t\t" + lexer.stringVal());
}
else {
System.out.println(tok.name() + "\t\t\t" + tok.name);
}
if (tok == Token.EOF) {
break;
}
}
}
}