Skip site navigation (1) Skip section navigation (2)

Re: Synthesize support for Statement.getGeneratedKeys()?

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Date: 2007-01-27 04:33:52
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc
Dave Cramer wrote:
> Ken,
> Do you have a test case ? What do the server logs show ?

Hi Dave,

My test case is:

String url = "jdbc:postgresql://";
String clz = "org.postgresql.Driver";
String dml = "insert into contact (rowid,logonname) values (DEFAULT,'bar')";
String[] keys = {"rowid"};
Connection con = DriverManager.getConnection(url, "user", "pass");
Statement stmt = con.createStatement();
int affected = stmt.executeUpdate(dml, keys);
ResultSet rs = stmt.getGeneratedKeys();
if (
	out.println("NO ROWS, INSERTED "+affected);

A ResultSet is returned but has no rows. The insert does succeed and a 
sequence generated key increments in the 'rowid' column.

I think the issue is just that my code is not calling through the 
correct private methods that would populate a result.

Also I noticed that so far my mods have not implemented 

On a related note, do you know how I could call though a Stream method 
instead of the String/Charsequence execs?


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-01-27 04:50:56
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Previous:From: Tom LaneDate: 2007-01-26 16:43:26
Subject: Re: wrong parsing of "select version();"

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group