Lines 55-71
subtest 'prep_report' => sub {
Link Here
|
55 |
report_name => 'report_name_for_test_1', |
55 |
report_name => 'report_name_for_test_1', |
56 |
savedsql => 'SELECT * FROM items WHERE itemnumber IN <<Test|list>>', |
56 |
savedsql => 'SELECT * FROM items WHERE itemnumber IN <<Test|list>>', |
57 |
})->store; |
57 |
})->store; |
|
|
58 |
my $id = $report->id; |
58 |
|
59 |
|
59 |
my ($sql, undef) = $report->prep_report( ['Test|list'],["1\n12\n\r243"] ); |
60 |
my ($sql, undef) = $report->prep_report( ['Test|list'],["1\n12\n\r243"] ); |
60 |
is( $sql, q{SELECT * FROM items WHERE itemnumber IN ('1','12','243')},'Expected sql generated correctly with single param and name'); |
61 |
is( $sql, qq{SELECT * FROM items WHERE itemnumber IN ('1','12','243') /* saved_sql.id: $id */},'Expected sql generated correctly with single param and name'); |
61 |
|
62 |
|
62 |
$report->savedsql('SELECT * FROM items WHERE itemnumber IN <<Test|list>> AND <<Another>> AND <<Test|list>>')->store; |
63 |
$report->savedsql('SELECT * FROM items WHERE itemnumber IN <<Test|list>> AND <<Another>> AND <<Test|list>>')->store; |
63 |
|
64 |
|
64 |
($sql, undef) = $report->prep_report( ['Test|list','Another'],["1\n12\n\r243",'the other'] ); |
65 |
($sql, undef) = $report->prep_report( ['Test|list','Another'],["1\n12\n\r243",'the other'] ); |
65 |
is( $sql, q{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('1','12','243')},'Expected sql generated correctly with multiple params and names'); |
66 |
is( $sql, qq{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('1','12','243') /* saved_sql.id: $id */},'Expected sql generated correctly with multiple params and names'); |
66 |
|
67 |
|
67 |
($sql, undef) = $report->prep_report( [],["1\n12\n\r243",'the other',"42\n32\n22\n12"] ); |
68 |
($sql, undef) = $report->prep_report( [],["1\n12\n\r243",'the other',"42\n32\n22\n12"] ); |
68 |
is( $sql, q{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('42','32','22','12')},'Expected sql generated correctly with multiple params and no names'); |
69 |
is( $sql, qq{SELECT * FROM items WHERE itemnumber IN ('1','12','243') AND 'the other' AND ('42','32','22','12') /* saved_sql.id: $id */},'Expected sql generated correctly with multiple params and no names'); |
69 |
|
70 |
|
70 |
}; |
71 |
}; |
71 |
|
72 |
|
72 |
- |
|
|