Page 1 of 1

SQL error after adding column

PostPosted: Sat Dec 29, 2012 5:02 pm
by thedesignedge
I begin with a Crew record that has related record of CrewQualification on the column of CrewID.

I have a delegate class in crewqualifications.php as follows.
Code: Select all
<?php
class tables_crewqualifications {
   function __sql__(){
      return "select cq.*, c.CrewName from  crewqualifications cq
   left join crews c on cq.CrewID=c.CrewID"
   ;}
}
?>


The above simply allows me to have see a Crew Name so I don't have to use a CrewID. It works. Simple.

Then, I add a column of "Test" to CrewQualifications and I get the following error in its entirety.

Fatal error: Uncaught exception 'Exception' with message 'Unknown column 'crewqualifications.Test' in 'field list'Error loading related records for relationship 'Qualifications' in table 'crews'. There was a problem performing the sql query 'select `crewqualifications`.`CrewID`, `crewqualifications`.`CrewName`, `crewqualifications`.`Maintenance`, `crewqualifications`.`Repairs`, `crewqualifications`.`Construction`, `crewqualifications`.`Inspections`, `crewqualifications`.`Labor`, `crewqualifications`.`Supplier`, `crewqualifications`.`Industries`, `crewqualifications`.`Test` from `dataface__view_68c8624cdad67c07b2262817d9cdcfc1` as `crewqualifications` where `CrewID` = 'crew-000003' LIMIT 0,30'. The Mysql error returned was 'Unknown column 'crewqualifications.Test' in 'field list''
' in /var/www/office.alacarte/dataface/Dataface/Record.php:706 Stack trace: #0 /var/www/office.alacarte/dataface/Dataface/Record.php(935): Dataface_Record->_loadRelatedRecordBlock('Qualifications', 0, 0, 0) #1 /var/www/office.alacarte/datafa in /var/www/office.alacarte/dataface/Dataface/Record.php on line 706


Renaming the delegate class makes the error (and the effects of the delegate class) go away. I'm confused as to why adding a column causes this error? Any ideas as to where to look or why its doing it?

Re: SQL error after adding column

PostPosted: Wed Jan 02, 2013 9:58 am
by shannah
This is due to one of 3 things:

1. Xataface still has the view cached from the previous table definition. Try deleting all of the views named dataface_view__xxxx.
2. APC is turned on and has the old table structure cached. Try adding &--refresh-apc=1 to the URL to refresh it.
3. There is an error in the SQL query that you provided.

-Steve