Re: DBI && INSERT

From: Gianni Ceccarelli <dakkar(at)thenautilus(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Cc: Matthias Apitz <guru(at)unixarea(dot)de>
Subject: Re: DBI && INSERT
Date: 2020-02-17 16:15:40
Message-ID: 20200217161540.1a8d02e5@exelion
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 17 Feb 2020 16:49:27 +0100
Matthias Apitz <guru(at)unixarea(dot)de> wrote:
> I spend today some hours to nail down and insert problem into our
> database with DBI like:
>
> my $rc = $my_dbh->do($my_sqlstatement);
>
> which returns 1 in $rc (which the following flow in our script took
> as an error).

The DBI docs say::

$rows = $dbh->do($statement) or die $dbh->errstr;

so when ``do`` returns 1, it means it worked, not that it failed.

In particular:

Returns the number of rows affected or "undef" on error. A return
value of "-1" means the number of rows is not known, not
applicable, or not available.

--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeremy Schneider 2020-02-17 16:23:02 Re: PL/pgSQL question about EXCEPTION clause & corrupt records
Previous Message Matthias Apitz 2020-02-17 15:49:27 DBI && INSERT