Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37319

Re: Testing the functionality of sub classes

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Testing the functionality of sub classes
Date 2017-08-20 11:17 -0400
Organization Aioe.org NNTP Server
Message-ID <onc96e$1vqj$1@gioia.aioe.org> (permalink)
References (5 earlier) <slrnopiu4a.o2q.avl@logic.at> <87ziaue74o.fsf@munus.decebal.nl> <87valie4xz.fsf@munus.decebal.nl> <onc3s5$1ns5$1@gioia.aioe.org> <87o9rae27u.fsf@munus.decebal.nl>

Show all headers | View raw


On 8/20/2017 10:35 AM, Cecil Westerhof wrote:
> Arne Vajhøj <arne@vajhoej.dk> writes:
> 
>> On 8/20/2017 9:36 AM, Cecil Westerhof wrote:
>>> Cecil Westerhof <Cecil@decebal.nl> writes:
>>>> Just to satisfy my curiosity I executed (I do not like the formatting,
>>>> but that is what Eclipse does):
>>>>       try (
>>>>               Statement stmt = conn.createStatement();
>>>>               ResultSet rsOne = stmt.executeQuery("SELECT 12 AS twelve");
>>>>               ResultSet rsTwo = stmt.executeQuery("SELECT 'Hello World!' AS message")
>>>>               ) {
>>>>           System.out.println(stmt);
>>>>           System.out.println(rsOne);
>>>>           System.out.println(rsTwo);
>>>>       }
>>>>
>>>> And this gives:
>>>>       org.sqlite.jdbc4.JDBC4Statement@685f4c2e
>>>>       org.sqlite.jdbc4.JDBC4ResultSet@7daf6ecc
>>>>       org.sqlite.jdbc4.JDBC4ResultSet@7daf6ecc
>>>>
>>>> So yes, it is like you said: the ResultSet is reused. Is also more
>>>> logical. I jumped to a conclusion.
>>>
>>> With a H2 database I get:
>>>       stat0
>>>       rs0: null
>>>       rs1: org.h2.result.LocalResult@1bc6a36e columns: 1 rows: 1 pos: -1
>>
>> That is what happens when you try and do unsupported things: you get
>> undefined/implementation specific behavior. Bad!
> 
> Nope, it shows that the H2 driver does follow the standards (and the
> SQLite3 driver does not). The first ResultSet is closed as it should
> be. You can do an isClosed on it. So it is not null, but displays a
> null to show you should not use it anymore.

The contract for toString is extremely vague.

I do not see any indication than SQLite does not follow
JDBC standard.

Reusing result set object should be perfectly valid
per JDBC standard.

And toString can practically return anything.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 19:40 +0200
  Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-19 21:44 +0200
    Re: Testing the functionality of sub classes Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-19 16:47 -0400
      Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 01:30 +0200
        Re: Testing the functionality of sub classes Andreas Leitgeb <avl@logic.at> - 2017-08-20 11:50 +0000
          Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 14:49 +0200
            Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 15:36 +0200
              Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 09:46 -0400
                Re: Testing the functionality of sub classes Andreas Leitgeb <avl@logic.at> - 2017-08-20 14:33 +0000
                Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 11:14 -0400
                Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 16:35 +0200
                Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 11:17 -0400
                Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 18:13 +0200
                Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 12:28 -0400
                Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 13:06 -0400
                Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 19:07 +0200
            Re: Testing the functionality of sub classes Arne Vajhøj <arne@vajhoej.dk> - 2017-08-20 11:21 -0400
              Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 18:17 +0200
          Re: Testing the functionality of sub classes v_borchert@despammed.com (Volker Borchert) - 2017-08-21 19:53 +0000
    Re: Testing the functionality of sub classes v_borchert@despammed.com (Volker Borchert) - 2017-08-19 21:15 +0000
      Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 01:36 +0200
    Re: Testing the functionality of sub classes Cecil Westerhof <Cecil@decebal.nl> - 2017-08-20 01:22 +0200

csiph-web