pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DELETING ROW
4+ messages / 2 participants
[nested] [flat]

* DELETING ROW
@ 2000-07-12 11:13  Gabriel López Millán <gabilm@dif.um.es>
  0 siblings, 1 reply; 4+ messages in thread

From: Gabriel López Millán @ 2000-07-12 11:13 UTC (permalink / raw)
  To: pgsql-interfaces


    Hi all.

    I'm traying to delete a row of a table. Te code is:

 String query = "DELETE FROM " + ID_REQUEST_TABLE + " WHERE id = '" +
numReq+ "';";
 int result = s.executeUpdate(query);
 System.out.println("result: " + result);
 if(result != 0) {
     .....
     connection.commit();
  }


    If file do not exists "result" should be "0" (JDBC API), if exists,
it should be the number of the row that delete. But I always get the
value "1", always, even if the row to delete is 5,6, ... 10.

    I'm using postgresql 7.02 with linux RedHat 6.0 and jdk1.2

    Cheers, Gabi.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETING ROW
@ 2000-07-12 13:40  Bob Kline <bkline@rksystems.com>
  parent: Gabriel López Millán <gabilm@dif.um.es>
  0 siblings, 1 reply; 4+ messages in thread

From: Bob Kline @ 2000-07-12 13:40 UTC (permalink / raw)
  To: Gabriel López Millán <gabilm@dif.um.es>; +Cc: pgsql-interfaces

On Wed, 12 Jul 2000, Gabriel [iso-8859-1] López Millán wrote:

> 
>     Hi all.
> 
>     I'm traying to delete a row of a table. Te code is:
> 
>  String query = "DELETE FROM " + ID_REQUEST_TABLE + " WHERE id = '" +
> numReq+ "';";
>  int result = s.executeUpdate(query);
>  System.out.println("result: " + result);
>  if(result != 0) {
>      .....
>      connection.commit();
>   }
> 
> 
>     If file do not exists "result" should be "0" (JDBC API), if exists,
> it should be the number of the row that delete. But I always get the
> value "1", always, even if the row to delete is 5,6, ... 10.
> 
>     I'm using postgresql 7.02 with linux RedHat 6.0 and jdk1.2
> 
>     Cheers, Gabi.
> 

If you read the docs a little more carefully, I think you'll find that
the return value is the number of rows affected by the statement.

-- 
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETING ROW
@ 2000-07-13 07:49  Gabriel López Millán <gabilm@dif.um.es>
  parent: Bob Kline <bkline@rksystems.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Gabriel López Millán @ 2000-07-13 07:49 UTC (permalink / raw)
  To: Bob Kline <bkline@rksystems.com>; +Cc: pgsql-interfaces

Bob Kline wrote:

> On Wed, 12 Jul 2000, Gabriel [iso-8859-1] López Millán wrote:
>
> >
> >     Hi all.
> >
> >     I'm traying to delete a row of a table. Te code is:
> >
> >  String query = "DELETE FROM " + ID_REQUEST_TABLE + " WHERE id = '" +
> > numReq+ "';";
> >  int result = s.executeUpdate(query);
> >  System.out.println("result: " + result);
> >  if(result != 0) {
> >      .....
> >      connection.commit();
> >   }
> >
> >
> >     If file do not exists "result" should be "0" (JDBC API), if exists,
> > it should be the number of the row that delete. But I always get the
> > value "1", always, even if the row to delete is 5,6, ... 10.
> >
> >     I'm using postgresql 7.02 with linux RedHat 6.0 and jdk1.2
> >
> >     Cheers, Gabi.
> >
>
> If you read the docs a little more carefully, I think you'll find that
> the return value is the number of rows affected by the statement.

        OK.

        And if I try to delete a row that do not exits, the result is the
same '1'. ¿It is also correct?




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DELETING ROW
@ 2000-07-13 12:31  Bob Kline <bkline@rksystems.com>
  parent: Gabriel López Millán <gabilm@dif.um.es>
  0 siblings, 0 replies; 4+ messages in thread

From: Bob Kline @ 2000-07-13 12:31 UTC (permalink / raw)
  To: Gabriel López Millán <gabilm@dif.um.es>; +Cc: pgsql-interfaces

On Thu, 13 Jul 2000, Gabriel [iso-8859-1] López Millán wrote:

> Bob Kline wrote:
> 
> > On Wed, 12 Jul 2000, Gabriel [iso-8859-1] López Millán wrote:
> >
> > >
> > >     Hi all.
> > >
> > >     I'm traying to delete a row of a table. Te code is:
> > >
> > >  String query = "DELETE FROM " + ID_REQUEST_TABLE + " WHERE id = '" +
> > > numReq+ "';";
> > >  int result = s.executeUpdate(query);
> > >  System.out.println("result: " + result);
> > >  if(result != 0) {
> > >      .....
> > >      connection.commit();
> > >   }
> > >
> > >
> > >     If file do not exists "result" should be "0" (JDBC API), if exists,
> > > it should be the number of the row that delete. But I always get the
> > > value "1", always, even if the row to delete is 5,6, ... 10.
> > >
> > >     I'm using postgresql 7.02 with linux RedHat 6.0 and jdk1.2
> > >
> > >     Cheers, Gabi.
> > >
> >
> > If you read the docs a little more carefully, I think you'll find that
> > the return value is the number of rows affected by the statement.
> 
>         OK.
> 
>         And if I try to delete a row that do not exits, the result is the
> same '1'. ¿It is also correct?
> 

Nope.  That would be a bug in the driver.

-- 
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2000-07-13 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-12 11:13 DELETING ROW Gabriel López Millán <gabilm@dif.um.es>
2000-07-12 13:40 ` Bob Kline <bkline@rksystems.com>
2000-07-13 07:49   ` Gabriel López Millán <gabilm@dif.um.es>
2000-07-13 12:31     ` Bob Kline <bkline@rksystems.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox