Name

makedbsafe — try to make the returned string safe for use in the database

Synopsis

use Wacs;
scalar makedbsafe(...); 
 

Parameters

parameterdescription
stringthe string of text to be considered
allowcharacters to allow which are not normally acceptable: at present only forward slash (/) is recognised
denycharacters to deny which are normally acceptable: at present any space character (space, tab, newline) given here will cause any whitespace characters to be stripped out.

Summary

The makedbsafe function is designed to remove characters which are unsuitable for feeding to the database. It normally works with a default set of rules, which implicitly disallows forward slash (but this can be explicity allowed with allow=>'/'). Similarly white space can be removed from a file name when required using the deny option. It will also remove harmfull characters that are not legal in any reasonable database - the single quote mark ' will be automatically replaced by the back quote ` and greater than (>) and less than (<) will be stripped out.

Availability

makedbsafe is available in both php and perl. This function was added in Wacs 0.8.1.