pricecharts

track prices of consumer electronics
Log | Files | Refs | README

commit c9723551efa4099bfdc26685bc2ea26791c5b26d
parent 5cfb7d471001264e573e86cbd8027e9c5e2043d9
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Mon,  4 May 2015 23:44:25 -0600

pc_html: prepare the description statement handle

Diffstat:
Mpc_html | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pc_html b/pc_html @@ -36,6 +36,9 @@ my $where_stale = $args{a} ? "" : "where svg_stale = 1"; my $part_equality = qq{prices.manufacturer = products.manufacturer and prices.part_num = products.part_num}; +my $desc_sth = $dbh->prepare(qq{select description from descriptions where + manufacturer = ? and part_num = ? order by date}); + # catmull-rom to cubic bezier conversion matrix my $catrom_to_bezier = Math::MatrixReal->new_from_rows([[0, 1, 0, 0], [-1/6, 1, 1/6, 0], @@ -268,9 +271,7 @@ sub get_description my $manufacturer = shift; my $part_num = shift; - my $sql = "select description from descriptions where " . - "manufacturer = ? and part_num = ? order by date"; - my $descriptions = $dbh->selectcol_arrayref($sql, undef, $manufacturer, + my $descriptions = $dbh->selectcol_arrayref($desc_sth, undef, $manufacturer, $part_num); unless (@$descriptions) { print "error: no descriptions for $manufacturer $part_num\n";