blob: 24f4a6f9471566e0fe524d89b83a3fe71aeb00e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
|