From: | "Rahul_Iyer" <rahul_iyer(at)persistent(dot)co(dot)in> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Cc: | <shridhar_daithankar(at)persistent(dot)co(dot)in> |
Subject: | number of affected tuples |
Date: | 2003-08-19 14:31:37 |
Message-ID: | 004a01c3665e$98d8f460$6f02a8c0@persistent.co.in |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bo Lorentsen | 2003-08-19 14:40:30 | Re: Buglist |
Previous Message | Devrim GUNDUZ | 2003-08-19 14:26:18 | Re: Buglist |