Class SQLiteExtensions
- Namespace
- LinqToDB.DataProvider.SQLite
- Assembly
- linq2db.dll
public static class SQLiteExtensions
- Inheritance
-
SQLiteExtensions
Methods
FTS3AutoMerge<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS3/FTS4 'automerge' command for specific table. Example: "INSERT INTO table(table) VALUES('automerge=segments')".
public static void FTS3AutoMerge<TEntity>(this DataConnection dc, ITable<TEntity> table, int segments) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
segments
intSegments command parameter.
Type Parameters
TEntity
Table mapping class.
FTS3IntegrityCheck<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS3/FTS4 'integrity-check' command for specific table. Example: "INSERT INTO table(table) VALUES('integrity-check')".
public static void FTS3IntegrityCheck<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS3MatchInfo<TEntity>(ISQLiteExtensions?, TEntity)
FTS3/4 matchinfo(fts_table) function. Example: "matchinfo(table)".
[ExpressionMethod("Fts3MatchInfoImpl1")]
public static byte[] FTS3MatchInfo<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
Returns
- byte[]
Check documentation of SQLite site.
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3MatchInfo<TEntity>(ISQLiteExtensions?, TEntity, string)
FTS3/4 matchinfo(fts_table, format) function. Example: "matchinfo(table, 'format')".
[ExpressionMethod("Fts3MatchInfoImpl2")]
public static byte[] FTS3MatchInfo<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string format) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
format
stringFormat string function parameter.
Returns
- byte[]
Check documentation of SQLite site.
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Merge<TEntity>(DataConnection, ITable<TEntity>, int, int)
Executes FTS3/FTS4 'merge' command for specific table. Example: "INSERT INTO table(table) VALUES('merge=blocks,segments')".
public static void FTS3Merge<TEntity>(this DataConnection dc, ITable<TEntity> table, int blocks, int segments) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
blocks
intBlocks command parameter.
segments
intSegments command parameter.
Type Parameters
TEntity
Table mapping class.
FTS3Offsets<TEntity>(ISQLiteExtensions?, TEntity)
FTS3/4 offsets(fts_table) function. Example: "offsets(table)".
[ExpressionMethod("Fts3OffsetsImpl")]
public static string FTS3Offsets<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Optimize<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS3/FTS4 'optimize' command for specific table. Example: "INSERT INTO table(table) VALUES('optimize')".
public static void FTS3Optimize<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS3Rebuild<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS3/FTS4 'rebuild' command for specific table. Example: "INSERT INTO table(table) VALUES('rebuild')".
public static void FTS3Rebuild<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity)
FTS3/4 snippet(fts_table) function. Example: "snippet(table)".
[ExpressionMethod("Fts3SnippetImpl1")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity, string)
FTS3/4 snippet(fts_table, startMatch) function. Example: "snippet(table, 'startMatch')".
[ExpressionMethod("Fts3SnippetImpl2")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string startMatch) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
startMatch
stringStart match wrap text.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity, string, string)
FTS3/4 snippet(fts_table, startMatch, endMatch) function. Example: "snippet(table, 'startMatch', 'endMatch')".
[ExpressionMethod("Fts3SnippetImpl3")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string startMatch, string endMatch) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity, string, string, string)
FTS3/4 snippet(fts_table, startMatch, endMatch, ellipses) function. Example: "snippet(table, 'startMatch', 'endMatch', 'ellipses')".
[ExpressionMethod("Fts3SnippetImpl4")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string startMatch, string endMatch, string ellipses) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
ellipses
stringEllipses text.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity, string, string, string, int)
FTS3/4 snippet(fts_table, startMatch, endMatch, ellipses, columnIndex) function. Example: "snippet(table, 'startMatch', 'endMatch', 'ellipses', columnIndex)".
[ExpressionMethod("Fts3SnippetImpl5")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string startMatch, string endMatch, string ellipses, int columnIndex) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
ellipses
stringEllipses text.
columnIndex
intIndex of column to extract snippet from.
-1
matches all columns.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS3Snippet<TEntity>(ISQLiteExtensions?, TEntity, string, string, string, int, int)
FTS3/4 snippet(fts_table, startMatch, endMatch, ellipses, columnIndex, tokensNumber) function. Example: "snippet(table, 'startMatch', 'endMatch', 'ellipses', columnIndex, tokensNumber)".
[ExpressionMethod("Fts3SnippetImpl6")]
public static string FTS3Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, string startMatch, string endMatch, string ellipses, int columnIndex, int tokensNumber) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
ellipses
stringEllipses text.
columnIndex
intIndex of column to extract snippet from.
-1
matches all columns.tokensNumber
intManages how many tokens should be returned (check function documentation).
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS3/4.
FTS5AutoMerge<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS5 'automerge' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('automerge', value)".
public static void FTS5AutoMerge<TEntity>(this DataConnection dc, ITable<TEntity> table, int value) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
value
intCommand parameter.
Type Parameters
TEntity
Table mapping class.
FTS5CrisisMerge<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS5 'crisismerge' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('crisismerge', value)".
public static void FTS5CrisisMerge<TEntity>(this DataConnection dc, ITable<TEntity> table, int value) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
value
intCommand parameter.
Type Parameters
TEntity
Table mapping class.
FTS5DeleteAll<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS5 'delete-all' command for specific table. Example: "INSERT INTO table(table) VALUES('delete-all')".
public static void FTS5DeleteAll<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS5Delete<TEntity>(DataConnection, ITable<TEntity>, int, TEntity)
Executes FTS5 'delete' command for specific table. Example: "INSERT INTO table(table, rowid, col1, col2) VALUES('delete', rowid, 'col1_value', 'col2_value')".
public static void FTS5Delete<TEntity>(this DataConnection dc, ITable<TEntity> table, int rowid, TEntity record) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
rowid
intRecord rowid value.
record
TEntityCurrent record entity.
Type Parameters
TEntity
Table mapping class.
FTS5Highlight<TEntity>(ISQLiteExtensions?, TEntity, int, string, string)
FTS5 highlight(fts_table, columnIndex, startMatch, endMatch) function. Example: "highlight(table, columnIndex, 'startMatch', 'endMatch')".
[ExpressionMethod("Fts5HighlightImpl")]
public static string FTS5Highlight<TEntity>(this ISQLiteExtensions? ext, TEntity entity, int columnIndex, string startMatch, string endMatch) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
columnIndex
intIndex of column to extract highlighted text from.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS5.
FTS5IntegrityCheck<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS5 'integrity-check' command for specific table. Example: "INSERT INTO table(table) VALUES('integrity-check')".
public static void FTS5IntegrityCheck<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS5Merge<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS5 'merge' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('merge', value)".
public static void FTS5Merge<TEntity>(this DataConnection dc, ITable<TEntity> table, int value) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
value
intCommand parameter.
Type Parameters
TEntity
Table mapping class.
FTS5Optimize<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS5 'optimize' command for specific table. Example: "INSERT INTO table(table) VALUES('optimize')".
public static void FTS5Optimize<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS5Pgsz<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS5 'pgsz' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('pgsz', value)".
public static void FTS5Pgsz<TEntity>(this DataConnection dc, ITable<TEntity> table, int value) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
value
intCommand parameter.
Type Parameters
TEntity
Table mapping class.
FTS5Rank<TEntity>(DataConnection, ITable<TEntity>, string)
Executes FTS5 'rank' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('rank', 'function')".
public static void FTS5Rank<TEntity>(this DataConnection dc, ITable<TEntity> table, string function) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
function
stringRank function.
Type Parameters
TEntity
Table mapping class.
FTS5Rebuild<TEntity>(DataConnection, ITable<TEntity>)
Executes FTS5 'rebuild' command for specific table. Example: "INSERT INTO table(table) VALUES('rebuild')".
public static void FTS5Rebuild<TEntity>(this DataConnection dc, ITable<TEntity> table) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
Type Parameters
TEntity
Table mapping class.
FTS5Snippet<TEntity>(ISQLiteExtensions?, TEntity, int, string, string, string, int)
FTS5 snippet(fts_table, columnIndex, startMatch, endMatch, ellipses, tokensNumber) function. Example: "snippet(table, columnIndex, 'startMatch', 'endMatch', 'ellipses', tokensNumber)".
[ExpressionMethod("Fts5SnippetImpl")]
public static string FTS5Snippet<TEntity>(this ISQLiteExtensions? ext, TEntity entity, int columnIndex, string startMatch, string endMatch, string ellipses, int tokensNumber) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
columnIndex
intIndex of column to extract snippet from.
startMatch
stringStart match wrap text.
endMatch
stringEnd match wrap text.
ellipses
stringEllipses text.
tokensNumber
intManages how many tokens should be returned (check function documentation).
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS5.
FTS5UserMerge<TEntity>(DataConnection, ITable<TEntity>, int)
Executes FTS5 'usermerge' command for specific table. Example: "INSERT INTO table(table, rank) VALUES('usermerge', value)".
public static void FTS5UserMerge<TEntity>(this DataConnection dc, ITable<TEntity> table, int value) where TEntity : class
Parameters
dc
DataConnectionDataConnection instance.
table
ITable<TEntity>FTS table.
value
intCommand parameter.
Type Parameters
TEntity
Table mapping class.
FTS5bm25<TEntity>(ISQLiteExtensions?, TEntity)
FTS5 bm25(fts_table) function. Example: "bm25(table)".
[ExpressionMethod("Fts5bm25Impl1")]
public static double FTS5bm25<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS5.
FTS5bm25<TEntity>(ISQLiteExtensions?, TEntity, params double[])
FTS5 bm25(fts_table, ...weights) function. Example: "bm25(table, col1_weight, col2_weight)".
[ExpressionMethod("Fts5bm25Impl2")]
public static double FTS5bm25<TEntity>(this ISQLiteExtensions? ext, TEntity entity, params double[] weights) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityFull-text search table.
weights
double[]Weights for columns (each value appied to corresponding column).
Returns
Type Parameters
TEntity
Full-text search table mapping class.
Remarks
FTS Support: FTS5.
Match(ISQLiteExtensions?, object?, string)
Applies full-text search condition using MATCH predicate against whole FTS table or specific column. Examples: "table MATCH 'search query'"/"table.column MATCH 'search query'".
[ExpressionMethod("MatchImpl1")]
public static bool Match(this ISQLiteExtensions? ext, object? entityOrColumn, string match)
Parameters
ext
ISQLiteExtensionsExtension point.
entityOrColumn
objectTable or column to perform full-text search against.
match
stringFull-text search condition.
Returns
- bool
Returns
true
if full-text search found matching records.
Remarks
FTS Support: FTS3/4, FTS5.
MatchTable<TEntity>(ISQLiteExtensions?, ITable<TEntity>, string)
Performs full-text search query against specified table and returns search results. Example: "table('search query')".
[ExpressionMethod("MatchTableImpl1")]
public static IQueryable<TEntity> MatchTable<TEntity>(this ISQLiteExtensions? ext, ITable<TEntity> table, string match) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
table
ITable<TEntity>Table to perform full-text search against.
match
stringFull-text search condition.
Returns
- IQueryable<TEntity>
Returns table, filtered using specified search condition, applied to whole table.
Type Parameters
TEntity
Queried table mapping class.
Remarks
FTS Support: FTS5.
Rank<TEntity>(ISQLiteExtensions?, TEntity)
Provides access to FTS5 rank hidden column. Example: "table.rank".
[ExpressionMethod("RankImpl")]
public static double? Rank<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityTable record instance.
Returns
- double?
Returns rank column value.
Type Parameters
TEntity
Type of table mapping class.
Remarks
FTS Support: FTS5.
RowId<TEntity>(ISQLiteExtensions?, TEntity)
Provides access to rowid hidden column. Example: "table.rowid".
[ExpressionMethod("RowIdImpl")]
public static int RowId<TEntity>(this ISQLiteExtensions? ext, TEntity entity) where TEntity : class
Parameters
ext
ISQLiteExtensionsExtension point.
entity
TEntityTable record instance.
Returns
- int
Returns rowid column value.
Type Parameters
TEntity
Type of table mapping class.
SQLite(ISqlExtension?)
public static ISQLiteExtensions? SQLite(this Sql.ISqlExtension? ext)
Parameters
ext
Sql.ISqlExtension