number of affected tuples

Поиск
Список
Период
Сортировка
От Rahul_Iyer
Тема number of affected tuples
Дата
Msg-id 004a01c3665e$98d8f460$6f02a8c0@persistent.co.in
обсуждение исходный текст
Список pgsql-hackers
hi
im having a problem while using the PQcmdTuples(). Consider the following
code snippet:
there exists a table table1 (name character(30), age integer)

<...snip...>
PGresult *res = PQexec("prepare p_stmt (integer) update table1 set age = age
+ 1 where age = $1");
PQclear (res);

res = PQexec ( execute p_stmt (10));

cout<<PQcmdTuples (res);

<...snip...>

the PQcmdTuples() returns a null string. The doc says it returns number of
affected tuples if the statement is INSERT, UPDATE or DELETE. This
apparently doesn't include statements.

Now consider this...

name        age
-----        ----
a                1
b                2

update table1 set age=age + 1 where age = 3;
this does not return an error even though no tuples were were affected.

Now my problem is this.....
either
1> i need the number of affected rows in the update operation

OR

2> i need to get whether the update did or did not affect a tuple (no tuple
was matched by the where clause). In my case, at max, 1 tuple will be
affected.

any of these will solve the problem

thanx in advance
rahul



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

Предыдущее
От: Manfred Koizar
Дата:
Сообщение: Again on index correlation
Следующее
От: ANTIGEN_MAILDEPOT
Дата:
Сообщение: Antigen found FILE FILTER= *.* file