New set of routines for HEAD.
[koha.git] / C4 / UTF8DBI.pm
1 # UTF8DBI.pm re-implementation by Pavel Kudinov http://search.cpan.org/~kudinov/
2 # originally from: http://dysphoria.net/code/perl-utf8/
3
4 package UTF8DBI    ; use base DBI    ;
5 package UTF8DBI::db; use base DBI::db;
6 package UTF8DBI::st; use base DBI::st;
7
8 sub _utf8_() {
9         use Encode;
10         if    (ref $_ eq 'ARRAY'){ _utf8_() foreach        @$_  }
11         elsif (ref $_ eq 'HASH' ){ _utf8_() foreach values %$_  }
12         else                     {         Encode::_utf8_on($_) };
13         $_;
14 };
15
16 sub fetch             { return _utf8_ for shift->SUPER::fetch            (@_)  };
17 sub fetchrow_arrayref { return _utf8_ for shift->SUPER::fetchrow_arrayref(@_)  };
18 sub fetchrow_hashref  { return _utf8_ for shift->SUPER::fetchrow_hashref (@_)  };
19 sub fetchall_arrayref { return _utf8_ for shift->SUPER::fetchall_arrayref(@_)  };
20 sub fetchall_hashref  { return _utf8_ for shift->SUPER::fetchall_hashref (@_)  };
21 sub fetchcol_arrayref { return _utf8_ for shift->SUPER::fetchcol_arrayref(@_)  };
22
23 sub fetchrow_array    {                 @{shift->       fetchrow_arrayref(@_)} };
24
25 1;