Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change QueryPart rendering and binding API to use Configuration and Context as callback parameters #758

Closed
lukaseder opened this issue Jul 22, 2012 · 0 comments

Comments

@lukaseder
Copy link
Member

The current API consists of

bindReference(Configuration, ..);
bindDeclaration(Configuration, ..);
toSQLReference(Configuration, ..);
toSQLDeclaration(Configuration, ..);

This is not good enough for some use cases. The API needs to be adapted every time a new parameter needs to be passed to sub-parts. A better API is to introduce a new Context type, which has the life-span of one rendering call or one binding call (unlike the Configuration:

void toSQL(Configuration, RenderingContext);
void bind(Configuration, BindingContext);

with

interface RenderingContext {
  StringBuilder builder();
  boolean asDeclaration();
  boolean inlineParameters();
  boolean inSubquery();
}

interface BindingContext {
  int index();
  void index(int index);
  boolean asDeclaration();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant