INSERT results

Поиск
Список
Период
Сортировка
От Mark Thomas
Тема INSERT results
Дата
Msg-id 5.1.0.14.2.20020423165549.047372d0@pbegames.com
обсуждение исходный текст
Ответы Re: INSERT results  ("Joshua b. Jore" <josh@greentechnologist.org>)
Список pgsql-novice
Suppose I have a sequence/table:

CREATE SEQUENCE "id_seq" start 5000 increment 1;

CREATE TABLE "users"
(
     "id" integer primary key default nextval('id_seq') NOT NULL,
     "name" varchar(64)
);

I'm using libpq. If I do something like this:

PGconn *conn; // assume initialized
const char *q = "INSERT INTO users (name) VALUES ('J Doe')";
PGresult *res = PQexec(conn, q);

At this point is there any way for my app to determine the id value of the
newly inserted record?



Mark Thomas
---
thomas@pbegames.com ----> http://www.pbegames.com/~thomas
Play by Electron Games -> http://www.pbegames.com Free Trial Games


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

Предыдущее
От: "Joshua b. Jore"
Дата:
Сообщение: Re: Storing .jpg files
Следующее
От: "Patrick Hatcher"
Дата:
Сообщение: escape character in a function