4

is it possible to create a trigger in SQLite that when it fires it calls a bash script? MSSQL supports calling exe programs when a trigger is activated.

Thanks for any information.

1 Answer 1

2

Regarding the standard triggers of SQLite the answer is no. There is no built-in mechanism to call external programs from a trigger.

But if you are ready in invest time on research and coding the answer is yes. You can modify the C source code (it is in public domain) and add a feature to call the external program. Or you can use the API provided like sqlite3_create_function() or sqlite3_update_hook() to run your program whenever an event occurs.

Most SQLite language extensions (at least Perl, Python, Ruby) allow you to use the extension API from the language so there is no need to write C. However I haven't tested what happens if you present your own Perl/Python/Ruby function to SQLite, use it in defining a trigger and then disconnect from the database. The trigger definition remains but the function is lost?

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

Comments

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.