It seems the hits() method is not working for do_query(), update(), modify() methods!
Only the rows() method works for update().
Do the following with do_query():
my $hits = $links_db->hits;
my $rows = $links_sth->rows; # will result error Unknown method 'rows'The result of $hits will be 0, even if there was a lot hits.
hits() not working. rows() not available, error.
It seems do_query result number can not counted at all.
A workaround would be to create a condition obkect with same where clause, and then count with $links_db->count ($cond); But this means an additional, unnecessary query.
Do the following with update():
my $links_sth = $links_db->update ( {"col" => 1}, $cond1);
my $hits = $links_db->hits;
my $rows = $links_sth->rows;The result of $hits will be 0, even if there was a lot hits. $rows has correct result.
hits() not working. rows() works.
Did not test modify(), but very likely will get the same result as update().
hits() method reads the hits number from $self->{last_hits}.
Final conclusion is: do_query(), update(), modify() are not updating the $self->{last_hits}, therefore the hits() method can not read the hits number from it.
Would be fine to correct these bugs (if are bugs) in GT::SQL::Table module!
I checked the GT::SQL::Table module (Table.pm v1.220), which is used in LSQL v2.1.2, and GCommunity v0.9.0 and this feature is still not missing.
IMHO, hits() should be added (corrected?) to before the final release of GCommunity (of course you know, if it fits the time until final release or not).
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Only the rows() method works for update().
Do the following with do_query():
Code:
my $links_sth = $links_db->do_query("UPDATE apro_links SET col = 1 WHERE col IS NULL); my $hits = $links_db->hits;
my $rows = $links_sth->rows; # will result error Unknown method 'rows'
hits() not working. rows() not available, error.
It seems do_query result number can not counted at all.
A workaround would be to create a condition obkect with same where clause, and then count with $links_db->count ($cond); But this means an additional, unnecessary query.
Do the following with update():
Code:
my $cond1 = GT::SQL::Condition->new( "col", 'IS', \'NULL' ); my $links_sth = $links_db->update ( {"col" => 1}, $cond1);
my $hits = $links_db->hits;
my $rows = $links_sth->rows;
hits() not working. rows() works.
Did not test modify(), but very likely will get the same result as update().
hits() method reads the hits number from $self->{last_hits}.
Final conclusion is: do_query(), update(), modify() are not updating the $self->{last_hits}, therefore the hits() method can not read the hits number from it.
Would be fine to correct these bugs (if are bugs) in GT::SQL::Table module!
I checked the GT::SQL::Table module (Table.pm v1.220), which is used in LSQL v2.1.2, and GCommunity v0.9.0 and this feature is still not missing.
IMHO, hits() should be added (corrected?) to before the final release of GCommunity (of course you know, if it fits the time until final release or not).
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...