AhtolaStatementBuilder
A class used to build the SQL statements for Ahtola.
This class is the BaseStatementBuilder-derived implementation for Ahtola. It is automatically registered by AhtolaBootstrap — you do not need to instantiate it directly under normal use.
It generates [table]-quoted, @-parameterized SQL, and uses LIMIT/OFFSET for BatchQuery and the internal skip/take query.
CreateMergeandCreateMergeAllthrowNotImplementedException— SQLite has noMERGEstatement. This normally wouldn’t matter, since Merge/MergeAll never reach these methods: AhtolaDbSetting setsIsUseUpserttotrue, which reroutes both operations through an Exists-then-Insert/Update flow instead. The exception only surfaces if you callCreateMerge/CreateMergeAlldirectly, or if a custom IDbSetting setsIsUseUpsertback tofalsefor theSqliteConnection.
For Insert, the newly generated identity or primary key value is returned via CAST(last_insert_rowid() AS ...) (identity column) or the supplied parameter (non-identity primary key). InsertAll instead appends a SQLite RETURNING clause to read back the generated value per batched row.
Truncate is compiled as DELETE FROM [table] ; VACUUM, since SQLite has no native TRUNCATE TABLE statement.
Constructors
public AhtolaStatementBuilder(IDbSetting dbSetting,
IResolver<Field, IDbSetting, string> convertFieldResolver = null,
IResolver<Type, Type> averageableClientTypeResolver = null)
convertFieldResolver defaults to AhtolaConvertFieldResolver, used to render CAST(...) expressions for typed fields.
Usability
Use StatementBuilderMapper to override it with a custom implementation.
StatementBuilderMapper.Add(typeof(SqliteConnection), new MyCustomAhtolaStatementBuilder(dbSetting), true);