Package org.h2.util

# Interface HasSQL

All Known Implementing Classes:
  `AbstractAggregate`, `Aggregate`, `Alias`, `ArrayConstructorByQuery`, `ArrayElementReference`, `ArrayFunction`, `ArrayTableFunction`, `BetweenPredicate`, `BinaryOperation`, `BitFunction`, `BooleanTest`, `CardinalityExpression`, `CastSpecification`, `CoalesceFunction`, `Column`, `Comment`, `CompareLike`, `Comparison`, `CompatibilityDatePlusTimeOperation`, `CompatibilitySequenceValueFunction`, `CompressFunction`, `ConcatenationOperation`, `ConcatFunction`, `ConditionAndOr`, `ConditionAndOrN`, `ConditionInArray`, `ConditionInConstantSet`, `ConditionInList`, `ConditionInQuery`, `ConditionLocalAndGlobal`, `ConditionNot`, `Constant`, `Constraint`, `ConstraintCheck`, `ConstraintDomain`, `ConstraintReferential`, `ConstraintUnique`, `CryptFunction`, `CSVReadFunction`, `CSVWriteFunction`, `CTE`, `CurrentDateTimeValueFunction`, `CurrentGeneralValueSpecification`, `DataAnalysisOperation`, `DataChangeDeltaTable`, `DataTypeSQLFunction`, `DateTimeFormatFunction`, `DateTimeFunction`, `DayMonthNameFunction`, `DbObject`, `DBObjectFunction`, `DefaultRow`, `DerivedTable`, `Domain`, `DomainValueExpression`, `DualIndex`, `DualTable`, `ExistsPredicate`, `Expression`, `ExpressionColumn`, `ExpressionList`, `ExtTypeInfo`, `ExtTypeInfoEnum`, `ExtTypeInfoGeometry`, `ExtTypeInfoNumeric`, `ExtTypeInfoRow`, `FieldReference`, `FileFunction`, `Format`, `ForUpdate`, `Function0_1`, `Function1`, `Function1_2`, `Function2`, `FunctionAlias`, `FunctionN`, `FunctionsDB2Derby`, `FunctionsLegacy`, `FunctionsMSSQLServer`, `FunctionsMySQL`, `FunctionsOracle`, `FunctionsPostgreSQL`, `FunctionTable`, `GCDFunction`, `HashFunction`, `Index`, `InformationSchema`, `InformationSchemaTable`, `InformationSchemaTableLegacy`, `IntervalOperation`, `IsJsonPredicate`, `JavaAggregate`, `JavaFunction`, `JavaTableFunction`, `JsonConstructorFunction`, `LengthFunction`, `LinkedIndex`, `LinkSchemaFunction`, `MaterializedView`, `MathFunction`, `MathFunction1`, `MathFunction2`, `MergeUsing.When`, `MergeUsing.WhenMatchedThenDelete`, `MergeUsing.WhenMatchedThenUpdate`, `MergeUsing.WhenNotMatched`, `MetaIndex`, `MetaSchema`, `MetaTable`, `ModeFunction`, `MVDelegateIndex`, `MVIndex`, `MVPrimaryIndex`, `MVSecondaryIndex`, `MVSpatialIndex`, `MVTable`, `NullIfFunction`, `NullPredicate`, `NullsDistinct`, `OnDuplicateKeyValues`, `Operation0`, `Operation1`, `Operation1_2`, `Operation2`, `OperationN`, `Parameter`, `PgCatalogSchema`, `PgCatalogTable`, `QueryExpressionIndex`, `QueryExpressionTable`, `RandFunction`, `RangeIndex`, `RangeTable`, `RecursiveIndex`, `Regclass`, `RegexpFunction`, `RegularQueryExpressionIndex`, `Right`, `RightOwner`, `Role`, `Row`, `Rownum`, `Schema`, `SchemaObject`, `SearchedCase`, `SearchRow`, `Sequence`, `SequenceValue`, `SessionControlFunction`, `SetClauseList`, `SetFunction`, `Setting`, `ShadowTable`, `SignalFunction`, `SimpleCase`, `SimplePredicate`, `SimpleRowValue`, `SoundexFunction`, `Sparse`, `SpatialKey`, `StringFunction`, `StringFunction1`, `StringFunction2`, `Subquery`, `SubstringFunction`, `SysInfoFunction`, `Table`, `TableBase`, `TableFunction`, `TableInfoFunction`, `TableLink`, `TableSynonym`, `TableValueConstructorTable`, `TableView`, `TimeZoneOperation`, `ToCharFunction`, `TriggerObject`, `TrimFunction`, `TruncateValueFunction`, `TypedValueExpression`, `TypeInfo`, `TypePredicate`, `UnaryOperation`, `UniquePredicate`, `User`, `UserAggregate`, `UserDefinedFunction`, `Value`, `ValueArray`, `ValueBigint`, `ValueBinary`, `ValueBlob`, `ValueBoolean`, `ValueChar`, `ValueClob`, `ValueCollectionBase`, `ValueDate`, `ValueDecfloat`, `ValueDouble`, `ValueEnum`, `ValueEnumBase`, `ValueExpression`, `ValueGeometry`, `ValueInteger`, `ValueInterval`, `ValueJavaObject`, `ValueJson`, `ValueLob`, `ValueNull`, `ValueNumeric`, `ValueReal`, `ValueRow`, `ValueSmallint`, `ValueTime`, `ValueTimestamp`, `ValueTimestampTimeZone`, `ValueTimeTimeZone`, `ValueTinyint`, `ValueUuid`, `ValueVarbinary`, `ValueVarchar`, `ValueVarcharIgnoreCase`, `Variable`, `VirtualConstructedTable`, `VirtualConstructedTableIndex`, `VirtualTable`, `VirtualTableIndex`, `Wildcard`, `WindowFunction`, `XMLFunction`

public interface HasSQL
An object that has an SQL representation.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ADD_PLAN_INFORMATION`
Add execution plan information.
`static final int`
`DEFAULT_SQL_FLAGS`
Default flags.
`static final int`
`NO_CASTS`
Don't add casts around literals.
`static final int`
`QUOTE_ONLY_WHEN_REQUIRED`
Quote identifiers only when it is strictly required (different case or identifier is also a keyword).
`static final int`
`REPLACE_LOBS_FOR_TRACE`
Replace long LOB values with some generated values.
`static final int`
`TRACE_SQL_FLAGS`
Combined flags for trace.

## Method Summary

Modifier and Type
Method
Description
`default String`
`getSQL(int sqlFlags)`
Get the SQL statement of this expression.
`StringBuilder`
`getSQL(StringBuilder builder, int sqlFlags)`
Appends the SQL statement of this object to the specified builder.
`default String`
`getTraceSQL()`
Get a medium size SQL expression for debugging or tracing.

## Field Details

### QUOTE_ONLY_WHEN_REQUIRED

static final int QUOTE_ONLY_WHEN_REQUIRED
Quote identifiers only when it is strictly required (different case or identifier is also a keyword).

See Also:
  - Constant Field Values

### REPLACE_LOBS_FOR_TRACE

static final int REPLACE_LOBS_FOR_TRACE
Replace long LOB values with some generated values.

See Also:
  - Constant Field Values

### NO_CASTS

static final int NO_CASTS
Don't add casts around literals.

See Also:
  - Constant Field Values

### ADD_PLAN_INFORMATION

static final int ADD_PLAN_INFORMATION
Add execution plan information.

See Also:
  - Constant Field Values

### DEFAULT_SQL_FLAGS

static final int DEFAULT_SQL_FLAGS
Default flags.

See Also:
  - Constant Field Values

### TRACE_SQL_FLAGS

static final int TRACE_SQL_FLAGS
Combined flags for trace.

See Also:
  - Constant Field Values

## Method Details

### getTraceSQL

default String getTraceSQL()
Get a medium size SQL expression for debugging or tracing.

Returns:
  the SQL expression

### getSQL

default String getSQL(int sqlFlags)
Get the SQL statement of this expression. This may not always be the original SQL statement, specially after optimization.

Parameters:
  `sqlFlags` - formatting flags
Returns:
  the SQL statement

### getSQL

StringBuilder getSQL(StringBuilder builder, int sqlFlags)
Appends the SQL statement of this object to the specified builder.

Parameters:
  `builder` - string builder
  `sqlFlags` - formatting flags
Returns:
  the specified string builder