5 messages in com.mysql.lists.javaRe: first() bug?
FromSent OnAttachments
John Bäckstrand08 Sep 2002 02:59 
Igor Fedulov08 Sep 2002 03:04 
John Bäckstrand08 Sep 2002 03:11 
Igor Fedulov08 Sep 2002 03:26 
Luca Lafranchi08 Sep 2002 04:15 
Subject:Re: first() bug?
From:Luca Lafranchi (llaf@gmx.ch)
Date:09/08/2002 04:15:11 AM
List:com.mysql.lists.java

Hi John :)

The java docs says that the first() method in java.sql.ResultSet should set the pointer to "before" the first row.

FALSE!! Read this: http://java.sun.com/j2se/1.4/docs/api/java/sql/ResultSet.html#first()

You can read: "Moves the cursor TO THE FIRST row in this ResultSet object."

And further:

"Returns : true if the cursor is ON A VALID ROW; false if there are no rows in the result set"

So your code (and the driver) works as expected.

If you want to set the cursor before the first row, you must use java.sql.ResultSet.beforeFirst().

Ciao Luca