Hi For future visitors, this question was cross-posted on Stack Overflow here: http://stackoverflow.com/q/26809490/521799
... the answer is the same: Query.getSQL() <http://www.jooq.org/javadoc/latest/org/jooq/Query.html#getSQL--> generates the SQL statement as it would be generated if you let jOOQ execute a PreparedStatement - with bind variables. The bind variables can be extracted in the right order via Query.getBindValues() <http://www.jooq.org/javadoc/latest/org/jooq/Query.html#getBindValues--> If you want to inline all bind values into the generated SQL, you have various options through the jOOQ API (all equivalent): - Using Query.getSQL(ParamType) <http://www.jooq.org/javadoc/latest/org/jooq/Query.html#getSQL-org.jooq.conf.ParamType-> with ParamType.INLINE - Using dsl.renderInlined(QueryPart) <http://www.jooq.org/javadoc/latest/org/jooq/DSLContext.html#renderInlined-org.jooq.QueryPart-> - Using StatementType.STATIC_STATEMENT <http://www.jooq.org/javadoc/latest/org/jooq/conf/StatementType.html#STATIC_STATEMENT> in your Settings <http://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/> Hope this helps, Lukas 2014-11-07 22:35 GMT+01:00 Andrey Sapunov <[email protected]>: > I would like to launch simple code: > > > SelectQuery query = dsl.select(field ("id"), > field("title")).from("dict.models").getQuery(); > > if (companyId > 0) query.addConditions(field("company_id").equal(companyId)); > if (modelId > 0) query.addConditions(field("model_id", > SQLDataType.INTEGER).equal(modelId)); > > > > But unfortunately, in query.getSQL() I can see only: > > select id, title from dict.models where (company_id = ? and model_id = ?) > > Values for model_id and company_id are 5 and 10 (possible to see in debugger) > > > Please, help me, where I was wrong. > > Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
