|
|
| <prev next> |
Choosing A Webhost: |
Re: COUNT(*) in PreparedStatement?: msg#00035java.hsqldb.user
I was quite surprised by this, so modified one of our tests to duplicate it. However, it works fine, with no error. Fred public void testBinds2() { try { PreparedStatement pstmt = connection.prepareStatement("drop table test if exists"); pstmt.execute(); pstmt = connection.prepareStatement("create table test (id integer, txt varchar(10))"); pstmt.execute(); pstmt = connection.prepareStatement("insert into test values (10, 'hello')"); pstmt.execute(); pstmt = connection.prepareStatement("select txt from test where id = ?"); pstmt.setInt(1, 10); pstmt.execute(); ResultSet rs = pstmt.getResultSet(); rs.next(); String value = rs.getString(1); assertEquals("hello", value); pstmt = connection.prepareStatement("select count(*) from test where id = ?"); pstmt.setInt(1, 10); pstmt.execute(); rs = pstmt.getResultSet(); rs.next(); int count = rs.getInt(1); assertEquals(1, count); } catch (SQLException e) { e.printStackTrace(); System.out.println("TestSql.testBinds() error: " + e.getMessage()); } } ----- Original Message ----- From: "Dimitri Maziuk" <dmaziuk@xxxxxxxxxxxxx> To: "HSQLdb user discussions" <hsqldb-user@xxxxxxxxxxxxxxxxxxxxx> Sent: 01 May 2007 00:10 Subject: Re: [Hsqldb-user] COUNT(*) in PreparedStatement? On Monday 30 April 2007, Lorna Burnet wrote: > > I'll assume this is against 1.8.0.7 unless you response otherwise. Yes, it is 1.8.0.7. An additional note: SELECT COUNT(ID) FROM FOO WHERE BAR=? throws the same exception. Dima -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Hsqldb-user mailing list Hsqldb-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: COUNT(*) in PreparedStatement?, Thomas Kellerer |
|---|---|
| Previous by Thread: | Re: COUNT(*) in PreparedStatement?, Dimitri Maziuk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |