0

Is it possible to delete a file from the filesystem in a SQL trigger in SQLite?

I have a table which contains the path to a file. Is it possible to create a trigger that starts when a deletion occurs and that deletes the file whose path is the one contained in the deleted row? How can I do this?

Thanks!

Luca Carlon
  • 9,546
  • 13
  • 59
  • 91

1 Answers1

1

You can try to create a user-defined function that will take care of deleting the file and call it from the trigger.

Here is an example: SQLiteFunction Simple Not Working

Community
  • 1
  • 1
Johann Blais
  • 9,389
  • 6
  • 45
  • 65
  • I'm programming in C++, so following your answer I was able to refine my search and found this: http://blog.renanfernandes.com.br/2010/09/criando-user-defined-functions-do-sqlite3-no-qt/. Works great! Thanks for your help! – Luca Carlon May 24 '11 at 16:09