Mark Nienberg wrote:

I'm using Bacula to back up a Linux Samba fileserver among other machines. Of course the clients to the fileserver are windows machines and they don't care about case in filenames. They create all sorts of case combinations like "document1.doc", "Document2.DOC" and so on.

My most common restore scenario is when someone deletes or corrupts a file and asks me to restore a previous version of it. The easiest way to do this in the console is (I think) to use the query command option 2 "List Jobs where a given File is saved", and then pick an appropriate jobID to restore from based on date of backup.

The problem is that the search for the filename is case sensitive (the MySQL field is type "binary") so it is hard to guess what filename to enter. I wonder if I could use option 4 "Enter SQL list command" to do a case-insensitive search. Any suggestions on what this SQL command would look like for MySQL? Or is there a better way to do this?

Add this query to your  query.sql file:

# 18 - case insensitive version of query #2
:List up to 20 places where a File is saved regardless of the directory (case insensitive):
*Enter Filename (no path):
SELECT DISTINCT Job.JobId as JobId, Client.Name as Client,
 Path.Path,Filename.Name,StartTime,Level,JobFiles,JobBytes
FROM Client,Job,File,Filename,Path WHERE Client.ClientId=Job.ClientId
AND JobStatus='T' AND Job.JobId=File.JobId
AND Path.PathId=File.PathId AND Filename.FilenameId=File.FilenameId
AND convert(Filename.Name USING latin1)='%1'
ORDER BY Job.StartTime LIMIT 20;

Now, instead of picking query #2, pick query #18 (or whatever is the last one on the list). It works exactly like query #2, but it's case insensitive. I suspect you'll need at least mysql 4.0 or better for this to work, and it's rather slow, but it should do the trick.

- Cedric



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to