This topic is locked

Master/Details stop working in 3.1

10/3/2006 3:25:32 AM
PHPRunner General questions
C
carlosxl5 author

I've searched the forum and can't find this, apologies if it has already been posted.
Using master/detail relationships has stopped working with 3.1. When I click to go to the detail tabel there is an SQL error - "unknown column". Here is an example of the SQL generated:

[indent]

select opening_time_id, ot.object_id, open_date, opening_times_text, close_date, opening_times, renewable, web_link, conditions From opening_times ot where opening_times.object_id=287[/indent]
The problem is the mixed use of a correlation name (ot) and table name (opening_times). If you change the table name in the where clause to a correlation name then the SQL works fine. As below:

[indent]

select opening_time_id, ot.object_id, open_date, opening_times_text, close_date, opening_times, renewable, web_link, conditions From opening_times ot where ot.object_id=287[/indent]
This problem appears to happen with all master/detail relationships.

Thanks

Carlos

PS: Removed the single quotes from the queries just to make them easier to read, they make no difference.

J
Jane 10/3/2006

Carlos,
PHPRunner doesn't have automatic table alias support.
To make your pages working open include/commonfunction.php file, find GetFullFieldName function, locate following code:

if($table=="opening_times" && $field=="object_id")

return "`opening_times`.`object_id`";



and replace it with this one:

if($table=="opening_times" && $field=="object_id")

return "`op`.`object_id`";

C
carlosxl5 author 10/3/2006

Hi Jane
I'm not sure why I should have to change anything. I simply added a master/detail relationship using the drop down lists. I didn't change the SQL or add any code.
So the alias is being generated by phprunner not me. Surely it should generate code which is syntactically correct?
I will do the same thing with 3.0, just as a check.
Thanks

Carlos

J
Jane 10/3/2006

Carlos,
please zip and send to support@xlinesoft.com a full set of generated PHP files, your database creation script with sample data.

I'll find what's wrong with your project running it on my test box.

C
carlosxl5 author 10/3/2006

Thanks Jane,
However it turns out I was lying - sorry <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=11544&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
There had been a change to the SQL made many moons ago. Having gone back to try and get you the sample I found it. Having removed the edited SQL, it now works as advertised.
Sorry for wasting your time and thanks for the help.

Carlos

J
Jane 10/3/2006