From: Gianni Ceccarelli Date: Thu, 26 Aug 2010 11:44:58 +0000 (+0100) Subject: documentation! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=87682fb9ff0df5b3ee49c0878f93c2d54949211b;p=dbsrgits%2FDBIx-Class.git documentation! --- diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 25e9049..ed8075e 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -240,7 +240,8 @@ sub deployment_statements { sub _populate_dbh { my ($self) = @_; - # cursors are per-connection, so reset the numbering + # cursors are per-connection, so we can reset the numbering + # without fear of collisions $self->_pg_cursor_number(1); return $self->SUPER::_populate_dbh(); } @@ -278,6 +279,7 @@ sub _get_pg_cursor_page_size { if (defined $self->cursor_page_size) { return $self->cursor_page_size; } + return 1000; } @@ -285,7 +287,8 @@ sub _select { my $self = shift; my ($ident, $select, $where, $attrs) = @_; - # ugly ugly ugly, but this is the last sub in the call chain that receives $attrs + # ugly ugly ugly, but this is the last sub in the call chain that + # receives $attrs local $self->{_use_pg_cursors}=$self->_should_use_pg_cursors($attrs); local $self->{_pg_cursor_page_size}=$self->_get_pg_cursor_page_size($attrs); @@ -295,6 +298,8 @@ sub _select { sub _dbh_sth { my ($self, $dbh, $sql) = @_; + # here we have to use the ugly local attributes because we no + # longer have access to the resultset attributes if ($self->{_use_pg_cursors} && $sql =~ /^SELECT\b/i) { return DBIx::Class::Storage::DBI::Pg::Sth ->new($self,$dbh,$sql,$self->{_pg_cursor_page_size}); diff --git a/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm b/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm index d8cb268..40522d8 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm @@ -7,13 +7,76 @@ __PACKAGE__->mk_group_accessors('simple' => 'storage', 'cursor_id', 'cursor_sql', 'cursor_created', - 'cursor_sth', 'fetch_sth', - 'page_size', + 'cursor_sth', + 'fetch_sql', 'fetch_sth', ); +=head1 NAME + +DBIx::Class::Storage::DBI::Pg::Sth + +=head1 DESCRIPTION + +A statement wrapper to use PostgreSQL cursors on DBIx::Class C