Created
February 27, 2014 15:30
-
-
Save nathanlws/9252331 to your computer and use it in GitHub Desktop.
BooleanNormalizer Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.foundationdb.sql.compiler.BooleanNormalizer; | |
import com.foundationdb.sql.parser.SQLParser; | |
import com.foundationdb.sql.parser.StatementNode; | |
import com.foundationdb.sql.unparser.NodeToString; | |
public class NormalizerDemo { | |
public static void main(String[] args) throws Exception { | |
if(args.length == 0) { | |
return; | |
} | |
SQLParser parser = new SQLParser(); | |
BooleanNormalizer normalizer = new BooleanNormalizer(parser); | |
NodeToString nodeToString = new NodeToString(); | |
StatementNode stmt = parser.parseStatement(args[0]); | |
System.out.println("pre-normalization:"); | |
System.out.println(nodeToString.toString(stmt)); | |
stmt = normalizer.normalize(stmt); | |
System.out.println("post-normalization:"); | |
System.out.println(nodeToString.toString(stmt)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment