0

Is it possible to register a Sqlite function in an application and trigger it from another application?

Example:

  • I create a trigger which calls MyFunction() after an update
  • Application A uses SQLiteFunction.Register to register the function called MyFunction
  • Application B makes an update which fires the trigger

When application B makes the update, I receive an error like "Function MyFunction is not defined". Is there a way to register the function with a "global" scope?

PS: The final purpose is that of simulating events across applications using triggers

Thank you

1 Answer 1

1

If you're just trying to pass event notifications between multiple applications, SQLite -- or for that matter, any database table -- is the wrong tool for the job.

If the operation is somewhat asynchronous then you might want to use a named EventWaitHandle to notify the other process that you've done something it should be interested in, or if there's data involved, stuff the notification and its data in a MessageQueue for the other application to pick up.

Otherwise, you should use a real inter-process communication mechanism like sockets, named pipes, Remoting, WCF, etc.

Sign up to request clarification or add additional context in comments.

2 Comments

@fra: A MessageQueue is exactly what you need, then. They can be made persistent so that even if an app goes down nothing is lost; they can also be enlisted into a transaction if that is relevant.
Thank you. We already have a sort of "message dispatcher", anyway I'm afraid that the dispatcher application could crash, losing all events. That's why I would like to make applications "stateless" using sqlite and saving events on the database; then, we could periodically query the database and check if we lost any events. The problem is that these applications run on a remote system, so I need many controlling mechanisms. The Sqlite-trigger solution is more an "academic" solution to understand Sqlite possibilities, it is not really planned to use it on the final system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.