Re: FAQ error

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: FAQ error
Дата
Msg-id 200110142303.f9EN3hv21193@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: FAQ error  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: FAQ error  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
> Bruce Momjian writes:
> 
> > > Bruce Momjian writes:
> > >
> > > > OK, new FAQ code is:
> > > >
> > > >     $sql = "SELECT nextval('person_id_seq')";
> > > >     $newSerialID = ($conn->selectrow_array($sql))[0];
> > > >     INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal');
> > > >     $res = $dbh->do($sql);
> > >
> > > This code is still incorrect for any known programming language and it's
> > > even less clear to a person that doesn't know the programming language
> > > it's probably trying to imitate.
> >
> > OK, what suggestions do you have?
> 
> I didn't have a problem with the original version.  It conveyed clearly
> (to me), "read the nextval and insert it yourself".

Obviously, someone did because they tried the code and it didn't work. 
At least the new code is closer to valid, though less clear.  It is at
least a valid snippet, which the previous version was not.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Package support for Postgres
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: FAQ error