Re: MySQL ResultSet - count rows?



On Dec 10, 10:45 am, Sabine Dinis Blochberger <no.s...@xxxxxxxxxxxx>
wrote:
Christoph wrote:
Hello,

I am writing the data of a ResultSet object to an array. To declare
the array length, I need to know the number of rows before copying
them - is there a way to read the row count instantly, without having
to iterate anything?

PHP has mysql_count_rows, but I'm not sure what that does internally -
it may just iterate over the data too.

There is a SQL statement to the effect: select count(*) from tablename
Look it up to see if it can be optimized.
--
Sabine Dinis Blochberger

Op3racionalwww.op3racional.eu

Thanks. Right now I'm looping over result.next, but I'll try sending a
COUNT() query to compare speeds.
.



Relevant Pages

  • Re: MySQL ResultSet - count rows?
    ... the array length, I need to know the number of rows before copying ... it may just iterate over the data too. ... So in that sense PHP and JDBC are identical. ...
    (comp.lang.java.databases)
  • Re: MySQL ResultSet - count rows?
    ... the array length, I need to know the number of rows before copying ... it may just iterate over the data too. ... At least incrementing the pointer is not a very expensive action. ...
    (comp.lang.java.databases)
  • Re: MySQL ResultSet - count rows?
    ... I am writing the data of a ResultSet object to an array. ... I need to know the number of rows before copying ... it may just iterate over the data too. ...
    (comp.lang.java.databases)
  • MySQL ResultSet - count rows?
    ... I am writing the data of a ResultSet object to an array. ... To declare ... I need to know the number of rows before copying ... it may just iterate over the data too. ...
    (comp.lang.java.databases)
  • Re: Problem with copied array
    ... Lew wrote: ... Sabine Dinis Blochberger wrote: ... that array is a reference to a double. ... This will still copy references to 'double '. ...
    (comp.lang.java.programmer)