Link Search Menu Expand Document

SapHanaStatementBuilder


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

Constructors

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

The parameterless constructor passes null for both convertFieldResolver and averageableClientTypeResolver — SAP HANA has no ConvertFieldResolver class of its own, so BaseStatementBuilder’s own defaults are used instead. This differs from Db2, Firebird, Oracle, PostgreSQL, and Vertica, each of which supplies a provider-specific resolver here.

SAP HANA-specific generation notes

  • Paging uses LIMIT/LIMIT ... OFFSET for Query/top-N queries and BatchQuery/skip-take queries (the ANSI LIMIT take OFFSET skip form, not MySQL’s comma-separated LIMIT skip, take).
  • Insert is left as the plain INSERT BaseStatementBuilder already produces — unlike the SQL-Server-family pattern of appending a trailing SELECT ... AS "Result" to hand a generated key back in the same round trip, SAP HANA’s ADO.NET client rejects a command text containing more than one statement. The generated/identity key is instead fetched via a separate GetScopeIdentity round trip; a non-identity primary key is simply read back off the entity the caller already supplied it on.
  • InsertAll/MergeAll reuse the single-row Insert/Merge statement — IsMultiStatementExecutable being false means RepoDb.Core always forces batchSize down to 1 before either is called.
  • Merge compiles to SAP HANA’s native UPSERT ... WITH PRIMARY KEY statement. For the same reason as Insert, no trailing key-returning clause is appended — but this isn’t a functional loss here, since UPSERT ... WITH PRIMARY KEY requires the primary key value up front to match against, so it’s already known on the entity being merged.
  • COUNT/MAX/MIN/SUM post-process BaseStatementBuilder’s output to collapse "COUNT ("/"MAX ("/"MIN ("/"SUM (" (with a space before the opening parenthesis) down to "COUNT("/"MAX("/"MIN("/"SUM(", matching SAP HANA’s own SQL formatting conventions.
  • Truncate is not overridden — SAP HANA has genuine TRUNCATE TABLE support, unlike Firebird and Vertica.
  • Passing a non-null hints argument to any Create* method throws NotSupportedException, since SapHanaDbSetting.AreTableHintsSupported is false.

Usability

Use StatementBuilderMapper to override it with a custom implementation.

StatementBuilderMapper.Add(typeof(HanaConnection), new MyCustomSapHanaStatementBuilder(dbSetting), true);