[Dbix-class] Bind parameters in select list and group by on Pg

Websuche :: Felix Antonius Wilhelm Ostmann ostmann at websuche.de
Fri Oct 28 15:13:17 GMT 2011


Am 28.10.2011 16:38, schrieb Peter Rabbitson:
> On Fri, Oct 28, 2011 at 07:22:25AM -0700, dorian taylor wrote:
>> On Fri, Oct 28, 2011 at 6:47 AM, Peter Rabbitson <rabbit+dbic at rabbit.us> wrote:
>>
>>> Perhaps this:
>>
>> Yes. Setting pg_server_prepare to 0 makes it work. Now the question is
>> how to get that into DBIx::Class?
>>
> 
> Currently there is no clean way to do it on per-query basis. THere is a
> plan and everything, but I got sidetracked with too much other bullshit.
> 
> In the meantime:
> 
> {
>     local $schema->storage->dbh->{pg_server_prepare} = 0;
>     <do stuff>
> }

we use following construct to work with this:


my @ids = $rs->result_source->storage->dbh_do(sub {
    my ($storage, $dbh, $self) = @_;
    local $dbh->{pg_server_prepare} = 0;
    return $self->search(...)->get_column('id')->all;
});

there is a problem with dbic-reconnect behavior, when you only set local
$schema->storage->dbh->{pg_server_prepare} = 0; before the query. When
the query failed, a "hidden" reconnect is made and your change is gone ...

> 
> 
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
> 


-- 
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
-----------------------------------------------------------
Websuche Search Technology GmbH & Co. KG
Martinistraße 3, D-49080 Osnabrück
-----------------------------------------------------------
Tel.: +49 (0) 541 40666 0, Fax: +49 (0) 541 40666 22
Email: info at websuche.de, Web: www.websuche.de
-----------------------------------------------------------
HRA 200252, AG Osnabrück, Ust-IdNr.: DE814737310
-----------------------------------------------------------
Komplementärin: Websuche Search Technology Verwaltungs GmbH
HRB 200359, AG Osnabrück, Geschäftsführer: Ansas Meyer
-----------------------------------------------------------

Die in dieser Email enthaltenen Informationen sind vertrau-
lich zu behandeln und ausschließlich für den Adressaten be-
stimmt. Jegliche Veröffentlichung, Verteilung oder sonstige
in diesem Zusammenhang stehende Handlung  wird ausdrücklich
untersagt.



More information about the DBIx-Class mailing list