Multiple Statement result set problem with PreparedStatements ?
От | Lenard, Rohan (Rohan) |
---|---|
Тема | Multiple Statement result set problem with PreparedStatements ? |
Дата | |
Msg-id | 2773CAC687FD5F4689F526998C7E4E5F1EF2BC@au3010avexu1.global.avaya.com обсуждение исходный текст |
Ответы |
Re: Multiple Statement result set problem with PreparedStatements
|
Список | pgsql-jdbc |
I have SQL like this (foo has a pkey from a serial) -
INSERT INTO foo ( a, b ) VALUES ( ?, ? );
INSERT INTO bar ( foo_fkey, c ) VALUES ( ?, currval('foo_seq'::text) );
SELECT currval('bar_seq'::text) AS x, currval('foo_seq'::text) AS y;
that I'm using like this
final PreparedStatement stmt = conn.createPreparedStatement("
INSERT INTO foo ( a, b ) VALUES ( ?, ? );
INSERT INTO bar ( foo_fkey, c ) VALUES ( ?, currval('foo_seq'::text) );
SELECT currval('bar_seq'::text), currval('foo_seq'::text);");
stmt.setString(1, "A");
stmt.setString(2, "B");
stmt.setString(3, "C");
boolean result = stmt.execute();
if (result) {
processRS(stmt.getResultSet());
}
else {
if (getMoreResults()) {
processRS(stmt.getResultSet()); // only gets called with 1 element SELECTED.
}
}
This works fine if the SELECT returns 1 value only, but as soon as it returns 2 values the inserts work but no results are given... What the ???
I have pg-8.0-311 against a 7.3.10 server..
Any ideas ?
Thx,
Rohan
В списке pgsql-jdbc по дате отправления: