SQL error after adding column
Archived from the Xataface Users forum.
thedesignedge — Sat Dec 29, 2012 5:02 pm
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.Testfromdataface\_\_view\_68c8624cdad67c07b2262817d9cdcfc1ascrewqualificationswhereCrewID= ‘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?
shannah — Wed Jan 02, 2013 9:58 am
This is due to one of 3 things:
- Xataface still has the view cached from the previous table definition. Try deleting all of the views named dataface_view__xxxx.
- APC is turned on and has the old table structure cached. Try adding &–refresh-apc=1 to the URL to refresh it.
- There is an error in the SQL query that you provided.
-Steve