Re: Sending several commands simultaneously to PostgreSQL 8.4 - Mailing list pgsql-general

From Alexander Farber
Subject Re: Sending several commands simultaneously to PostgreSQL 8.4
Date
Msg-id CAADeyWj4BCtmoQVz1o0VD2JSG-BEdzFZrMFp1qmnY-btOz0UfA@mail.gmail.com
Whole thread Raw
In response to Re: Sending several commands simultaneously to PostgreSQL 8.4  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
I've ended up calling this procedure
in the loop before poll() - to run queued
commands from an array of hashes:

sub execSql {
        eval {
                my $dbh = DBI->connect_cached(DSN, DBUSER, DBPASS, {
                    private_key => __FILE__,
                    AutoCommit => 1,
                    PrintWarn => 1,
                    PrintError => 1,
                    RaiseError => 1,
                    FetchHashKeyName => 'NAME_lc',
                    pg_enable_utf8 => 1
                });

                if ($WaitSql && $dbh->pg_ready) {
                        $WaitSql = 0;
                        $dbh->pg_result();
                }

                if (!$WaitSql && @Sqls) {
                        $WaitSql = 1;
                        my $sql  = shift @Sqls;
                        my $cmd  = $sql->{CMD};
                        my $args = $sql->{ARGS};
                        my $sth  = $dbh->prepare_cached($cmd,
                            { pg_async => PG_ASYNC + PG_OLDQUERY_WAIT });
                        $sth->execute(@$args);
                }
        };
        warn $@ if $@;
}


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: seeking SQL book recommendation
Next
From: Thomas Kellerer
Date:
Subject: Re: seeking SQL book recommendation