Gossamer Forum
Quote Reply
SQL Error
Greetings Everyone,

While validating some links - trying to delete one actually during validation I get the following error (which I've never seen before)...

Code:
GT::SQL::Table (2038): The 'glinks_Changes' table has a relationship with the 'glinks_Links_Files' table, but the foreign key information from the 'glinks_Changes' table is missing. at GT::SQL::File::delete_records line 288.
Anyone got any ideas what this means?

Thanks in advance,


Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Hi,

Try doing a "Re-Sync" with the "Changes" table and see if that helps. That last bug I fixed for you, was the missing .def file for the Links_Files table... so maybe that wasn't the only file that got missed/changed

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] SQL Error In reply to
Hi Andy,

There is a changes.def in the directory.

Not sure how to do a resync of the Changes table. I've only ever done it from the 'database' 'links' 'properties' option with the resync button at the foot of the page. Is there a better way of doing it?

Thanks


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Hi,

A simple way to do it, is to just right click the "Re-Sync" link (for the "Category", "Links" or "Reviews" table) ... and then change the db=Links (or whatever) to db=Changes

That should do 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] SQL Error In reply to
Thanks Andy,

gave that a go and still getting the same error. the changes.def file exists and it was updated.

Would it have something to do with:

foreign key information from the 'glinks_Changes' table is missingpart of the error?

I note that there is no foreign key information contained in the Changes.def file.

Very strange ....

Thanks again,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Hi,

Try pasting this into it (this is from one of my installs, which is working fine);

Code:
# Database definition file for 'glinks_Changes' table
{
'ai' => '',
'cols' => {
'LinkID' => {
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '1',
'regex' => '^\d+$',
'type' => 'INT',
'unsigned' => '1'
},
'Username' => {
'default' => 'admin',
'form_size' => '20',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '2',
'size' => '50',
'type' => 'CHAR'
},
'ChgRequest' => {
'form_size' => '30',
'form_type' => 'TEXTAREA',
'pos' => '3',
'type' => 'TEXT'
},
'Timestmp' => {
'form_size' => '20',
'form_type' => 'DATE',
'pos' => '4',
'type' => 'TIMESTAMP'
}
},
'fk' => {
'glinks_Links' => {
'LinkID' => 'ID'
},
'glinks_Users' => {
'Username' => 'Username'
}
},
'fk_tables' => [],
'index' => {},
'pk' => [],
'subclass' => {},
'unique' => {}
};

# vim:syn=perl:ts=4:noet

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] SQL Error In reply to
Thanks Andy,

gave that a go ... still the same error. This is a new error that I am getting since the glinks_Links_Files.def was added. Whilst the file attachments are certainly working now.........

Thanks again,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Mmm, afraid I'm out of ideas then. Maybe worth emailing GT, to see if they have any ideas?

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] SQL Error In reply to
Thanks anyway Andy,

I've sent a request off to GT for help. When I delete the Links_Files.def I can actually delete the links but of course that then screws up my file attachments.

All the best,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Andy] SQL Error In reply to
Hmm ...

emailed GT - no ideas other than charging $150 for the first hour just to have a look..... (likely to take 2 hours+).

Looks like a fresh install when I get a chance.


Regards,

Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Mmmm huh?

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: [Clint] SQL Error In reply to
Check that your [prefix]Links.def has a fk_tables entry to [prefix]Changes.

Adrian
Quote Reply
Re: [brewt] SQL Error In reply to
Thanks Adrian,

Here is the relevant section:-

Code:
'fk_tables' => [
'glinks_Changes',
'glinks_Reviews',
'glinks_CatLinks',
'glinks_Verify',
'glinks_Payments',
'glinks_Bookmark_Links',
'glinks_ClaimLink',
'glinks_ESDaily',
'glinks_ESMonthly'
],
which would appear to be okay. Should there be one for glinks_Links_Files ? (only a guess here!!)

Thanks for the suggestion I appreciate it.

Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Nope. The error happens when glinks_Links.def has:
Code:
'fk_tables' => [
...
'glinks_Changes',
...
],
but glinks_Changes.def doesn't have:
Code:
'fk' => {
'glinks_Links' => {
'LinkID' => 'ID'
},
...
},
And of course make sure the prefixes are correct.

Adrian
Quote Reply
Re: [brewt] SQL Error In reply to
Hi Adrian,

thanks for you ongoing help with trying to resolve this. Here is my complete glinks_Changes.def file which already appears to have the section you suggested.

Code:
'ai' => '',
'cols' => {
'LinkID' => {
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '1',
'regex' => '^\d+$',
'type' => 'INT',
'unsigned' => '1'
},
'Username' => {
'default' => 'admin',
'form_size' => '20',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '2',
'size' => '50',
'type' => 'CHAR'
},
'ChgRequest' => {
'form_size' => '30',
'form_type' => 'TEXTAREA',
'pos' => '3',
'type' => 'LONGTEXT'
},
'Timestmp' => {
'default' => 'CURRENT_TIMESTAMP',
'form_size' => '20',
'form_type' => 'DATE',
'pos' => '4',
'type' => 'TIMESTAMP'
}
},
'fk' => {
'glinks_Links' => {
'LinkID' => 'ID'
},
'glinks_Users' => {
'Username' => 'Username'
}
},
'fk_tables' => [],
'index' => {},
'pk' => [],
'search_driver' => 'NONINDEXED',
'subclass' => {
'html' => {},
'table' => {}
},
'unique' => {}
};
The funny thing about all of this is if glinks_Links_Files.def does not exist then there is no error in deleting the submitted unevaluated links, but then of course my file attachments don't work.

Thanks again,

Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Your glinks_Links_Files.def must be wrong then. What does that look like?

Adrian
Quote Reply
Re: [brewt] SQL Error In reply to
Thanks Adrian,

Here it is:-

Code:
{
'ai' => 'ID',
'cols' => {
'ID' => {
'form_display' => 'ID',
'form_size' => '10',
'form_type' => 'TEXT',
'not_null' => '1',
'pos' => '1',
'regex' => '^\d+$',
'type' => 'INT',
'unsigned' => '1'
},
'ForeignColName' => {
'pos' => '2',
'size' => '50',
'type' => 'VARCHAR'
},
'ForeignColKey' => {
'pos' => '3',
'size' => '50',
'type' => 'VARCHAR'
},
'File_Name' => {
'pos' => '4',
'size' => '255',
'type' => 'VARCHAR'
},
'File_Directory' => {
'pos' => '5',
'size' => '255',
'type' => 'VARCHAR'
},
'File_MimeType' => {
'pos' => '6',
'size' => '50',
'type' => 'VARCHAR'
},
'File_Size' => {
'pos' => '7',
'type' => 'INT',
'unsigned' => '1'
},
'File_URL' => {
'pos' => '8',
'size' => '255',
'type' => 'VARCHAR'
}
},
'fk' => {
'glinks_Users' => {
'LinkOwner' => 'Username'
}
},
'fk_tables' => [
'glinks_Changes',
'glinks_Reviews',
'glinks_CatLinks',
'glinks_Verify',
'glinks_Payments',
'glinks_Bookmark_Links',
'glinks_ClaimLink',
'glinks_ESDaily',
'glinks_ESMonthly'
],
'index' => {
'fk_lookup' => [
'ForeignColName',
'ForeignColKey'
]
},
'pk' => [
'ID'
],
'search_driver' => 'NONINDEXED',
'subclass' => {
'html' => {
'glinks_Links' => 'Links::HTML::Links'
},
'relation' => {},
'table' => {
'glinks_Links' => 'Links::Table::Links'
}
},
'unique' => {}
};
Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] SQL Error In reply to
Erm, that looks wrong. Links_Files.def shouldn't have any foreign keys. That bit should look like:
Code:
'fk' => {},
'fk_tables' => [],
'index' => {
'fk_lookup' => [
'ForeignColName',
'ForeignColKey'
]
},
'pk' => [
'ID'
],
'subclass' => {},
'unique' => {}

Adrian
Quote Reply
Re: [brewt] SQL Error In reply to
Thanks Adrian,

I'll give that a try.

Your help with this is greatly appreciated.

Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory