Damned anti-spam server thinks I'm a spammer ...
 ... resending with my ISP's mail server.

See attached ...
--- Begin Message ---
This is the mail system at host archeopterix.entropy.homelinux.org.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<dbi-users@perl.org>: host mx.develooper.com[63.251.223.176] said: 550
    http://www.spamhaus.org/query/bl?ip=124.168.160.24 (in reply to RCPT TO
    command)
Content-Description: Undelivered Message
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit

Received: from localhost (localhost.localdomain [127.0.0.1])
	by archeopterix.entropy.homelinux.org (Postfix) with ESMTP id D015115488C;
	Tue,  1 Jul 2008 10:00:04 +1000 (EST)
Received: from archeopterix.entropy.homelinux.org ([127.0.0.1])
 by localhost (entropy.homelinux.org [127.0.0.1]) (amavisd-maia, port 10024)
 with LMTP id 18945-10; Tue,  1 Jul 2008 10:00:04 +1000 (EST)
Received: from entropy.homelinux.org (localhost.localdomain [127.0.0.1])
	by archeopterix.entropy.homelinux.org (Postfix) with ESMTP id 7AF1F15488A;
	Tue,  1 Jul 2008 10:00:04 +1000 (EST)
MIME-Version: 1.0
Date: Tue, 01 Jul 2008 10:00:04 +1000
From: dan <dan@entropy.homelinux.org>
To: Greg Sabino Mullane <greg@turnstep.com>
Cc: dbi-users@perl.org
Subject: Re: Detecting auto-incrementing primary keys
In-Reply-To: <255a3c44988150101761b1aef29e81b1@biglumber.com>
References: <255a3c44988150101761b1aef29e81b1@biglumber.com>
Message-ID: <aa81d747d2f771230b88fe39a9ac26e6@127.0.0.1>
X-Sender: dan@entropy.homelinux.org
User-Agent: RoundCube Webmail/0.2a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 30 Jun 2008 13:42:35 -0000, Greg Sabino Mullane <greg@turnstep.co=
m>
wrote:

>> I'm looking for a *portable* way to detect auto-incrementing primary
>> keys. Is there one?
>=20
> No - because there is no universal concept of an "auto-incrementing"
> primary key. MySQL and SQLite have a specific column modifier
> called AUTOINCREMENT. Postgres uses sequences and a default value.
> Oracle uses sequences and a trigger. And so on. Perhaps if you explain
> what exactly you are trying to do, another solution (such as
> $dbh->last_insert_id() perhaps?) may present itself.

I'm writing a generic database interface, similar to MS Access. Up until
now, I had only supported tables with auto-incrementing primary keys ( an=
d
where it worked, yes I used $dbh->last_insert_id ). But now people are
requesting support for all sorts of strange setups, like varchar(50)
primary keys, or even worse, multi-column primary keys. The mind boggles.
But anyway, I'd like to support it, because I've actually run into a coup=
le
of tables myself with char() primary keys, and I've had to try to convinc=
e
the owner of the table ( sometimes unsuccessfully ) to add an
auto-incrementing primary key.

The reason I need to know is that I have to figure out what to do when
someone goes to insert a record. For example, on Oracle, I have to reques=
t
a new sequence before going ahead with the insert ( from what others have
told me ). Or with others I do $dbh->last_insert_id after the insert. Or,
for example, if there is no auto-incrementing PK of any type, then I
instead just use whatever the user typed in that field ( assuming the
insert was successful ).

So, I take it the answer is still 'no'; I can't portably detect this kind
of thing. I'll go back to parsing the output of $dbh->column_info then. A=
s
noted before though, SQLite doesn't support $dbh->column_info, so I reall=
y
don't know what to do in this case.

Dan


--- End Message ---

Reply via email to