Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » RADICORE Installation Issues » Existing data do not show up in LIST2
Re: Existing data do not show up in LIST2 [message #1085 is a reply to message #1084] Tue, 04 September 2007 23:16 Go to previous messageGo to previous message
bbkwon is currently offline  bbkwon
Messages: 13
Registered: August 2007
Junior Member
I did sql trace and found this.

SELECT SQL_CALC_FOUND_ROWS * FROM course WHERE ( id='1' ) LIMIT 1 OFFSET 0 =>Count=1
SELECT SQL_CALC_FOUND_ROWS golfround.*, course.id FROM golfround LEFT JOIN course ON (course.id=golfround.courseid) WHERE golfround.id='1' LIMIT 25 OFFSET 0 =>Count=1

'course' is parent and 'golfround' is child.
What make me puzzled is 'golfround.id='1'.
It is supposed to be 'golfround.courseid='1'.

Here is a part of child tables dict.inc file.
// parent relationship details
$this->parent_relations[]= array('parent' => 'course',
'parent_field' => 'name',
'fields' => array('courseid' => 'id'));

I believe what it says is that 'courseid' field on child table is linked to 'id' field on parent.
It looks like the problem happens because Radicore uses field 'id' instead of field 'courseid' when it compose SQL above.
It may assumes the name of the parent's primary key is the same as child's foreign key. In this case, 'id'.

I'm pretty sure this is what is happening.
I have changed the name of primary key of the parent from 'id' to 'courseid' and LIST2 shows up correctly. And the SQL gets corrected to 'golfround.courseid='1'.

Is this what Radicore is written as?
I think it can/should get the name of the child's foreign key field by looking into the 'parent relationship details' info section in dict.inc file.
If I want Radicore take the child's field name instead of parent's, which file do I need to change?


Thanks
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 'Build Directory' is not working!
Next Topic: PROBLEM AT LOGIN PAGE
Goto Forum:
  


Current Time: Mon Dec 23 00:52:17 EST 2024

Total time taken to generate the page: 0.01008 seconds