PQexec() with multiple sql statements.

Поиск
Список
Период
Сортировка
От Yasuo Ohgaki
Тема PQexec() with multiple sql statements.
Дата
Msg-id 9aqufd$1us$1@news.tht.net
обсуждение исходный текст
Ответы Re: PQexec() with multiple sql statements.  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Список pgsql-general
Hello all,

I'm would like to know how PQexec() treats query passed as its parameter.
(PostgreSQL 7.0.3/Linux)

When I pass sql statements like

----------------- BEGIN --------------
CREATE TABLE tmp (
    id serial,
    txt text
);

INSERT INTO tmp (txt) VALUES ('test str');
----------------- END -----------------

INSERT INTO issues an error. "table tmp does not exist" (it is not an exact
message but basically it says so. It works if I pass statement  one by one.)

I've looked PostgreSQL Programmer's Manual, but I couldn't find why PQexec()
does this.
Could anyone explain why PQexec() does not allow INSERT after CREATE TABLE?

If PQexec() makes sure "multiple sql statements query", passed to it, is
executed atomically, I would like to take advantage of it.

Thanks in advance.

PS: I'm not using libpq directly, but from PHP. I believe pg_exec() in PHP is
just a wrapper function of PQexec(), isn't it?

--
Yasuo Ohgaki




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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: linux/bsd
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: PQexec() with multiple sql statements.