db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Question about DERBY-44 test case (paging Myrna)
Date Sat, 04 Feb 2006 17:49:31 GMT
Myrna van Lunteren <m.v.lunteren@gmail.com> writes:

> On 03 Feb 2006 22:30:46 +0100, Knut Anders Hatlen <Knut.Hatlen@sun.com>
> wrote:
> >
> > Hi,
> >
> > I have a question about a test case for DERBY-44 (which appears to
> > have been fixed by Myrna).
> >
> > In jdbcapi/parameterMetaDataJdbc30.java, I found this test case:
> >
> > // variation, and also test out empty string in the escape (jira 44).
> > System.out.println("variation 1, testing jira 44");
> > ps = con.prepareStatement("select * from sys.systables where tablename
> > like ? escape ?");
> > ps.setString (1, "SYS%");
> > ps.setString (2, "");
> > paramMetaData = ps.getParameterMetaData();
> > System.out.println("parameters count for prepared statement is " +
> > paramMetaData.getParameterCount());
> > dumpParameterMetaData(paramMetaData);
> > ps.execute();
> >
> > I wonder what the purpose of this test is. Is it to test that the
> > escape keyword is accepted by the SQL parser/compiler, or is it to
> > test that specifiying an empty escape string shouldn't cause
> > ps.execute() to fail?
> 
>  It was not at all clear, but after much digging through old tests and
> repros  ;-)
> it appears this test is trying to make sure ERROR 22019 is returned. At one
> point, passing on the empty string in a piece of code like this would
> generate an StringIndexOutOfBoundsException instead of ERROR 22019 on the
> ps.execute().

Thank you for doing the historical research! :)

It is ERROR 22019 I am seeing. Funny thing, though, that this error is
not expected in any of the frameworks.

I guess it's okay to replace the ps.execute() line with

  ResultSet rs = ps.executeQuery();
  rs.next();

so that we get ERROR 22019 in all frameworks. Hopefully, no one thinks
it's a problem that DerbyNetClient fails on execute() and embedded and
DerbyNet fail on next().

-- 
Knut Anders


Mime
View raw message