I do not want an ORM. I am comfortable with writing heavily targeted and optimized queries on my own, and I do not want any sort of ORM bloating my code.
I am looking for a light-weight, object-oriented query parser and builder that can transform an existing SQL string into a malleable query building object for further manipulation before recompiling and executing on the database.
The use case itself is updating queries that execute against tables within a public schema that contain current-valid information with substitute tables from an auditing schema while adding predicates in the WHERE clause to present point-in-time data from the (newly substituted) valid-time state tables.
My other use case is to manipulate pre-written queries to provide additional filters before execution.
A parser / builder will allow me to write current-valid queries but transform them effortlessly into the point-in-time equivalent. I'm currently planning on raiding Doctrine 2's QueryBuilder
for the reconstruction part. Does anyone know of a an excellent library for parsing SQL queries into their base components?