SQL error after adding column

A place for users and developers of the Xataface to discuss and receive support.

SQL error after adding column

Postby 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`.`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?
thedesignedge
 
Posts: 4
Joined: Wed Sep 26, 2012 10:27 am

Re: SQL error after adding column

Postby shannah » Wed Jan 02, 2013 9:58 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 17 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved