1.7.3
This commit is contained in:
parent
1957f2402c
commit
11c091272a
@ -1,5 +1,16 @@
|
|||||||
Revision history for Perl extension Pg.
|
Revision history for Perl extension Pg.
|
||||||
|
|
||||||
|
1.7.3 Mar 28 1998
|
||||||
|
- linking again with the shared version of libpq
|
||||||
|
due to problems on several operating systems.
|
||||||
|
|
||||||
|
1.7.2 Mar 06 1998
|
||||||
|
- module is now linked with static libpq.a
|
||||||
|
|
||||||
|
1.7.1 Mar 03 1998
|
||||||
|
- expanded the search path for include files
|
||||||
|
- return to UNIX domain sockets in test-scripts
|
||||||
|
|
||||||
1.7.0 Feb 20 1998
|
1.7.0 Feb 20 1998
|
||||||
- adapted to PostgreSQL-6.3:
|
- adapted to PostgreSQL-6.3:
|
||||||
add host=localhost to the conninfo-string
|
add host=localhost to the conninfo-string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: Makefile.PL,v 1.6 1998/04/06 01:36:30 momjian Exp $
|
# $Id: Makefile.PL,v 1.7 1998/04/14 21:14:34 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -14,12 +14,28 @@ print "\nConfiguring Pg\n";
|
|||||||
print "Remember to actually read the README file !\n";
|
print "Remember to actually read the README file !\n";
|
||||||
die "\nYou didn't read the README file !\n" unless ($] >= 5.002);
|
die "\nYou didn't read the README file !\n" unless ($] >= 5.002);
|
||||||
|
|
||||||
|
if (! $ENV{POSTGRES_HOME}) {
|
||||||
|
warn "\$POSTGRES_HOME not defined. Searching for PostgreSQL...\n";
|
||||||
|
foreach(qw(/usr/local/pgsql /usr/pgsql /home/pgsql /opt/pgsql /usr/local/postgres /usr/postgres /home/postgres /opt/postgres)) {
|
||||||
|
if (-d "$_/lib") {
|
||||||
|
$ENV{POSTGRES_HOME} = $_;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-d "$ENV{POSTGRES_HOME}/lib") {
|
||||||
|
print "Found PostgreSQL in $ENV{POSTGRES_HOME}\n";
|
||||||
|
} else {
|
||||||
|
die "Unable to determine PostgreSQL\n";
|
||||||
|
}
|
||||||
|
|
||||||
my %opts = (
|
my %opts = (
|
||||||
NAME => 'Pg',
|
NAME => 'Pg',
|
||||||
VERSION_FROM => 'Pg.pm',
|
VERSION_FROM => 'Pg.pm',
|
||||||
INC => "-I../libpq -I../../include",
|
INC => "-I$ENV{POSTGRES_HOME}/include -I/usr/local/include/pgsql -I/usr/include/pgsql",
|
||||||
LIBS => ["-L../libpq -lpq"],
|
OBJECT => "Pg\$(OBJ_EXT)",
|
||||||
CC => 'gcc',
|
LIBS => ["-L$ENV{POSTGRES_HOME}/lib -lpq"],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: Pg.pm,v 1.5 1998/02/20 21:25:35 mergl Exp $
|
# $Id: Pg.pm,v 1.6 1998/04/14 21:14:35 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -84,7 +84,7 @@ require 5.002;
|
|||||||
PGRES_InvalidOid
|
PGRES_InvalidOid
|
||||||
);
|
);
|
||||||
|
|
||||||
$Pg::VERSION = '1.7.0';
|
$Pg::VERSION = '1.7.3';
|
||||||
|
|
||||||
sub AUTOLOAD {
|
sub AUTOLOAD {
|
||||||
# This AUTOLOAD is used to 'autoload' constants from the constant()
|
# This AUTOLOAD is used to 'autoload' constants from the constant()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------
|
/*-------------------------------------------------------
|
||||||
*
|
*
|
||||||
* $Id: Pg.xs,v 1.5 1998/02/20 21:25:36 mergl Exp $
|
* $Id: Pg.xs,v 1.6 1998/04/14 21:14:36 mergl Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1997 Edmund Mergl
|
* Copyright (c) 1997 Edmund Mergl
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: README,v 1.5 1998/02/20 21:25:42 mergl Exp $
|
# $Id: README,v 1.6 1998/04/14 21:14:37 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -9,7 +9,7 @@
|
|||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
------------
|
------------
|
||||||
|
|
||||||
This is version 1.7.0 of pgsql_perl5 (previously called pg95perl5).
|
This is version 1.7.3 of pgsql_perl5 (previously called pg95perl5).
|
||||||
|
|
||||||
Pgsql_perl5 is an interface between Larry Wall's language perl version 5 and
|
Pgsql_perl5 is an interface between Larry Wall's language perl version 5 and
|
||||||
the database PostgreSQL (previously Postgres95). This has been done by using
|
the database PostgreSQL (previously Postgres95). This has been done by using
|
||||||
@ -127,6 +127,6 @@ installation to read the documentation.
|
|||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Edmund Mergl <E.Mergl@bawue.de> February 20, 1998
|
Edmund Mergl <E.Mergl@bawue.de> March 28, 1998
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: example.newstyle,v 1.3 1998/02/20 21:26:06 mergl Exp $
|
# $Id: example.newstyle,v 1.4 1998/04/14 21:14:50 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
######################### We start with some black magic to print on failure.
|
######################### We start with some black magic to print on failure.
|
||||||
|
|
||||||
BEGIN { $| = 1; print "1..57\n"; }
|
BEGIN { $| = 1; print "1..56\n"; }
|
||||||
END {print "not ok 1\n" unless $loaded;}
|
END {print "not ok 1\n" unless $loaded;}
|
||||||
use Pg;
|
use Pg;
|
||||||
$loaded = 1;
|
$loaded = 1;
|
||||||
@ -23,7 +23,6 @@ print "ok 1\n";
|
|||||||
|
|
||||||
$dbmain = 'template1';
|
$dbmain = 'template1';
|
||||||
$dbname = 'pgperltest';
|
$dbname = 'pgperltest';
|
||||||
$dbhost = 'localhost';
|
|
||||||
$trace = '/tmp/pgtrace.out';
|
$trace = '/tmp/pgtrace.out';
|
||||||
$cnt = 2;
|
$cnt = 2;
|
||||||
$DEBUG = 0; # set this to 1 for traces
|
$DEBUG = 0; # set this to 1 for traces
|
||||||
@ -35,7 +34,6 @@ $| = 1;
|
|||||||
# connectdb
|
# connectdb
|
||||||
# db
|
# db
|
||||||
# user
|
# user
|
||||||
# host
|
|
||||||
# port
|
# port
|
||||||
# finish
|
# finish
|
||||||
# status
|
# status
|
||||||
@ -69,6 +67,7 @@ $| = 1;
|
|||||||
# conndefaults
|
# conndefaults
|
||||||
# reset
|
# reset
|
||||||
# options
|
# options
|
||||||
|
# host
|
||||||
# tty
|
# tty
|
||||||
# getlength
|
# getlength
|
||||||
# getisnull
|
# getisnull
|
||||||
@ -89,7 +88,7 @@ $SIG{PIPE} = sub { print "broken pipe\n" };
|
|||||||
######################### create and connect to test database
|
######################### create and connect to test database
|
||||||
# 2-4
|
# 2-4
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbmain host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbmain");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
# might fail if $dbname doesn't exist => don't check resultStatus
|
# might fail if $dbname doesn't exist => don't check resultStatus
|
||||||
@ -98,7 +97,7 @@ $result = $conn->exec("DROP DATABASE $dbname");
|
|||||||
$result = $conn->exec("CREATE DATABASE $dbname");
|
$result = $conn->exec("CREATE DATABASE $dbname");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbname host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbname");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
######################### debug, PQtrace
|
######################### debug, PQtrace
|
||||||
@ -109,7 +108,7 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### check PGconn
|
######################### check PGconn
|
||||||
# 5-8
|
# 5-7
|
||||||
|
|
||||||
$db = $conn->db;
|
$db = $conn->db;
|
||||||
cmp_eq($dbname, $db);
|
cmp_eq($dbname, $db);
|
||||||
@ -117,14 +116,11 @@ cmp_eq($dbname, $db);
|
|||||||
$user = $conn->user;
|
$user = $conn->user;
|
||||||
cmp_ne("", $user);
|
cmp_ne("", $user);
|
||||||
|
|
||||||
$host = $conn->host;
|
|
||||||
cmp_ne("", $host);
|
|
||||||
|
|
||||||
$port = $conn->port;
|
$port = $conn->port;
|
||||||
cmp_ne("", $port);
|
cmp_ne("", $port);
|
||||||
|
|
||||||
######################### create and insert into table
|
######################### create and insert into table
|
||||||
# 9-20
|
# 8-19
|
||||||
|
|
||||||
$result = $conn->exec("CREATE TABLE person (id int4, name char16)");
|
$result = $conn->exec("CREATE TABLE person (id int4, name char16)");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
@ -137,7 +133,7 @@ for ($i = 1; $i <= 5; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### copy to stdout, PQgetline
|
######################### copy to stdout, PQgetline
|
||||||
# 21-27
|
# 20-26
|
||||||
|
|
||||||
$result = $conn->exec("COPY person TO STDOUT");
|
$result = $conn->exec("COPY person TO STDOUT");
|
||||||
cmp_eq(PGRES_COPY_OUT, $result->resultStatus);
|
cmp_eq(PGRES_COPY_OUT, $result->resultStatus);
|
||||||
@ -154,7 +150,7 @@ while (-1 != $ret) {
|
|||||||
cmp_eq(0, $conn->endcopy);
|
cmp_eq(0, $conn->endcopy);
|
||||||
|
|
||||||
######################### delete and copy from stdin, PQputline
|
######################### delete and copy from stdin, PQputline
|
||||||
# 28-34
|
# 27-33
|
||||||
|
|
||||||
$result = $conn->exec("BEGIN");
|
$result = $conn->exec("BEGIN");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
@ -179,7 +175,7 @@ $result = $conn->exec("END");
|
|||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
|
|
||||||
######################### select from person, PQgetvalue
|
######################### select from person, PQgetvalue
|
||||||
# 35-48
|
# 34-47
|
||||||
|
|
||||||
$result = $conn->exec("SELECT * FROM person");
|
$result = $conn->exec("SELECT * FROM person");
|
||||||
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
||||||
@ -208,7 +204,7 @@ while (@row = $result->fetchrow) {
|
|||||||
cmp_eq("5 Edmund Mergl", $string);
|
cmp_eq("5 Edmund Mergl", $string);
|
||||||
|
|
||||||
######################### PQnotifies
|
######################### PQnotifies
|
||||||
# 44-47
|
# 43-46
|
||||||
|
|
||||||
if (! defined($pid = fork)) {
|
if (! defined($pid = fork)) {
|
||||||
die "can not fork: $!";
|
die "can not fork: $!";
|
||||||
@ -216,7 +212,7 @@ if (! defined($pid = fork)) {
|
|||||||
# i'm the child
|
# i'm the child
|
||||||
sleep 2;
|
sleep 2;
|
||||||
bless $conn;
|
bless $conn;
|
||||||
$conn = Pg::connectdb("dbname=$dbname host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbname");
|
||||||
$result = $conn->exec("NOTIFY person");
|
$result = $conn->exec("NOTIFY person");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -234,7 +230,7 @@ while (1) {
|
|||||||
cmp_eq("person", $table);
|
cmp_eq("person", $table);
|
||||||
|
|
||||||
######################### PQprint
|
######################### PQprint
|
||||||
# 48-49
|
# 47-48
|
||||||
|
|
||||||
$result = $conn->exec("SELECT name FROM person WHERE id = 2");
|
$result = $conn->exec("SELECT name FROM person WHERE id = 2");
|
||||||
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
||||||
@ -244,7 +240,7 @@ $result->print(PRINT, 0, 0, 0, 0, 1, 0, " ", "", "", "myName");
|
|||||||
close(PRINT) || die "bad PRINT: $!";
|
close(PRINT) || die "bad PRINT: $!";
|
||||||
|
|
||||||
######################### PQlo_import, PQlo_export, PQlo_unlink
|
######################### PQlo_import, PQlo_export, PQlo_unlink
|
||||||
# 50-55
|
# 49-54
|
||||||
|
|
||||||
$filename = 'ApachePg.pl';
|
$filename = 'ApachePg.pl';
|
||||||
$cwd = `pwd`;
|
$cwd = `pwd`;
|
||||||
@ -274,9 +270,9 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### disconnect and drop test database
|
######################### disconnect and drop test database
|
||||||
# 56-57
|
# 55-56
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbmain host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbmain");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
$result = $conn->exec("DROP DATABASE $dbname");
|
$result = $conn->exec("DROP DATABASE $dbname");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: example.oldstyle,v 1.3 1998/02/20 21:26:08 mergl Exp $
|
# $Id: example.oldstyle,v 1.4 1998/04/14 21:14:52 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
######################### We start with some black magic to print on failure.
|
######################### We start with some black magic to print on failure.
|
||||||
|
|
||||||
BEGIN { $| = 1; print "1..61\n"; }
|
BEGIN { $| = 1; print "1..60\n"; }
|
||||||
END {print "not ok 1\n" unless $loaded;}
|
END {print "not ok 1\n" unless $loaded;}
|
||||||
use Pg;
|
use Pg;
|
||||||
$loaded = 1;
|
$loaded = 1;
|
||||||
@ -23,7 +23,6 @@ print "ok 1\n";
|
|||||||
|
|
||||||
$dbmain = 'template1';
|
$dbmain = 'template1';
|
||||||
$dbname = 'pgperltest';
|
$dbname = 'pgperltest';
|
||||||
$dbhost = 'localhost';
|
|
||||||
$trace = '/tmp/pgtrace.out';
|
$trace = '/tmp/pgtrace.out';
|
||||||
$cnt = 2;
|
$cnt = 2;
|
||||||
$DEBUG = 0; # set this to 1 for traces
|
$DEBUG = 0; # set this to 1 for traces
|
||||||
@ -34,7 +33,6 @@ $| = 1;
|
|||||||
|
|
||||||
# PQsetdb()
|
# PQsetdb()
|
||||||
# PQdb()
|
# PQdb()
|
||||||
# PQhost()
|
|
||||||
# PQport()
|
# PQport()
|
||||||
# PQfinish()
|
# PQfinish()
|
||||||
# PQstatus()
|
# PQstatus()
|
||||||
@ -69,6 +67,7 @@ $| = 1;
|
|||||||
# PQconndefaults()
|
# PQconndefaults()
|
||||||
# PQreset()
|
# PQreset()
|
||||||
# PQoptions()
|
# PQoptions()
|
||||||
|
# PQhost()
|
||||||
# PQtty()
|
# PQtty()
|
||||||
# PQgetlength()
|
# PQgetlength()
|
||||||
# PQgetisnull()
|
# PQgetisnull()
|
||||||
@ -89,7 +88,7 @@ $SIG{PIPE} = sub { print "broken pipe\n" };
|
|||||||
######################### create and connect to test database
|
######################### create and connect to test database
|
||||||
# 2-4
|
# 2-4
|
||||||
|
|
||||||
$conn = PQsetdb($dbhost, '', '', '', $dbmain);
|
$conn = PQsetdb('', '', '', '', $dbmain);
|
||||||
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
||||||
|
|
||||||
# might fail if $dbname doesn't exist => don't check resultStatus
|
# might fail if $dbname doesn't exist => don't check resultStatus
|
||||||
@ -102,7 +101,7 @@ PQclear($result);
|
|||||||
|
|
||||||
PQfinish($conn);
|
PQfinish($conn);
|
||||||
|
|
||||||
$conn = PQsetdb($dbhost, '', '', '', $dbname);
|
$conn = PQsetdb('', '', '', '', $dbname);
|
||||||
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
||||||
|
|
||||||
######################### debug, PQtrace
|
######################### debug, PQtrace
|
||||||
@ -113,7 +112,7 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### check PGconn
|
######################### check PGconn
|
||||||
# 5-8
|
# 5-7
|
||||||
|
|
||||||
$db = PQdb($conn);
|
$db = PQdb($conn);
|
||||||
cmp_eq($dbname, $db);
|
cmp_eq($dbname, $db);
|
||||||
@ -121,14 +120,11 @@ cmp_eq($dbname, $db);
|
|||||||
$user = PQuser($conn);
|
$user = PQuser($conn);
|
||||||
cmp_ne("", $user);
|
cmp_ne("", $user);
|
||||||
|
|
||||||
$host = PQhost($conn);
|
|
||||||
cmp_ne("", $host);
|
|
||||||
|
|
||||||
$port = PQport($conn);
|
$port = PQport($conn);
|
||||||
cmp_ne("", $port);
|
cmp_ne("", $port);
|
||||||
|
|
||||||
######################### create and insert into table
|
######################### create and insert into table
|
||||||
# 9-20
|
# 8-19
|
||||||
|
|
||||||
$result = PQexec($conn, "CREATE TABLE person (id int4, name char16)");
|
$result = PQexec($conn, "CREATE TABLE person (id int4, name char16)");
|
||||||
cmp_eq(PGRES_COMMAND_OK, PQresultStatus($result));
|
cmp_eq(PGRES_COMMAND_OK, PQresultStatus($result));
|
||||||
@ -143,7 +139,7 @@ for ($i = 1; $i <= 5; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### copy to stdout, PQgetline
|
######################### copy to stdout, PQgetline
|
||||||
# 21-27
|
# 20-26
|
||||||
|
|
||||||
$result = PQexec($conn, "COPY person TO STDOUT");
|
$result = PQexec($conn, "COPY person TO STDOUT");
|
||||||
cmp_eq(PGRES_COPY_OUT, PQresultStatus($result));
|
cmp_eq(PGRES_COPY_OUT, PQresultStatus($result));
|
||||||
@ -161,7 +157,7 @@ while (-1 != $ret) {
|
|||||||
cmp_eq(0, PQendcopy($conn));
|
cmp_eq(0, PQendcopy($conn));
|
||||||
|
|
||||||
######################### delete and copy from stdin, PQputline
|
######################### delete and copy from stdin, PQputline
|
||||||
# 28-34
|
# 27-33
|
||||||
|
|
||||||
$result = PQexec($conn, "BEGIN");
|
$result = PQexec($conn, "BEGIN");
|
||||||
cmp_eq(PGRES_COMMAND_OK, PQresultStatus($result));
|
cmp_eq(PGRES_COMMAND_OK, PQresultStatus($result));
|
||||||
@ -190,7 +186,7 @@ cmp_eq(PGRES_COMMAND_OK, PQresultStatus($result));
|
|||||||
PQclear($result);
|
PQclear($result);
|
||||||
|
|
||||||
######################### select from person, PQgetvalue
|
######################### select from person, PQgetvalue
|
||||||
# 35-48
|
# 34-47
|
||||||
|
|
||||||
$result = PQexec($conn, "SELECT * FROM person");
|
$result = PQexec($conn, "SELECT * FROM person");
|
||||||
cmp_eq(PGRES_TUPLES_OK, PQresultStatus($result));
|
cmp_eq(PGRES_TUPLES_OK, PQresultStatus($result));
|
||||||
@ -224,14 +220,14 @@ for ($k = 0; $k < PQntuples($result); $k++) {
|
|||||||
PQclear($result);
|
PQclear($result);
|
||||||
|
|
||||||
######################### PQnotifies
|
######################### PQnotifies
|
||||||
# 49-51
|
# 48-50
|
||||||
|
|
||||||
if (! defined($pid = fork)) {
|
if (! defined($pid = fork)) {
|
||||||
die "can not fork: $!";
|
die "can not fork: $!";
|
||||||
} elsif (! $pid) {
|
} elsif (! $pid) {
|
||||||
# i'm the child
|
# i'm the child
|
||||||
sleep 2;
|
sleep 2;
|
||||||
$conn = PQsetdb($dbhost, '', '', '', $dbname);
|
$conn = PQsetdb('', '', '', '', $dbname);
|
||||||
$result = PQexec($conn, "NOTIFY person");
|
$result = PQexec($conn, "NOTIFY person");
|
||||||
PQclear($result);
|
PQclear($result);
|
||||||
PQfinish($conn);
|
PQfinish($conn);
|
||||||
@ -253,7 +249,7 @@ while (1) {
|
|||||||
cmp_eq("person", $table);
|
cmp_eq("person", $table);
|
||||||
|
|
||||||
######################### PQprint
|
######################### PQprint
|
||||||
# 52-53
|
# 51-52
|
||||||
|
|
||||||
$result = PQexec($conn, "SELECT name FROM person WHERE id = 2");
|
$result = PQexec($conn, "SELECT name FROM person WHERE id = 2");
|
||||||
cmp_eq(PGRES_TUPLES_OK, PQresultStatus($result));
|
cmp_eq(PGRES_TUPLES_OK, PQresultStatus($result));
|
||||||
@ -264,7 +260,7 @@ PQclear($result);
|
|||||||
close(PRINT) || die "bad PRINT: $!";
|
close(PRINT) || die "bad PRINT: $!";
|
||||||
|
|
||||||
######################### PQlo_import, PQlo_export, PQlo_unlink
|
######################### PQlo_import, PQlo_export, PQlo_unlink
|
||||||
# 54-60
|
# 53-59
|
||||||
|
|
||||||
$filename = 'ApachePg.pl';
|
$filename = 'ApachePg.pl';
|
||||||
$cwd = `pwd`;
|
$cwd = `pwd`;
|
||||||
@ -296,11 +292,11 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### disconnect and drop test database
|
######################### disconnect and drop test database
|
||||||
# 60-61
|
# 59-60
|
||||||
|
|
||||||
PQfinish($conn);
|
PQfinish($conn);
|
||||||
|
|
||||||
$conn = PQsetdb($dbhost, '', '', '', $dbmain);
|
$conn = PQsetdb('', '', '', '', $dbmain);
|
||||||
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
cmp_eq(PGRES_CONNECTION_OK, PQstatus($conn));
|
||||||
|
|
||||||
$result = PQexec($conn, "DROP DATABASE $dbname");
|
$result = PQexec($conn, "DROP DATABASE $dbname");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: test.pl,v 1.6 1998/02/20 21:25:45 mergl Exp $
|
# $Id: test.pl,v 1.7 1998/04/14 21:14:38 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
######################### We start with some black magic to print on failure.
|
######################### We start with some black magic to print on failure.
|
||||||
|
|
||||||
BEGIN { $| = 1; print "1..46\n"; }
|
BEGIN { $| = 1; print "1..45\n"; }
|
||||||
END {print "not ok 1\n" unless $loaded;}
|
END {print "not ok 1\n" unless $loaded;}
|
||||||
use Pg;
|
use Pg;
|
||||||
$loaded = 1;
|
$loaded = 1;
|
||||||
@ -23,7 +23,6 @@ print "ok 1\n";
|
|||||||
|
|
||||||
$dbmain = 'template1';
|
$dbmain = 'template1';
|
||||||
$dbname = 'pgperltest';
|
$dbname = 'pgperltest';
|
||||||
$dbhost = 'localhost';
|
|
||||||
$trace = '/tmp/pgtrace.out';
|
$trace = '/tmp/pgtrace.out';
|
||||||
$cnt = 2;
|
$cnt = 2;
|
||||||
$DEBUG = 0; # set this to 1 for traces
|
$DEBUG = 0; # set this to 1 for traces
|
||||||
@ -35,7 +34,6 @@ $| = 1;
|
|||||||
# connectdb
|
# connectdb
|
||||||
# db
|
# db
|
||||||
# user
|
# user
|
||||||
# host
|
|
||||||
# port
|
# port
|
||||||
# finish
|
# finish
|
||||||
# status
|
# status
|
||||||
@ -64,6 +62,7 @@ $| = 1;
|
|||||||
# conndefaults
|
# conndefaults
|
||||||
# reset
|
# reset
|
||||||
# options
|
# options
|
||||||
|
# host
|
||||||
# tty
|
# tty
|
||||||
# getlength
|
# getlength
|
||||||
# getisnull
|
# getisnull
|
||||||
@ -89,7 +88,7 @@ $SIG{PIPE} = sub { print "broken pipe\n" };
|
|||||||
######################### create and connect to test database
|
######################### create and connect to test database
|
||||||
# 2-4
|
# 2-4
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbmain host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbmain");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
# might fail if $dbname doesn't exist => don't check resultStatus
|
# might fail if $dbname doesn't exist => don't check resultStatus
|
||||||
@ -98,7 +97,7 @@ $result = $conn->exec("DROP DATABASE $dbname");
|
|||||||
$result = $conn->exec("CREATE DATABASE $dbname");
|
$result = $conn->exec("CREATE DATABASE $dbname");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbname host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbname");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
######################### debug, PQtrace
|
######################### debug, PQtrace
|
||||||
@ -109,7 +108,7 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### check PGconn
|
######################### check PGconn
|
||||||
# 5-8
|
# 5-7
|
||||||
|
|
||||||
$db = $conn->db;
|
$db = $conn->db;
|
||||||
cmp_eq($dbname, $db);
|
cmp_eq($dbname, $db);
|
||||||
@ -117,14 +116,11 @@ cmp_eq($dbname, $db);
|
|||||||
$user = $conn->user;
|
$user = $conn->user;
|
||||||
cmp_ne("", $user);
|
cmp_ne("", $user);
|
||||||
|
|
||||||
$host = $conn->host;
|
|
||||||
cmp_ne("", $host);
|
|
||||||
|
|
||||||
$port = $conn->port;
|
$port = $conn->port;
|
||||||
cmp_ne("", $port);
|
cmp_ne("", $port);
|
||||||
|
|
||||||
######################### create and insert into table
|
######################### create and insert into table
|
||||||
# 9-20
|
# 8-19
|
||||||
|
|
||||||
$result = $conn->exec("CREATE TABLE person (id int4, name char16)");
|
$result = $conn->exec("CREATE TABLE person (id int4, name char16)");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
@ -137,7 +133,7 @@ for ($i = 1; $i <= 5; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### copy to stdout, PQgetline
|
######################### copy to stdout, PQgetline
|
||||||
# 21-27
|
# 20-26
|
||||||
|
|
||||||
$result = $conn->exec("COPY person TO STDOUT");
|
$result = $conn->exec("COPY person TO STDOUT");
|
||||||
cmp_eq(PGRES_COPY_OUT, $result->resultStatus);
|
cmp_eq(PGRES_COPY_OUT, $result->resultStatus);
|
||||||
@ -154,7 +150,7 @@ while (-1 != $ret) {
|
|||||||
cmp_eq(0, $conn->endcopy);
|
cmp_eq(0, $conn->endcopy);
|
||||||
|
|
||||||
######################### delete and copy from stdin, PQputline
|
######################### delete and copy from stdin, PQputline
|
||||||
# 28-34
|
# 27-33
|
||||||
|
|
||||||
$result = $conn->exec("BEGIN");
|
$result = $conn->exec("BEGIN");
|
||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
@ -179,7 +175,7 @@ $result = $conn->exec("END");
|
|||||||
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
cmp_eq(PGRES_COMMAND_OK, $result->resultStatus);
|
||||||
|
|
||||||
######################### select from person, PQgetvalue
|
######################### select from person, PQgetvalue
|
||||||
# 31-44
|
# 34-43
|
||||||
|
|
||||||
$result = $conn->exec("SELECT * FROM person");
|
$result = $conn->exec("SELECT * FROM person");
|
||||||
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
cmp_eq(PGRES_TUPLES_OK, $result->resultStatus);
|
||||||
@ -215,9 +211,9 @@ if ($DEBUG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
######################### disconnect and drop test database
|
######################### disconnect and drop test database
|
||||||
# 45-46
|
# 44-45
|
||||||
|
|
||||||
$conn = Pg::connectdb("dbname=$dbmain host=$dbhost");
|
$conn = Pg::connectdb("dbname=$dbmain");
|
||||||
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
cmp_eq(PGRES_CONNECTION_OK, $conn->status);
|
||||||
|
|
||||||
$result = $conn->exec("DROP DATABASE $dbname");
|
$result = $conn->exec("DROP DATABASE $dbname");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#-------------------------------------------------------
|
#-------------------------------------------------------
|
||||||
#
|
#
|
||||||
# $Id: typemap,v 1.5 1998/02/20 21:25:47 mergl Exp $
|
# $Id: typemap,v 1.6 1998/04/14 21:14:39 mergl Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 Edmund Mergl
|
# Copyright (c) 1997 Edmund Mergl
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user