Skip to content

Instantly share code, notes, and snippets.

@nathanlws
Created February 27, 2014 15:30
Show Gist options
  • Save nathanlws/9252331 to your computer and use it in GitHub Desktop.
Save nathanlws/9252331 to your computer and use it in GitHub Desktop.
BooleanNormalizer Example
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