# Copyright 2005-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: dbi_quote.filter,v 1.3 2007-03-30 23:40:44 pajamian Exp $

CodeDef dbi_quote Filter
CodeDef dbi_quote Description SQL quoting using DBI
CodeDef dbi_quote Routine <<EOR
sub {
	my ($val, $tag, $table) = @_;

	$table ||= $Vend::Cfg->{ProductFiles}[0];

	my $db;
	unless ($db = dbref($table)) {
		::logError("filter dbi_quote cannot find database handle for table '%s'", $table);
		return;
	}

	return $db->quote($val);
}
EOR
