Mysql database abstract syntax tree builder