in reply to Re^2: Module and variable place holders?
in thread Module and variable place holders?
You would need some code, at any rate. Personally, I solved that part of the problem by keeping an array of bind parameters, and then bits of SQL that form that part of the WHERE clause. I would assume the same theory would hold with insert and update.
sub options_sql_filter { my($self, $request) = @_; my @options = $self->options; my @sql_bits; my @bind_params; foreach my $option (@options){ my($sql_bit, @bind_param) = $option->sql_filter($request); push @sql_bits, $sql_bit; push @bind_params, @bind_param; } return (join ' AND ', @sql_bits), @bind_params; }
sql_filter here returns a list that looks like ('foo = ?', 'bar')
This lets you piece together SQL that uses bind parameters but is generated dynamically.
|
|---|