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

Not finding the record... but its there?

Quote Reply
Not finding the record... but its there?
Man... this one really has me stumped :/

Code:
SELECT COUNT(*) FROM sp_Links WHERE ID = '106855'

...gives;

Quote:
Your query returned 1 rows.

1

Yet;

Code:
my $chk = $DB->table('Links')->select( ['COUNT(*)'],{ ID => $property_id } )->fetchrow;

...and;

Code:
my $chk = $DB->table('Links')->count( { ID => $property_id } );

...both give me "0".

Anyone got any ideas? Unimpressed Am I just being stupid somewhere? :-/

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
BTW.. the $DB->table('Links')->count() call gives me this;

SELECT COUNT(*) FROM sp_Links WHERE (ID = '106518')

(with debugging turned on)

Running this in MySQLMonitor works *fine* ... whats going on!!!!!

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
Did you notice that
ID = '106855'
ID = '106518'
is not the same? Wink

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...
Quote Reply
Re: [webmaster33] Not finding the record... but its there? In reply to
Yeah, they were example's ;-)

The point is still that it won't find them... the number will simply be replaced with $id ... so that is irrespectable of the problem.

I thought it may be to do with the .def files being un-synced, but they look ok. Really confusing me Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
There may be 1 reason why this is not working:
When you execute an SQL query, it executes directly on database.

But LSQL is using a cached table structure, AKA .def files:
$DB->table('Links')->count( { ID => $property_id } );
So if .def files are not synchronized with database, may be possible that you get no result.
Did you try to synchronize with database?
Also maybe a Repair would be also a good idea.

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...
Quote Reply
Re: [webmaster33] Not finding the record... but its there? In reply to
Already tried both of those :/

Quote:
Started at Wed Sep 29 05:46:47 2004.

Checking category stats ...
Done (0.23 s)

Resetting hits and rates ...
Done (0.02 s)

Checking for orphan links ...
Done (0.00 s)

Updating New Flags ...
Done (0.88 s)

Updating Changed Flags ...
Done (0.01 s)

Updating Cool Flags ...
Done (0.01 s)

All done. Total Time: (1.23 s)

...and the .def's are fine....

However, when running:

Quote:
Unlisted hotel... skipping...(108501, 0)
GT::SQL::Driver::MYSQL::sth (6787): Executing query: SELECT COUNT(*) FROM sp_Links WHERE (ID = '108502') from at xml_desc.cgi line 31

...which basically means its not finding the ID 108501 Unimpressed

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
When I had absolutely no idea, what's happening, I'm tracking down where the problem is.
Do debugging and go as deep you need to go, even into core code.
You will find then where the problem was...

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...
Quote Reply
Re: [webmaster33] Not finding the record... but its there? In reply to
Yeah... I'm going to have to :(

Thanks anyway :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
hey andy - have you tried passing it in as a condition and see if that works? ie... GT::SQL::Condition->new( ... ). Might be worth a test.
Quote Reply
Re: [ryel01] Not finding the record... but its there? In reply to
Yeah, sure did :(

I ended up using this (which seems to work);

Code:
my $cond = GT::SQL::Condition->new('ID','=',$property_id);
my $chk = $DB->table('Links')->select( ['COUNT(*)'], $cond ) || die $GT::SQL::error;

Problem is... that I don't think that will work as its meant to with PostGres or MSSQL Unimpressed

I don't see why a basic "count" doesn't work :/ I may have to try a fresh install, and then resetup the plugins. The SQL queries seem to be getting setup correctly (by turning debugging on) ... but the update never seems to happen Pirate

Anyway.. guess I better keep looking into it.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Not finding the record... but its there? In reply to
I think I ran into the same problem (from memory... it's been a few weeks) and just ended up using the separate conditions too. Will keep an eye out to see if you find the reason why! Wink

regan
Quote Reply
Re: [ryel01] Not finding the record... but its there? In reply to
Man.. this is *REALLY* doing my head in :(

GT::SQL::Driver::MYSQL::sth (21907): Executing query: SELECT * FROM sp_Links WHERE ID = '106832' from at xml_desc.cgi line 42
Title: . ID: for ASHBURY HOTEL & SUITES (106832)
GT::SQL::Driver::MYSQL::sth (21907): Executing query: SELECT * FROM sp_Links WHERE ID = '106837' from at xml_desc.cgi line 42
Title: . ID: for RAMADA INN (106837)


...and if you run this command from MySQLMonitor;

SELECT ID,Title FROM sp_Links WHERE ID = '106832'

... you get;

106832 ASHBURY HOTEL & SUITES

... so it should look like;

Title: .ASHBURY HOTEL & SUITES ID: 106832 for ASHBURY HOTEL & SUITES (106832)

GT? Pirate

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!