sql-generation

Writing a SQL generator, What Should I Read Up On?

I am soon going to be writing a component that takes metadata and generates dynamic SQL from it. Mostly we're talking SELECT, INSERT, UPDATE, DELETE stuff but I suppose it's possible to have some CREATE/ALTER TABLE statements in there too. I'm assured that no existing ORM solution fits the bill but otherwise the details on what where a...

How generate the SQL queries that match the JPA Entity CRUD operations at build time with Hibernate

Given JPA annotated Entities, is it possible to generate (i.e. before runtime) the list of queries that will be performed by Hibernate for CRUD operations (performed against EntityManager) ? For named queries it is possible using org.hibernate.hql.QueryTranslator Any pointer into the Hibernate API will be appreciated. ...

Doctrine SQL/table generation failing

Hello, I am trying to make Doctrine generate SQL from a set of models that I created earlier with a YAML schema. Using the code below which comes from the manual the output should be a set of queries. <?php // test.php require_once('bootstrap.php'); try { $models = Doctrine_Core::generateSqlFromModels('models/generated'); ec...

How can I generate the SQL query using SQL::Abstract?

How do I generate the WHERE clause for this query using SQL::Abstract: SELECT COUNT(*) FROM table WHERE id = 111 AND NOT FIND_IN_SET(type, '1,2,3,4') AND status = 'pending'; What's the proper way to include conditions like WHERE FIND_IN_SET(type, '1,2,3,4')? ...