Re: MySQL ResultSet - count rows?



Christoph <christoph.burschka@xxxxxxxxx> writes:

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?

No. You could execute 'SELECT COUNT(*) ...' first but then you
essentially traverse all the rows twice.

(There could be non-standard MySQL extensions that lets you do this, I
don't know)


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

--
dt

Questions about Derby/Java DB? Please visit
http://db.apache.org/derby/derby_mail.html
.



Relevant Pages

  • 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)
  • Re: MySQL ResultSet - count rows?
    ... I am writing the data of a ResultSet object to an array. ... To declare ... it may just iterate over the data too. ...
    (comp.lang.java.databases)
  • Re: MySQL ResultSet - count rows?
    ... I am writing the data of a ResultSet object to an array. ... To declare ... 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)
  • Dim lbl( ) As Label = New Label( ){...} vs Dim lbl( ) As Label = {...}
    ... I created an array of label controls like this: ... and was able to iterate through the array. ... another way to declare the same array: ...
    (microsoft.public.dotnet.languages.vb)