I am new to mysql so this may be an obvious mistake on my part...

I am using JDBC to acess some mysql data tables. I am having trouble with the following code:

Statement       s;
ResultSet               rset;
long            correctedclock;

s = conn.createStatement();
rset = s.executeQuery("Select min(correctedclock) from summaryhistory");

if (rset.next())
        correctedclock = rset.getLong(1) * CONVERSIONFACTOR;
else {
        s.close();
        return(null);
}

if (correctedclock == 0)
        FlushSummaryHistoryZeroTimes();


My problem is that the query returns apparently valid data even if the table is completely empty. As I understand it, rset.next() should return false if there no rows. On an empty table it doesn't. And after that, rset.getLong() successfully returns a 0 value. CorrectedClock is an Int field in the table, by the way.


The same code works on several other SQL databases, just not on mysql. Any idea as to what is wrong?

This is using mysql 4.0.16 on Mac OS X 10.3 server.


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to