diff options
Diffstat (limited to 'FS/FS/Record.pm')
-rw-r--r-- | FS/FS/Record.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 9e1c0e8..11afd9f 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -55,14 +55,13 @@ FS::UID->install_callback( sub { $conf_encryption = $conf->exists('encryption'); $File::CounterFile::DEFAULT_DIR = $conf->base_dir . "/counters.". datasrc; if ( driver_name eq 'Pg' ) { - eval "use DBD::Pg qw(:pg_types);"; + eval "use DBD::Pg ':pg_types'"; die $@ if $@; } else { eval "sub PG_BYTEA { die 'guru meditation #9: calling PG_BYTEA when not running Pg?'; }"; } } ); - =head1 NAME FS::Record - Database record objects @@ -2718,7 +2717,10 @@ sub _quote { ) { no strict 'subs'; - dbh->quote($value, PG_BYTEA); +# dbh->quote($value, { pg_type => PG_BYTEA() }); # doesn't work right + # Pg binary string quoting: convert each character to 3-digit octal prefixed with \\, + # single-quote the whole mess, and put an "E" in front. + return ("E'" . join('', map { sprintf('\\\\%03o', ord($_)) } split(//, $value) ) . "'"); } else { dbh->quote($value); } |