Link Search Menu Expand Document

VerticaStatementBuilder


This class is the BaseStatementBuilder-derived implementation for Vertica. It is automatically registered by VerticaBootstrap — you do not need to instantiate it directly under normal use.

Constructors

public VerticaStatementBuilder()
public VerticaStatementBuilder(IDbSetting dbSetting,
    IResolver<Field, IDbSetting, string> convertFieldResolver = null,
    IResolver<Type, Type> averageableClientTypeResolver = null)

convertFieldResolver defaults to VerticaConvertFieldResolver, used to render CAST(...) expressions for typed fields.

Vertica-specific generation notes

  • Paging uses LIMIT/LIMIT ... OFFSET for Query/top-N queries and BatchQuery/skip-take queries — no TOP/FIRST keyword needed.
  • InsertAll generates a genuine multi-row INSERT INTO ... VALUES (...), (...), ... statement, since VerticaDbSetting.IsInsertAllBatchable is true even though IsMultiStatementExecutable is false.
  • Merge/MergeAll never emit a native MERGE statement at all — Vertica rejects MERGE outright against any table with an IDENTITY/AUTO_INCREMENT column, and has no procedural fallback equivalent to Firebird’s EXECUTE BLOCK. Instead, an UPDATE ... WHERE qualifiers is joined with a trailing ; INSERT ... WHERE NOT EXISTS (...) into one command text, with a follow-up SELECT LAST_INSERT_ID() (or a CASE WHEN <identity-param> IS NULL THEN LAST_INSERT_ID() ELSE <identity-param> END, when the identity column is itself a qualifier) appended when a key needs to be returned.
  • Truncate compiles to a plain DELETE FROM t — Vertica has no TRUNCATE TABLE statement (as of 5.0) — which does not reset an IDENTITY column’s next value.
  • Every generated statement omits the trailing ; that BaseStatementBuilder normally appends, since Vertica’s DSQL layer rejects a trailing statement terminator on a statement submitted through VerticaCommand.CommandText.
  • Passing a non-null hints argument to any Create* method throws NotSupportedException, since VerticaDbSetting.AreTableHintsSupported is false.

Merge/MergeAll’s UPDATE ...; INSERT ... command text is a compound, ;-joined statement carrying parameters in both halves — this has not been verified against a live Vertica instance, and conflicts with the same compound-statement restriction documented elsewhere for VerticaCommand (see Operations (Vertica)). Verify this end-to-end before relying on Merge/MergeAll in production.

Usability

Use StatementBuilderMapper to override it with a custom implementation.

StatementBuilderMapper.Add(typeof(VerticaConnection), new MyCustomVerticaStatementBuilder(dbSetting), true);