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
nullfor bothconvertFieldResolverandaverageableClientTypeResolver— SAP HANA has noConvertFieldResolverclass 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 ... OFFSETfor Query/top-N queries and BatchQuery/skip-take queries (the ANSILIMIT take OFFSET skipform, not MySQL’s comma-separatedLIMIT skip, take). - Insert is left as the plain
INSERTBaseStatementBuilder already produces — unlike the SQL-Server-family pattern of appending a trailingSELECT ... 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 —
IsMultiStatementExecutablebeingfalsemeans RepoDb.Core always forcesbatchSizedown to1before either is called. - Merge compiles to SAP HANA’s native
UPSERT ... WITH PRIMARY KEYstatement. For the same reason as Insert, no trailing key-returning clause is appended — but this isn’t a functional loss here, sinceUPSERT ... WITH PRIMARY KEYrequires the primary key value up front to match against, so it’s already known on the entity being merged. COUNT/MAX/MIN/SUMpost-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 TABLEsupport, unlike Firebird and Vertica. - Passing a non-null
hintsargument to anyCreate*method throwsNotSupportedException, sinceSapHanaDbSetting.AreTableHintsSupportedisfalse.
Usability
Use StatementBuilderMapper to override it with a custom implementation.
StatementBuilderMapper.Add(typeof(HanaConnection), new MyCustomSapHanaStatementBuilder(dbSetting), true);