| 1 | package Eve::PgSqlType::DoubleArray; | ||
| 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::DoubleArray> - a PostgreSQL double precision array type. | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | my $array = Eve::PgSqlType::DoubleArray->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::DoubleArray> is a PostgreSQL double precision | ||
| 23 | number array type adapter class. | ||
| 24 | |||
| 25 | =head1 METHODS | ||
| 26 | |||
| 27 | =head2 B<get_type()> | ||
| 28 | |||
| 29 | =head3 Returns | ||
| 30 | |||
| 31 | The PG_FLOAT8ARRAY type. | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | sub get_type { | ||
| 36 | return DBD::Pg::PG_FLOAT8ARRAY; | ||
| 37 | } | ||
| 38 | |||
| 39 | =head2 B<wrap()> | ||
| 40 | |||
| 41 | Wraps an expression with CAST statement. | ||
| 42 | |||
| 43 | =head3 Arguments | ||
| 44 | |||
| 45 | =over 4 | ||
| 46 | |||
| 47 | =item C<expression> | ||
| 48 | |||
| 49 | =back | ||
| 50 | |||
| 51 | =head3 Returns | ||
| 52 | |||
| 53 | CAST (C<expression> AS double precision[]) | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | sub wrap { | ||
| 58 | my ($self, %arg_hash) = @_; | ||
| 59 | Eve::Support::arguments(\%arg_hash, my $expression); | ||
| 60 | |||
| 61 | return 'CAST ('.$expression.' AS double precision[])'; | ||
| 62 | } | ||
| 63 | |||
| 64 | =head1 SEE ALSO | ||
| 65 | |||
| 66 | =over 4 | ||
| 67 | |||
| 68 | =item L<DBD::Pg> | ||
| 69 | |||
| 70 | =item L<Eve::PgSqlType::Array> | ||
| 71 | |||
| 72 | =back | ||
| 73 | |||
| 74 | =head1 LICENSE AND COPYRIGHT | ||
| 75 | |||
| 76 | Copyright 2012 Igor Zinovyev. | ||
| 77 | |||
| 78 | This program is free software; you can redistribute it and/or modify it | ||
| 79 | under the terms of either: the GNU General Public License as published | ||
| 80 | by the Free Software Foundation; or the Artistic License. | ||
| 81 | |||
| 82 | See http://dev.perl.org/licenses/ for more information. | ||
| 83 | |||
| 84 | |||
| 85 | =head1 AUTHOR | ||
| 86 | |||
| 87 | =over 4 | ||
| 88 | |||
| 89 | =item L<Igor Zinovyev|mailto:zinigor@gmail.com> | ||
| 90 | |||
| 91 | =back | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | 1; | ||