'Declaration Public MustInherit Class SQLiteCollationFunction Inherits SQLiteFunction Implements System.IDisposable
public abstract class SQLiteCollationFunction : SQLiteFunction, System.IDisposable
'Declaration Public MustInherit Class SQLiteCollationFunction Inherits SQLiteFunction Implements System.IDisposable
public abstract class SQLiteCollationFunction : SQLiteFunction, System.IDisposable
Use this class to derive classes for user-defined collation functions from it.
Collation functions are used for sorting. You should implement the comparison operation for it.
To register the user-defined collation funtion, create the class, derived from SQLiteCollationFunction and pass its name to the base class constructor.
You should also override Compare method. This method should implement the comparison operation.
public class MyCollation : SQLiteCollationFunction { public MyCollation() : base("StringCollation") { } protected override int Compare(string param1, string param2, SQLiteConnection connection) { return string.Compare(param1, param2); } } ... SQLiteConnection sqLiteConnection = new SQLiteConnection(@"Data Source=D:\SQLite\test.db"); sqLiteConnection.Open(); MyCollation collation = new MyCollation(); sqLiteConnection.RegisterFunction(collation); SQLiteCommand command = new SQLiteCommand("select * from Dept order by DName collate StringCollation", sqLiteConnection); using (SQLiteDataReader rd = command.ExecuteReader()) { while (rd.Read()) { long deptno = rd.GetInt64(0); string dname = rd.GetString(1); string loc = rd.GetString(2); } } sqLiteConnection.UnRegisterFunction(collation); sqLiteConnection.Close();
System.Object
Devart.Data.SQLite.SQLiteFunction
Devart.Data.SQLite.SQLiteCollationFunction