From: Michael Fuhr <mike@fuhr.org>
To: simon.hewitt@greenhill-ymca.org
Cc: pgsql-php@postgresql.org
Subject: Re: pg_put_line() Frustration
Date: Mon, 20 Jun 2005 08:05:31 -0600
Message-ID: <20050620140531.GA26064@winnie.fuhr.org> (raw)
In-Reply-To: <BAY103-F2DAC914A1FB677D5AFCC1D5E90@phx.gbl>
References: <BAY103-F2DAC914A1FB677D5AFCC1D5E90@phx.gbl>
On Mon, Jun 20, 2005 at 01:29:47PM +0000, Simon Hewitt wrote:
>
> I am currently working on an application that will input multple lines into
> a Postgre database. I am using the following code
It's PostgreSQL or Postgres, not Postgre.
> $sql = "COPY table_2 FROM STDIN DELIMITER AS '\t'";
> pg_query($dbc, $sql);
> $sql = $data1."\t".$data2."\t".implode("\t",
> $data)."\ttrue\t05-05-2005\n";
> pg_put_line($this->dbc, $sql);
> if(!pg_put_line($dbc, "\\N"))
The last line above attempts to add a row with a single NULL value,
so you get an error about missing data for the other columns. What's
the purpose of that line? Why do you sometimes use $dbc and sometimes
$this->dbc? Do they refer to the same connection or to different
connections?
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: mike@fuhr.org, simon.hewitt@greenhill-ymca.org
Subject: Re: pg_put_line() Frustration
In-Reply-To: <20050620140531.GA26064@winnie.fuhr.org>
References: <BAY103-F2DAC914A1FB677D5AFCC1D5E90@phx.gbl> <20050620140531.GA26064@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox