use DBI;
use Scalar::Util qw/reftype/;
+use Date::Calc qw/Add_Delta_YM/;
use Term::ReadLine;
use Getopt::Long;
return () unless exists $answers->{category} && length $answers->{category};
- my $sql = sprintf("SELECT DISTINCT description FROM %s WHERE category = '%s' AND description LIKE '%s%%' ORDER BY description",
+ my @now = localtime();
+ my ($year,$month,$day) = Add_Delta_YM($now[5]+1900, $now[4]+1, $now[3], -3, 0);
+
+ my $sql = sprintf("SELECT DISTINCT description FROM %s WHERE category = '%s' AND date > '%04d%02d%02d' AND description LIKE '%s%%' ORDER BY description",
$table,
$answers->{category},
+ $year,$month,$day,
$line);
my $sth = $dbh->prepare($sql);
$sth->execute;