Class SqliteFts5CommandBuilder
Fluent terminal for a SQLite FTS5 maintenance/control command, started with
CreateSqliteFts5CommandBuilder(IDataContext, string). The operation is issued through the
FTS5 control interface (INSERT INTO <table>(...) VALUES(...)); a provider without FTS5
rejects it with NotSupportedException. The builder is immutable: every operation method
returns a new builder and leaves the receiver unchanged.
public sealed class SqliteFts5CommandBuilder
- Inheritance
-
SqliteFts5CommandBuilder
- Inherited Members
- Extension Methods
Methods
AutoMerge(int)
Selects the FTS5 automerge command, which merges up to value b-tree segments.
public SqliteFts5CommandBuilder AutoMerge(int value)
Parameters
valueintThe automerge level; must be between 0 and 16 inclusive.
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
automergeoperation.
Exceptions
- ArgumentOutOfRangeException
valueis outside 0..16.
CrisisMerge(int)
Selects the FTS5 crisismerge command, which merges the value largest segments.
public SqliteFts5CommandBuilder CrisisMerge(int value)
Parameters
valueintThe number of largest segments to merge; must not be negative.
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
crisismergeoperation.
Exceptions
- ArgumentOutOfRangeException
valueis negative.
Execute()
Executes the maintenance command and returns the affected-row count where the provider reports one.
public int Execute()
Returns
- int
The affected-row count, or 0 where the provider reports none.
Exceptions
- InvalidOperationException
No FTS5 maintenance command was selected.
- NotSupportedException
The context is read-only, or the provider does not support SQLite FTS5.
ExecuteAsync(CancellationToken)
Asynchronously executes the maintenance command and returns the affected-row count where the provider reports one.
public Task<int> ExecuteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels execution.
Returns
Exceptions
- InvalidOperationException
No FTS5 maintenance command was selected.
- NotSupportedException
The context is read-only, or the provider does not support SQLite FTS5.
IntegrityCheck(bool?)
Selects the FTS5 integrity-check command, which validates the full-text index.
public SqliteFts5CommandBuilder IntegrityCheck(bool? checkExternalContent = null)
Parameters
checkExternalContentbool?Whether to also verify the external content; null omits the rank argument, false passes 0 (internal consistency only) and true passes 1 (also verify the content table).
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
integrity-checkoperation.
Merge(int)
Selects the FTS5 merge command, which merges pages pages of b-tree segments.
public SqliteFts5CommandBuilder Merge(int pages)
Parameters
pagesintThe number of pages to merge; the signed value is passed through unchanged.
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
mergeoperation.
Optimize()
Selects the FTS5 optimize command, which merges the whole full-text index into one segment.
public SqliteFts5CommandBuilder Optimize()
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
optimizeoperation.
Rebuild()
Selects the FTS5 rebuild command, which rebuilds the full-text index from the content table.
public SqliteFts5CommandBuilder Rebuild()
Returns
- SqliteFts5CommandBuilder
A new builder carrying the
rebuildoperation.
ToSql()
Renders the SQL this builder would execute, without executing it.
public string ToSql()
Returns
- string
The rendered SQL text.
Exceptions
- InvalidOperationException
No FTS5 maintenance command was selected.
- NotSupportedException
The context is not database-backed, or the provider does not support SQLite FTS5.