Re: Statement.ececuteUpdate() closes ResultSet obtained from same Statement

Поиск
Список
Период
Сортировка
От Glenn Holmer
Тема Re: Statement.ececuteUpdate() closes ResultSet obtained from same Statement
Дата
Msg-id 53F9FBA3.8010109@lyonlabs.org
обсуждение исходный текст
Ответ на Statement.ececuteUpdate() closes ResultSet obtained from same Statement  (Christian Schlichtherle <christian@schlichtherle.de>)
Список pgsql-jdbc
On 08/24/2014 07:33 AM, Christian Schlichtherle wrote:
> I am not sure if this is a bug or a feature, but here it goes:
>     @Test(expected = SQLException.class)
>     public void testSharedStatementClosesResultSet() throws SQLException {
>         try (Connection c = getConnection();
>              Statement s = c.createStatement()) {
>             try (ResultSet rs = s.executeQuery("SELECT a FROM test")) {
>                 s.executeUpdate("INSERT INTO test(a) VALUES (1)");
>                 // Expected false, but throws SQLException: This statement has been closed.
>                 assert !rs.next();
>             }
>         }
>     }

http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html

"All execution methods in the Statement interface implicitly close a
statment's current ResultSet object if an open one exists."

--
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: Statement.ececuteUpdate() closes ResultSet obtained from same Statement
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: JDBC build broken by commit 9f9019b