public final class StatementWriter extends Object implements Appendable
statement printers in
formatting a statement.
Instances of this class are designed to format one single statement; they keep internal
counters such as the current number of printed bound values, and for this reason, they should not
be reused to format more than one statement. When formatting more than one statement (e.g. when
formatting a BatchStatement and its children), one should call createChildWriter() to create child instances of the main writer to format each individual
statement.
This class is NOT thread-safe.
public StatementWriter createChildWriter()
StatementWriter.
A child writer shares the same buffer as its parent, but has its own independent state. It is most useful when dealing with inner statements in batches (each inner statement should use a child writer).
StatementWriter.public StatementPrinterRegistry getPrinterRegistry()
printer registry.public StatementFormatterLimits getLimits()
public ProtocolVersion getProtocolVersion()
public CodecRegistry getCodecRegistry()
public boolean maxQueryStringLengthExceeded()
true if the maximum query string length is exceeded, false otherwise.public boolean maxAppendedBoundValuesExceeded()
true if the maximum number of bound values per statement is exceeded, false otherwise.public StatementWriter newLine()
public StatementWriter indent()
public StatementWriter append(CharSequence csq)
append in interface Appendablepublic StatementWriter append(CharSequence csq, int start, int end)
append in interface Appendablepublic StatementWriter append(char c)
append in interface Appendablepublic StatementWriter append(Object obj)
public StatementWriter append(String str)
public StatementWriter appendClassNameAndHashCode(Statement<?> statement)
Object.toString().statement - The statement to format.public void appendQueryStringFragment(String queryStringFragment)
This method can be called multiple times, in case the printer needs to compute the query string by pieces.
This methods also keeps track of the amount of characters used so far to print the query
string, and automatically detects when the query string exceeds the maximum length, in which case it truncates
the output.
queryStringFragment - The query string fragment to appendpublic void appendUnsetBoundValue(String name)
Copyright © 2017–2021 DataStax. All rights reserved.