MySQL Forums
Forum List  »  Newbie

Re: User passed variables in sql scripts
Posted by: Chris Stubben
Date: March 28, 2005 11:31PM

Hi,

You probably should use a DBI script to be safe and check input variables, make sure the user can only delete their own data etc. A short shell script would also work, but use it at your own risk. Save it as erase.sh, make it executable (chmod +x erase.sh) and then run it.

Chris

---
#! /bin/sh

echo 'Erase data longer than: (months)'
read erase
mysql -h host_name -u delete_user -e "DELETE FROM DATA WHERE TIME < DATE_SUB(CURDATE(),INTERVAL $erase MONTH)" db_name

Options: ReplyQuote


Subject
Written By
Posted
Re: User passed variables in sql scripts
March 28, 2005 11:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.