SQLite UDFs : Adding Sqrt and CToF functions

According to the list of core functions in SQLite, there is no native support for the most mathematics functions (sqrt, log, etc). Furthermore, user may need non-standard functions for his own task (e.g. conversion Celsius to Fahrenheit). This issue can be resolved with user-defined functions (UDFs).

Support for UDFs is added to dotConnect for SQLite starting with the 2.50 version. UDF provides a mechanism for extending the functionality of the SQLite engine by adding a function that can be evaluated in the SQL statements of SQLiteCommand. For more information, please refer to our documentation to the SQLiteAggregateFunction, SQLiteCollationFunction, SQLiteScalarFunction classes (there are samples of using them). Full support for user-defined functions and collating sequences means that in many cases if SQLite doesn’t have a feature, you can write it yourself in your favorite .NET language. Writing UDF’s and collating sequences has never been easier.

Examples

  1. Here is an example of creating and using of the function, that calculates the square root.
    And using it
  2. This sample implements scalar function that makes the “Celsius to Fahrenheit” conversion.
    Using the function:

One Response to “SQLite UDFs : Adding Sqrt and CToF functions”

  1. carlos alberto Says:

    oiiiiiiiiiii galeráaaa eu tenhooo um tibiaaa tô jogandooo viu tdu blz tchau.