diff options
author | matthew <matthew> | 2008-10-09 14:20:53 +0000 |
---|---|---|
committer | matthew <matthew> | 2008-10-09 14:20:53 +0000 |
commit | 60dc3b2ddad999f628b777be27ee41100eb883c3 (patch) | |
tree | a0346d3e2b1488bcd547840dd3f86533aaf6a004 /perllib/Utils.pm | |
parent | 75e9477815a8966b1ede2e4e5498575217d5ab27 (diff) |
Switch flickr state to partial, tidy up code, so soon other things can use it too.
Few text tweaks also, and other bits and bobs.
Diffstat (limited to 'perllib/Utils.pm')
-rw-r--r-- | perllib/Utils.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/perllib/Utils.pm b/perllib/Utils.pm new file mode 100644 index 000000000..24f4a6f94 --- /dev/null +++ b/perllib/Utils.pm @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# +# Utils.pm: +# Various generic utilities for FixMyStreet. +# +# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: Utils.pm,v 1.1 2008-10-09 14:20:54 matthew Exp $ +# + +package Utils; + +use strict; +use mySociety::DBHandle qw(dbh); + +sub workaround_pg_bytea { + my ($st, $img_idx, @elements) = @_; + my $s = dbh()->prepare($st); + for (my $i=1; $i<=@elements; $i++) { + if ($i == $img_idx) { + $s->bind_param($i, $elements[$i-1], { pg_type => DBD::Pg::PG_BYTEA }); + } else { + $s->bind_param($i, $elements[$i-1]); + } + } + $s->execute(); +} + +1; |