Exemple #1
0
        /// <summary>
        ///   The "integrity-check" command causes SQLite to read and verify
        ///   the accuracy of all inverted indices in an FTS3/4 table by
        ///   comparing those inverted indices against the original content.
        /// </summary>
        /// <param name="database">The database to use.</param>
        /// <param name="type">The table to check.</param>
        public static int IntegrityCheck(this SqliteSessionBase database, Type type)
        {
            var map = database.GetMapping(type);

            return(database.Execute(String.Format(IntegrityCheckCommand, map.TableName)));
        }
Exemple #2
0
        /// <summary>
        ///   The "rebuild" command causes SQLite to discard the entire FTS3/4
        ///   table and then rebuild it again from original text.
        ///   The concept is similar to REINDEX.
        /// </summary>
        /// <param name="database">The database to use.</param>
        /// <param name="type">The table to rebuild.</param>
        public static int Rebuild(this SqliteSessionBase database, Type type)
        {
            var map = database.GetMapping(type);

            return(database.Execute(String.Format(RebuildCommand, map.TableName)));
        }
Exemple #3
0
        /// <summary>
        ///   The "merge=X,Y" command (where X and Y are integers) causes
        ///   SQLite to do a limited amount of work toward merging the various
        ///   inverted index b-trees of an FTS3/4 table together into one large
        ///   b-tree.
        /// </summary>
        /// <param name="database">The database to use.</param>
        /// <param name="type">The table on which to perform the merge.</param>
        /// <param name="x">
        ///   The X value is the target number of "blocks" to be merged.
        ///   The value of X can be any positive integer but values on the
        ///   order of 100 to 300 are recommended.
        /// </param>
        /// <param name="y">
        ///   The Y is the minimum number of b-tree segments on a level
        ///   required before merging will be applied to that level.
        ///   The value of Y should be between 2 and 16 with a recommended
        ///   value of 8.
        /// </param>
        public static int Merge(this SqliteSessionBase database, Type type, int x = 100, int y = 8)
        {
            var map = database.GetMapping(type);

            return(database.Execute(String.Format(MergeXyCommand, map.TableName, x, y)));
        }
Exemple #4
0
        /// <summary>
        ///   The "automerge=B" command disables or enables automatic
        ///   incremental inverted index merging for an FTS3/4 table.
        ///   Enabling automatic incremental merge causes SQLite to do a small
        ///   amount of inverted index merging after every INSERT operation to
        ///   prevent spiky INSERT performance.
        /// </summary>
        /// <param name="database">The database to use.</param>
        /// <param name="type">
        ///   The table on which to enable/disable the merges.
        ///  </param>
        /// <param name="enable">
        ///   True to enable automatic incremental inverted index. False to
        ///   disable.
        /// </param>
        public static int AutoMerge(this SqliteSessionBase database, Type type, bool enable = false)
        {
            var map = database.GetMapping(type);

            return(database.Execute(String.Format(AutoMergeCommand, map.TableName, enable ? 1 : 0)));
        }
Exemple #5
0
 public TableQuery(SqliteSessionBase session)
     : this(session, session.GetMapping <T>())
 {
 }