-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Randall Cayford wrote:
> JDBC driver: mysql-connector-java-3.0.11-stable-bin.jar
>
>
> Randall Cayford wrote:
>
>>>> 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");
Randall,
Because you are issuing a select with a 'min' query, you will always
have a row returned, even on an empty table, because min() is an
aggregate function.
The value will be 'null' in this case, but JDBC can't return 'null' from
a getLong(), you have to check ResultSet.wasNull() _after_ asking for
the value as a long.
I'm curious as to what other databases did this 'correctly', because if
you're following the SQL Standard, you will always have a result
returned from an aggregate function like min() :)
Regards,
-Mark
- --
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
Meet the MySQL Team! April 14-16, 2004 http://www.mysql.com/uc2004/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFATjqutvXNTca6JD8RAlEGAJ4sjwtXb/o5g/4Nqgxas1sifmFiAgCgxTk3
sRnGubw4shfsVdoFrhCuqUo=
=HxkM
-----END PGP SIGNATURE-----
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]