Re: [GENERAL] getting the number of rows affected by a query

2007-11-18 Thread brian
Ow Mun Heng wrote: Turns out this is a 2 part question, for which I have 1 solved. 1. using perl DBI to pull from MSSQL to PG.. --> I found out I can use my $ins_rows = $dbh_pg->do($query2) or die "prepare failed $DBI::errstr"; 2. using pure SQL (via pgagent jobs) to pull. This is the one whi

Re: [GENERAL] getting the number of rows affected by a query

2007-11-18 Thread Ow Mun Heng
On Fri, 2007-11-16 at 09:28 -0600, Erik Jones wrote: > On Nov 16, 2007, at 3:26 AM, Ow Mun Heng wrote: > > > > > On Fri, 2007-11-16 at 10:22 +0100, Martijn van Oosterhout wrote: > >> On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote: > >>> I usually write a function which gets/uses the

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Pavel Stehule
On 16/11/2007, Sam Mason <[EMAIL PROTECTED]> wrote: > On Fri, Nov 16, 2007 at 12:51:07PM +, Raymond O'Donnell wrote: > > On 16/11/2007 10:02, Sam Mason wrote: > > > > > SELECT COUNT(*) FROM ( > > >DELETE FROM foo RETURNING 1) x; > > > > I haven't played with this yet, but AFAICS this will

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 12:51:07PM +, Raymond O'Donnell wrote: > On 16/11/2007 10:02, Sam Mason wrote: > > > SELECT COUNT(*) FROM ( > >DELETE FROM foo RETURNING 1) x; > > I haven't played with this yet, but AFAICS this will simply return the > integer value "1". I currently get a synta

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Ow Mun Heng
On Fri, 2007-11-16 at 10:22 +0100, Martijn van Oosterhout wrote: > On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote: > > I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT > > parameter which will tell me how many rows were affected by the query. > > > > Now, for

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Erik Jones
On Nov 16, 2007, at 3:26 AM, Ow Mun Heng wrote: On Fri, 2007-11-16 at 10:22 +0100, Martijn van Oosterhout wrote: On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote: I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT parameter which will tell me how many rows w

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Raymond O'Donnell
On 16/11/2007 10:02, Sam Mason wrote: SELECT COUNT(*) FROM ( DELETE FROM foo RETURNING 1) x; I haven't played with this yet, but AFAICS this will simply return the integer value "1". Ray. --- Raymond O'Donnell, Director of M

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Martijn van Oosterhout
On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote: > I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT > parameter which will tell me how many rows were affected by the query. > > Now, for this case, I'm not writing a function but merely using a normal > SQL eg: T

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Sam Mason
On Fri, Nov 16, 2007 at 09:00:46AM +0800, Ow Mun Heng wrote: > I'm trying to do some periodic updates from another DB and would like to > know the # of updates/inserts/deletes from that job. Humm; it would be nice if you could use the new RETURNING construct that's been introduced in 8.2, i.e. som

Re: [GENERAL] getting the number of rows affected by a query

2007-11-16 Thread Ow Mun Heng
On Fri, 2007-11-16 at 09:00 +0800, Ow Mun Heng wrote: > I'm trying to do some periodic updates from another DB and would like to > know the # of updates/inserts/deletes from that job. > > I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT > parameter which will tell me how m

[GENERAL] getting the number of rows affected by a query

2007-11-15 Thread Ow Mun Heng
I'm trying to do some periodic updates from another DB and would like to know the # of updates/inserts/deletes from that job. I usually write a function which gets/uses the GETS DIAGNOSTIC ROW COUNT parameter which will tell me how many rows were affected by the query. Now, for this case, I'm not