I'm playing with sqlpersist, and I came across some code that seems odd
to me (smells of C).

The SQLResult class has a countRows() method, and a getNextRow() method.
  This strikes me as a badly-written iterator.

Typical code that uses it (from sqlpersist.cc):
    for(int i = 0; i < r->countRows(); i++) {
        SQLRow* row = r->getNextRow();
        ...
        delete row;
    }
    delete r;

Yup, sounds like a job for an iterator to me.

Besides, some database engines -- notably sqlite -- don't implement
something like countRows(); an hypothetical sqlitepersist would have to
fetch all rows, store the number on a member, and reset the statement...
probably all in a database lock, otherwise the row count could increase
between calls.

best,
                                               Lalo Martins
--
      So many of our dreams at first seem impossible,
       then they seem improbable, and then, when we
       summon the will, they soon become inevitable.
--
http://www.laranja.org/          mailto:[EMAIL PROTECTED]
GNU: never give up freedom                 http://www.gnu.org/


_______________________________________________
vos-d mailing list
vos-d@interreality.org
http://www.interreality.org/cgi-bin/mailman/listinfo/vos-d

Reply via email to