andbin
06-03-2006, 14:33
Sto iniziando ad usare JDBC (con db MySQL). C'è una cosa che non ho capito: come ottenere il numero di righe in un ResultSet.
In PHP in genere faccio una cosa del genere:
...
$result = mysql_query("SELECT ....", $link);
if ($result !== FALSE)
{
$num_rows = mysql_num_rows($result);
....
}
In Java si usa:
...
Statement stmt = conn.createStatement ();
ResultSet rs = stmt.executeQuery ("SELECT ....");
Ma non ho trovato alcun metodo per sapere il numero di righe nel ResultSet. Ho visto male io o proprio non è possibile? :stordita:
In PHP in genere faccio una cosa del genere:
...
$result = mysql_query("SELECT ....", $link);
if ($result !== FALSE)
{
$num_rows = mysql_num_rows($result);
....
}
In Java si usa:
...
Statement stmt = conn.createStatement ();
ResultSet rs = stmt.executeQuery ("SELECT ....");
Ma non ho trovato alcun metodo per sapere il numero di righe nel ResultSet. Ho visto male io o proprio non è possibile? :stordita: