public String generateQuery() {
resetOnPreInit();
// initialization
SqlChunk chunk = firstChunk;
while (chunk != null) {
chunk.init(this);
chunk = chunk.getNextChunk();
}
// process
StringBuilder query = new StringBuilder();
chunk = firstChunk;
try {
while (chunk != null) {
chunk.process(query);
chunk = chunk.getNextChunk();
}
} catch (DbSqlBuilderException dsbex) {
dsbex.setQueryString(query.toString());
throw dsbex;
}