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 ... OFFSETfor Query/top-N queries and BatchQuery/skip-take queries — noTOP/FIRSTkeyword needed. - InsertAll generates a genuine multi-row
INSERT INTO ... VALUES (...), (...), ...statement, sinceVerticaDbSetting.IsInsertAllBatchableistrueeven thoughIsMultiStatementExecutableisfalse. - Merge/MergeAll never emit a native
MERGEstatement at all — Vertica rejectsMERGEoutright against any table with anIDENTITY/AUTO_INCREMENTcolumn, and has no procedural fallback equivalent to Firebird’sEXECUTE BLOCK. Instead, anUPDATE ... WHERE qualifiersis joined with a trailing; INSERT ... WHERE NOT EXISTS (...)into one command text, with a follow-upSELECT LAST_INSERT_ID()(or aCASE 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 noTRUNCATE TABLEstatement (as of 5.0) — which does not reset anIDENTITYcolumn’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 throughVerticaCommand.CommandText. - Passing a non-null
hintsargument to anyCreate*method throwsNotSupportedException, sinceVerticaDbSetting.AreTableHintsSupportedisfalse.
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 forVerticaCommand(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);