Re: Query execution in Perl TAP tests needs work
От | Thomas Munro |
---|---|
Тема | Re: Query execution in Perl TAP tests needs work |
Дата | |
Msg-id | CA+hUKGKz715tkYFmS12fxqxWG1o9=8y3TTo2uYdGLO=EPm=BUw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Query execution in Perl TAP tests needs work (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: Query execution in Perl TAP tests needs work
|
Список | pgsql-hackers |
On Thu, Aug 31, 2023 at 10:32 AM Andrew Dunstan <andrew@dunslane.net> wrote: > #!/usr/bin/perl > > use strict; use warnings; > > use FFI::Platypus; > > my $ffi = FFI::Platypus->new(api=>1); > $ffi->lib("inst/lib/libpq.so"); > > > $ffi->type('opaque' => 'PGconn'); > $ffi->attach(PQconnectdb => [ 'string' ] => 'PGconn'); > $ffi->attach(PQfinish => [ 'PGconn' ] => 'void'); > > $ffi->type('opaque' => 'PGresult'); > $ffi->attach(PQexec => [ 'PGconn', 'string' ] => 'PGresult'); > $ffi->attach(PQgetvalue => [ 'PGresult', 'int', 'int' ] => 'string'); > > my $pgconn = PQconnectdb("dbname=postgres host=/tmp"); > my $res = PQexec($pgconn, "select count(*) from pg_class"); > my $count = PQgetvalue( $res, 0, 0); > > print "count: $count\n"; > > PQfinish($pgconn); It looks very promising so far. How hard would it be for us to add this dependency? Mostly pinging build farm owners? I'm still on the fence, but the more I know about IPC::Run, the better the various let's-connect-directly-from-Perl options sound...
В списке pgsql-hackers по дате отправления: