Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!

Quote Reply
hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
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():
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'
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():
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;
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...
Subject Author Views Date
Thread hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table! webmaster33 4104 Feb 11, 2003, 12:51 PM
Post Re: [webmaster33] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
pugdog 3984 Feb 12, 2003, 7:34 AM
Thread Re: [webmaster33] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
Alex 4014 Feb 13, 2003, 3:48 PM
Post Re: [Alex] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
webmaster33 4001 Feb 13, 2003, 7:16 PM
Thread Re: [Alex] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
Andy 4054 Feb 25, 2003, 7:35 AM
Thread Re: [Andy] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
Paul 3946 Feb 25, 2003, 7:48 AM
Thread Re: [Paul] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
Andy 3981 Feb 25, 2003, 7:50 AM
Post Re: [Andy] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
Paul 3954 Feb 25, 2003, 7:51 AM
Post Re: [Andy] hits() method NOT working for do_query(), update(), modify() methods in GT::SQL::Table!
webmaster33 3930 Feb 25, 2003, 11:53 AM