ASF Bugzilla – Attachment 10555 Details for
Bug 26863
error in ResultSetTag if ResultSet is empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
JSP page that reproduces the error (must have hsqldb.jar on WEB-INF/lib)
bug26863.jsp (text/plain), 1.83 KB, created by
Felipe Leme
on 2004-02-25 22:37:06 UTC
(
hide
)
Description:
JSP page that reproduces the error (must have hsqldb.jar on WEB-INF/lib)
Filename:
MIME Type:
Creator:
Felipe Leme
Created:
2004-02-25 22:37:06 UTC
Size:
1.83 KB
patch
obsolete
><%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %> > ><%@ page import="java.sql.*" %> > ><%! >private static final String[] QUERIES = new String[] { > "CREATE TABLE USERS(ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(10) NOT NULL)", > "INSERT INTO USERS VALUES(1,'Felipe')", > "INSERT INTO USERS VALUES(2,'Pierre')", > "INSERT INTO USERS VALUES(3,'Martin')" > }; > >%> > ><% > >String jdbcUri = "jdbc:hsqldb:."; >String jdbcDriverclass = "org.hsqldb.jdbcDriver"; >String jdbcUsername = "sa"; >String jdbcPassword = ""; > > >Class.forName(jdbcDriverclass); >Connection conn = DriverManager.getConnection(jdbcUri, jdbcUsername, jdbcPassword); > >Statement stmt = conn.createStatement(); >String query=null; > >for ( int i=0; i<QUERIES.length; i++ ) { > query = QUERIES[i]; > out.print("executing query " + query + ": "); > stmt.executeQuery( query ); > out.println( " OK<br>" ); >} > >PreparedStatement pstmt = conn.prepareStatement( "SELECT id, name FROM USERS" ); >ResultSet searchResults = pstmt.executeQuery(); >request.setAttribute("searchResults", searchResults); >%> > >All names:<br> > ><sql:resultSet id="rs1" name="searchResults" scope="request"> > <sql:getColumn colName="name"/><br> ></sql:resultSet> > ><% >pstmt = conn.prepareStatement( "SELECT id, name FROM USERS where id=4" ); >searchResults = pstmt.executeQuery(); >request.setAttribute("searchResults", searchResults); >%> > >Name for id 4: should be empty<br> > ><sql:resultSet id="rs1" name="searchResults" scope="request"> > <sql:getColumn colName="name"/><br> ></sql:resultSet> > ><% >pstmt = conn.prepareStatement( "SELECT id, name FROM USERS where id=1" ); >searchResults = pstmt.executeQuery(); >request.setAttribute("searchResults", searchResults); >%> > >Name for id 1: should be Felipe<br> > ><sql:resultSet id="rs1" name="searchResults" scope="request"> > <sql:getColumn colName="name"/><br> ></sql:resultSet>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 26863
: 10555 |
10556
|
10557