SQLite 트리거를 만들어 C#에서 함수를 호출하려고합니다. 이 함수는 테이블의 열 중 하나를 업데이트 한 후에 호출해야합니다. 함수가 정의되고사용자 정의 함수를 사용하는 SQLite 트리거
다음 :
public class TestingFunction<T1> : SQLiteScalarFunction<T1, string>
{
public TestingFunction() : base("testing") { }
protected override string Execute(T1 arg1, SQLiteConnection connection)
{
//.. do some work
}
}
등록 :
SQLiteConnection sqLiteConnection = new SQLiteConnection(@"Data Source=" + settings.db_source);
sqLiteConnection.Open();
TestingFunction<string> function = new TestingFunction<string>();
sqLiteConnection.RegisterFunction(function);
트리거 :
create trigger trigger1 update of act_cost on tunnels
begin
select testing(db_source);
end;
테이블을 업데이트 할 때 SQLite 오류가 발생합니다 : no such function: testing.
문제점에 대한 제안 사항이 있습니까?
트리거를 트리거하는 UPDATE를 어떤 연결에서 호출하고 있습니까? –
당신은 완전히 맞습니다. 나는 업데이트를위한 새로운 연결을 만들고있었습니다. 이제 마침내 성공합니다. 감사! – Ivana