Hi!
I can't find anywhere in the documentation, how to fetch the OID returned
by the PostgeSQL, after an INSERT.
I found, that in sub DBD::PgPP::CompletedResponse::compute()
[PgPP.pm:1505, VERSION=0.04] the OID value is stored, but I am not able to
read it out.
Thanks for help.
Márton Németh
Student of Budapest University of Technology and Economics, Hungary#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my ($dbh);
my ($sql);
my ($result);
my ($dbname, $host, $port, $username, $password) = ('testbed', 'madar', '5432',
'nmarci', 'alma');
my ($name, $description) = ('text for name', 'text for description');
$dbh = DBI->connect(
"dbi:PgPP:dbname=$dbname;host=$host;port=$port;debug=1",
$username, $password
);
$sql = "INSERT INTO measurements ".
"(\"Name\", \"Description\") ".
"VALUES ('$name', '$description');";
$result = $dbh->do($sql);
# $oid = ???
$dbh->disconnect();
DBD::PgPP::Protocol::_do_startup()
00 00 01 28 00 02 00 00 74 65 73 74 62 65 64 00 ...(....testbed.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 6E 6D 61 72 63 69 00 00 ........nmarci..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 ........
DBD::PgPP::PacketStream::_if_short_then_add_buffer()
52 00 00 00 03 R....
Recieve DBD::PgPP::AuthenticationCleartextPassword
DBD::PgPP::AuthenticationCleartextPassword::compute()
00 00 00 09 61 6C 6D 61 00 ....alma.
DBD::PgPP::PacketStream::_if_short_then_add_buffer()
52 00 00 00 00 4B 00 00 21 21 46 C5 B6 F3 5A R....K....F...Z
Recieve DBD::PgPP::AuthenticationOk
Recieve DBD::PgPP::BackendKeyData
Recieve DBD::PgPP::ReadyForQuery
DBD::PgPP::ProtocolStatement::execute()
51 49 4E 53 45 52 54 20 49 4E 54 4F 20 6D 65 61 QINSERT.INTO.mea
73 75 72 65 6D 65 6E 74 73 20 28 22 4E 61 6D 65 surements.(.Name
22 2C 20 22 44 65 73 63 72 69 70 74 69 6F 6E 22 .,..Description.
29 20 56 41 4C 55 45 53 20 28 27 74 65 78 74 20 ).VALUES.('text.
66 6F 72 20 6E 61 6D 65 27 2C 20 27 74 65 78 74 for.name',.'text
20 66 6F 72 20 64 65 73 63 72 69 70 74 69 6F 6E .for.description
27 29 3B 00 ');.
DBD::PgPP::PacketStream::_if_short_then_add_buffer()
50 62 6C 61 6E 6B 00 43 49 4E 53 45 52 54 20 31 Pblank.CINSERT.1
38 34 30 39 20 31 00 5A 8409.1.Z
Recieve DBD::PgPP::CursorResponse
-Recieve DBD::PgPP::ReadyForQuery
DBD::PgPP::Protocol::close()
58 00 X.