Search Postgresql Archives

Re: Sending several commands simultaneously to PostgreSQL 8.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 $@;
}


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux