Codota Logo
RenderContext
Code IndexAdd Codota to your IDE (free)

How to use
RenderContext
in
org.jooq

Best Java code snippets using org.jooq.RenderContext (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private void toSQLWrapped(RenderContext context) {
  context.sql(wrapInParentheses ? "(" : "")
      .visit(wrapped)
      .sql(wrapInParentheses ? ")" : "");
}
origin: palantir/atlasdb

TableLike<?> values(DSLContext ctx, RowN[] rows, String tableName, String... fieldNames) {
  switch (sqlDialect.family()) {
  case H2:
    List<SelectField<?>> fields = Lists.newArrayListWithCapacity(fieldNames.length);
    for (int i = 1; i <= fieldNames.length; i++) {
      fields.add(DSL.field("C" + i).as(fieldNames[i-1]));
    }
    RenderContext context = ctx.renderContext();
    context.start(TABLE_VALUES)
      .keyword("values")
      .formatIndentLockStart();
    boolean firstRow = true;
    for (Row row : rows) {
      if (!firstRow) {
        context.sql(',').formatSeparator();
      }
      context.sql(row.toString());
      firstRow = false;
    }
    context.formatIndentLockEnd()
      .end(TABLE_VALUES);
    String valuesClause = context.render();
    return ctx.select(fields).from(valuesClause).asTable(tableName);
  default:
    return DSL.values(rows).as(tableName, fieldNames);
  }
}
origin: org.jooq/jooq

DefaultRenderContext(RenderContext context) {
  this(context.configuration());
  paramType(context.paramType());
  qualifyCatalog(context.qualifyCatalog());
  qualifySchema(context.qualifySchema());
  quote(context.quote());
  castMode(context.castMode());
  data().putAll(context.data());
  declareCTE = context.declareCTE();
  declareWindows = context.declareWindows();
  declareFields = context.declareFields();
  declareTables = context.declareTables();
  declareAliases = context.declareAliases();
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  context.visit(row)
      .sql(" ")
      .keyword(isNull ? "is null" : "is not null");
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

SQLDialect dialect = context.configuration().dialect();
context.start(SELECT_SELECT)
    .keyword("select")
    .sql(" ");
  context.sql(hint).sql(" ");
  context.keyword("distinct").sql(" ");
context.declareFields(true);
if (context.subquery() && dialect == H2 && context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY) != null) {
  Object data = context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
    context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, null);
    context.sql("(")
        .visit(getSelect1())
        .sql(")");
    context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, data);
  context.visit(getSelect1());
  ParamType paramType = context.paramType();
  context.paramType(INLINED)
      .sql(",")
      .formatIndentStart()
      .formatSeparator()
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  context.start(UPDATE_UPDATE)
      .keyword("update")
      .sql(" ")
      .declareTables(true)
      .visit(getInto())
      .declareTables(false)
      .end(UPDATE_UPDATE);
  context.formatSeparator()
      .start(UPDATE_SET)
      .keyword("set")
      .sql(" ");
    boolean qualify = context.qualify();
    context.start(UPDATE_SET_ASSIGNMENT)
        .qualify(false)
        .visit(multiRow)
        .qualify(qualify)
        .sql(" = ");
    if (multiValue != null && !asList().contains(context.configuration().dialect().family())) {
      context.visit(multiValue);
      context.sql("(")
          .formatIndentStart()
          .formatNewLine()
          .subquery(true)
origin: com.ning.billing/killbill-osgi-bundles-analytics

private final void toSQLStandard(RenderContext context) {
  context.start(MERGE_MERGE_INTO)
      .keyword("merge into").sql(" ")
      .declareTables(true)
      .visit(table)
      .declareTables(false)
      .end(MERGE_MERGE_INTO)
      .formatSeparator()
      .start(MERGE_USING)
      .declareTables(true)
      .keyword("using").sql(" ")
      .formatIndentStart()
      .formatNewLine();
  context.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, true);
  context.visit(using);
  context.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, null);
  context.formatIndentEnd()
      .declareTables(false);
  context.end(MERGE_USING)
      .formatSeparator()
      .start(MERGE_ON)
      .keyword("on").sql(onParentheses ? " (" : " ")
      .visit(on)
      .sql(onParentheses ? ")" : "")
      .end(MERGE_ON)
      .start(MERGE_WHEN_MATCHED_THEN_UPDATE)
      .start(MERGE_SET);
origin: org.jooq/jooq

private final void toSQLQualifiedName(RenderContext ctx) {
  if (ctx.qualify()) {
    Schema mapped = Tools.getMappedSchema(ctx.configuration(), getSchema());
    if (mapped != null && !"".equals(mapped.getName()))
      ctx.visit(mapped)
        .sql('.');
  }
  ctx.literal(getName());
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  if (context.declareFields() || context.declareTables()) {
    SQLDialect dialect = context.configuration().dialect();
    boolean simulateDerivedColumnList = false;
        select(list(field("*"))).from(((Table<?>) wrapped).as(alias));
      context.sql("(").formatIndentStart().formatNewLine()
          .visit(select).formatIndentEnd().formatNewLine()
          .sql(")");
        select(field("*")).from(((Table<?>) wrapped).as(alias)));
      context.sql("(").formatIndentStart().formatNewLine()
          .visit(select).formatIndentEnd().formatNewLine()
          .sql(")");
    context.sql(" ");
    context.literal(alias);
          if (context.declareTables() && o instanceof ArrayTable) {
            ArrayTable table = (ArrayTable) o;
            context.sql("(");
            Utils.fieldNames(context, table.fields());
            context.sql(")");
    context.literal(alias);
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  boolean declare = context.declareTables();
  context.start(DELETE_DELETE)
      .keyword("delete").sql(" ");
  // [#2464] MySQL supports a peculiar multi-table DELETE syntax for aliased tables:
  // DELETE t1 FROM my_table AS t1
  if (asList(MARIADB, MYSQL).contains(context.configuration().dialect())) {
    // [#2579] TODO: Improve Table API to discover aliased tables more
    // reliably instead of resorting to instanceof:
    if (getFrom() instanceof TableAlias ||
      (getFrom() instanceof TableImpl && ((TableImpl<R>)getFrom()).getAliasedTable() != null)) {
      context.visit(getFrom())
          .sql(" ");
    }
  }
  context.keyword("from").sql(" ")
      .declareTables(true)
      .visit(getFrom())
      .declareTables(declare)
      .end(DELETE_DELETE)
      .start(DELETE_WHERE);
  if (!(getWhere() instanceof TrueCondition)) {
    context.formatSeparator()
        .keyword("where").sql(" ")
        .visit(getWhere());
  }
  context.end(DELETE_WHERE);
}
origin: org.jooq/jooq

.dsl()
.renderContext()
.declareTables(true)
.sql('(')
.formatIndentStart(e1.indent)
.formatIndentStart()
.formatNewLine()
.visit(e1.joinNode.joinTree())
.formatNewLine()
.sql(')')
.render();
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  ParamType paramType = context.paramType();
  CastMode castMode = context.castMode();
  switch (context.configuration().dialect()) {
    case POSTGRES: // No break
    case SQLITE: {
      context.castMode(NEVER)
          .formatSeparator()
          .keyword("limit")
          .sql(" ").visit(numberOfRows)
          .sql(" ").keyword("offset")
          .sql(" ").visit(offsetOrZero)
          .castMode(castMode);
      context.castMode(NEVER)
          .formatSeparator()
          .keyword("limit")
          .sql(" ").visit(offsetOrZero)
          .sql(", ").visit(numberOfRows)
          .castMode(castMode);
      context.castMode(NEVER)
          .formatSeparator()
          .keyword("rows")
          .sql(" ").visit(getLowerRownum().add(inline(1)))
          .sql(" ").keyword("to")
          .sql(" ").visit(getUpperRownum())
origin: org.jooq/jooq

@Override
public String renderInlined(QueryPart part) {
  return renderContext().paramType(INLINED).visit(part).render();
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  // Some databases need extra parentheses around the RHS
  boolean extraParentheses = asList().contains(context.configuration().dialect().family());
  boolean subquery = context.subquery();
  context.visit(left)
      .sql(" ")
      .keyword(comparator.toSQL())
      .sql(" (")
      .sql(extraParentheses ? "(" : "");
  context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, true);
  context.subquery(true)
      .visit(right)
      .subquery(subquery);
  context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, null);
  context.sql(extraParentheses ? ")" : "")
      .sql(")");
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

private final void toSQLH2(RenderContext context) {
  context.keyword("merge into")
      .sql(" ")
      .declareTables(true)
      .visit(table)
      .formatSeparator();
  context.sql("(");
  Utils.fieldNames(context, getH2Fields());
  context.sql(")");
  if (!getH2Keys().isEmpty()) {
    context.sql(" ").keyword("key").sql(" (");
    Utils.fieldNames(context, getH2Keys());
    context.sql(")");
  }
  if (h2Select != null) {
    context.sql(" ")
        .visit(h2Select);
  }
  else {
    context.sql(" ").keyword("values").sql(" (")
        .visit(getH2Values())
        .sql(")");
  }
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext context) {
  context.data(DATA_OMIT_CLAUSE_EVENT_EMISSION, true);
  if (context.qualify()) {
    context.visit(table);
    context.sql(".");
  }
  context.literal(getName());
  context.data(DATA_OMIT_CLAUSE_EVENT_EMISSION, null);
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public final void toSQL(RenderContext ctx) {
  ctx.visit(table(ctx.configuration()));
}
origin: org.jooq/jooq

SQLDialect dialect = render.dialect();
SQLDialect family = dialect.family();
boolean mysql = SUPPORT_MYSQL_SYNTAX.contains(family);
    for (; i < sqlChars.length && sqlChars[i] != '\r' && sqlChars[i] != '\n'; render.sql(sqlChars[i++]));
    if (i < sqlChars.length) render.sql(sqlChars[i]);
    for (; !peek(sqlChars, i, TOKEN_MULTI_LINE_COMMENT_CLOSE); render.sql(sqlChars[i++]));
    render.sql(sqlChars[i++]);
    render.sql(sqlChars[i]);
    render.sql(sqlChars[i++]);
        render.sql(sqlChars[i++]);
        render.sql(sqlChars[i++]);
      render.sql(sqlChars[i++]);
    render.sql(sqlChars[i]);
    render.sql(sqlChars[i++]);
    render.sql(sqlChars[i++]);
        render.sql(sqlChars[i++]);
        render.sql(sqlChars[i++]);
origin: com.ning.billing/killbill-osgi-bundles-analytics

DefaultRenderContext(RenderContext context) {
  this(context.configuration());
  paramType(context.paramType());
  qualify(context.qualify());
  castMode(context.castMode());
  declareFields(context.declareFields());
  declareTables(context.declareTables());
  data().putAll(context.data());
}
origin: com.ning.billing/killbill-osgi-bundles-analytics

  @Override
  public void toSQL(RenderContext context) {
    context.sql("(").keyword("select").sql(" * ")
        .keyword("from").sql(" ").keyword("unnest").sql("(").visit(array).sql(") ")
        .keyword("as").sql(" ").literal(alias)
        .sql("(").literal("COLUMN_VALUE").sql("))");
  }
}
org.jooqRenderContext

Javadoc

The render context is used for rendering QueryPart's to SQL.

A new render context is instantiated every time a Query is rendered. QueryPart's will then pass the same context to their components

Most used methods

  • sql
    Recurse rendering.
  • visit
  • render
    Render a query part in a new context derived from this one. The rendered SQL will not be appended to
  • declareTables
  • paramType
    Set the new context value for #paramType().
  • castMode
    Set the new cast mode for #castMode().
  • configuration
  • data
  • declareFields
  • declareWindows
  • end
  • formatIndentEnd
    Stop indenting subsequent SQL by a number of characters, if Settings#isRenderFormatted() is set to t
  • end,
  • formatIndentEnd,
  • formatIndentLockEnd,
  • formatIndentLockStart,
  • formatIndentStart,
  • formatNewLine,
  • formatSeparator,
  • keyword,
  • literal,
  • nextAlias

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getSystemService (Context)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now