MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 8th, 2004, 10:12 AM
bah26 bah26 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 18 bah26 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 29 sec
Reputation Power: 0
MySQL & deleting files on filesystem (Triggers?)

I have a table containing the filenames of images on the filesystem, if the record is deleted I want to delete the associated file. How would I go about this? (is this possible with Triggers? although these are not available in MySQL until v5.1)

The alternative is to store the files in the db, thus eliminating the need to delete files on the filesystem


Cheers,
Ben

Reply With Quote
  #2  
Old July 8th, 2004, 10:48 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
How're you deleting records? If through a custom web app, just add some code to delete files upon row deletion. Another option is to set up a cron job that periodically compares the file system to the files listed in the database and deletes any that aren't found in the db. I don't know that a trigger would work here. I'm not very familiar with triggers, but I would have thought they'd allow you to perform other database operations automatically (but not filesystem operations).
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old July 9th, 2004, 06:23 AM
bah26 bah26 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 18 bah26 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 29 sec
Reputation Power: 0
Quote:
Originally Posted by dhouston
How're you deleting records? If through a custom web app, just add some code to delete files upon row deletion.

I'm deleting records via a foreign key constraint - hence the web app doesn't know deleting a single record will result in a cascade.

Thus I cannot simply add code to the web app to handle the deletion of files.


Ben

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > MySQL & deleting files on filesystem (Triggers?)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT