[HACKERS] number of affected tuples

2003-08-20 Thread Rahul_Iyer
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));

coutPQcmdTuples (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...

nameage
-
a1
b2

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


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[HACKERS] no of affected rows in prepared stmts

2003-08-14 Thread Rahul_Iyer
hi
whenever i call an execute on a prepared statement, i get the return value
of PQcmdTuples() as NULL even if the query did modify tuples...
how can i get the number of affected tuples?
thanx in adv.
rahul


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[HACKERS] Speeding up operations

2003-08-14 Thread Rahul_Iyer
hi...
im on a project using Postgres. The project involves, at times, upto
5,000,000 inserts. I was checking the performance of Postgres for 5M inserts
into a 2 column table (one col=integer, 2nd col=character). I used the
Prepare... and execute method, so i basically had 5M execute statements and
1 prepare statement. Postgres took 144min for this... is there any way to
improve this performance? if so, how? btw, im using it on a SPARC/Solaris
2.6.
thanx in adv
rahul

P.S: Kindly point me towards any relevant documentation as well.


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[HACKERS] Batch Operations

2003-08-12 Thread Rahul_Iyer
hi,
im currently working on a project that requires batch operations - eg. Batch
insert/update etc. The database im using is PostgreSQL. However, i cannot
find any documentation for batch opeartions on PostgreSQL. Does anyone know
how to do this, or if it is possible?

Thanx in advance
regards
rahul


---(end of broadcast)---
TIP 8: explain analyze is your friend