| 1 | package Eve::PgSqlType::IntegerArray; | ||
| 2 | |||
| 3 | 1 | ▶ | use parent qw(Eve::PgSqlType::Array); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use DBD::Pg (); | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | B<Eve::PgSqlType::IntegerArray> - a PostgreSQL integer array type. | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | my $array = Eve::PgSqlType::IntegerArray->new(); | ||
| 17 | my $text = $array->serialize(value => $some_array); | ||
| 18 | my $array_ref = $bigint->deserialize(value => $some_result); | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | B<Eve::PgSqlType::Array> is a PostgreSQL integer array type adapter class. | ||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | =head2 B<get_type()> | ||
| 27 | |||
| 28 | =head3 Returns | ||
| 29 | |||
| 30 | The PG_INT4ARRAY type. | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | sub get_type { | ||
| 35 | return DBD::Pg::PG_INT4ARRAY; | ||
| 36 | } | ||
| 37 | |||
| 38 | =head2 B<wrap()> | ||
| 39 | |||
| 40 | Wraps an expression with CAST statement. | ||
| 41 | |||
| 42 | =head3 Arguments | ||
| 43 | |||
| 44 | =over 4 | ||
| 45 | |||
| 46 | =item C<expression> | ||
| 47 | |||
| 48 | =back | ||
| 49 | |||
| 50 | =head3 Returns | ||
| 51 | |||
| 52 | CAST (C<expression> AS array) | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | sub wrap { | ||
| 57 | my ($self, %arg_hash) = @_; | ||
| 58 | Eve::Support::arguments(\%arg_hash, my $expression); | ||
| 59 | |||
| 60 | return 'CAST ('.$expression.' AS integer[])'; | ||
| 61 | } | ||
| 62 | |||
| 63 | =head1 SEE ALSO | ||
| 64 | |||
| 65 | =over 4 | ||
| 66 | |||
| 67 | =item L<DBD::Pg> | ||
| 68 | |||
| 69 | =item L<Eve::PgSqlType> | ||
| 70 | |||
| 71 | =back | ||
| 72 | |||
| 73 | =head1 LICENSE AND COPYRIGHT | ||
| 74 | |||
| 75 | Copyright 2012 Igor Zinovyev. | ||
| 76 | |||
| 77 | This program is free software; you can redistribute it and/or modify it | ||
| 78 | under the terms of either: the GNU General Public License as published | ||
| 79 | by the Free Software Foundation; or the Artistic License. | ||
| 80 | |||
| 81 | See http://dev.perl.org/licenses/ for more information. | ||
| 82 | |||
| 83 | |||
| 84 | =head1 AUTHOR | ||
| 85 | |||
| 86 | =over 4 | ||
| 87 | |||
| 88 | =item L<Igor Zinovyev|mailto:zinigor@gmail.com> | ||
| 89 | |||
| 90 | =back | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 1; | ||