using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;

namespace RMtrix
{
 
/*    [SQLiteFunction(FuncType=FunctionType.Collation, Name="RMNOCASE")]
    public class RmNocase : SQLiteFunction
    {
        public override int Compare(string param1, string param2)
        {
            return String.Compare(param1, param2, StringComparison.InvariantCultureIgnoreCase);
        }
    }
*/
 
    [SQLiteFunction(FuncType = FunctionType.Scalar, Name = "FileExists")]
    public class FileExists : SQLiteFunction
    {
        public override object Invoke(object[] args)
        {
            return System.IO.File.Exists(Convert.ToString(args[0]));
        }
    }

    [SQLiteFunction(Name = "REGEXP", Arguments = 2, FuncType = FunctionType.Scalar)]
    public class MyRegEx : SQLiteFunction
    {
        public override object Invoke(object[] args)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args[1]), Convert.ToString(args[0]));
        }
    }
}
