Saving record with changed primary key

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

Saving record with changed primary key

Postby andperry » Mon Oct 04, 2010 3:58 am

I've recently upgraded from Xataface 1.1.5 to 1.2.5 on most of my databases. I have observed a problem with certain tables (but not all by any means). When trying to save a record with a change to the primary key, a page is generated with the following error message (and nothing else):-

Fatal error: Call to a member function hasJoinTable() on a non-object in D:\Users\Common\Documents\WebSite\Sites\All Sites\public_html\xataface-1.2.5\Dataface\FormTool.php on line 930

It is possible to return to the table listing by clicking the browser Back button twice and the record does actually get updated.

Tried it with intermediate Xataface versions - 1.2.1 and 1.2.2 work OK, was not able to try 1.2.3 or 1.2.4.

Any ideas? Thanks.

Andrew Perry.
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK

Re: Saving record with changed primary key

Postby shannah » Wed Oct 06, 2010 11:23 am

This is very strange. The error complains of a Dataface_Record object without a table referenced... which should never happen.
Can you identify any key differences between the tables that fail and the tables that succeed?

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Saving record with changed primary key

Postby andperry » Mon Oct 18, 2010 1:33 pm

Hi Steve,

Thanks for the reply. I've tried to investigate it a bit further and so far not come to any definite conclusion. My observations however suggest that the problem may apply per database rather than per table. I've attched a ZIP archive containing a couple of 'mysqldump' SQL dumps, one from a 'good' database and one from a 'bad' database (each saved with just the structure and no data).

web46-lcf-main - This database does not manifest the problem.
web46-lcf-mp3 - This database manifests the problem.

Hope this information is of some use.

Thanks,

Andrew.
Attachments
Databases.zip
(4 KiB) Downloaded 614 times
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK

Re: Saving record with changed primary key

Postby shannah » Mon Oct 18, 2010 3:19 pm

The sql readouts alone aren't going to be very informative. This problem appears to be a PHP problem so it will have been introduced probably in one of the config files or custom PHP code.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Saving record with changed primary key

Postby andperry » Wed Oct 20, 2010 1:43 am

Hi Steve,

Thanks for the reply. I've done a bit more investigation and still seem to be none the wiser. Here are some observations:-

1) I'm not so sure now that it relates to specific databases or even to later versions of Xataface as originally suggested. The problem seems to be more "across the board" than I had previously realised. The main reason why some tables don't give the problem is simply because in these cases the 'afterSave' function loads a new page by calling the PHP 'header' function followed by an 'exit' statement (e.g. to return to the table listing instead of staying in the saved record screen). The record is updated OK and everything looks OK to the user, but actually if you click the browser 'back' button you can still see the page with the error message.

2) With reference to the previous paragraph, I'm quite sure that I would be able to code appropriate workarounds for all databases/tables, and this might have to be the course of action in the short term. It still however doesn't change the fact that there is an underlying problem, which obviously makes such a solution less than ideal.

3) I've tried one of my databases with a Xataface application stripped down to the bare minimum of a 4-line index.php plus a very basic conf.ini and the problem still occurs.

4) The PHP/MySQL versions in use are as follows:-
Local Host (Windows) - PHP 5.2.11, MySQL 5.1.44
Online (Unix) - PHP 5.2.14, MySQL 5.1.48

Any further ideas/suggestions would be appreciated.

Regards,

Andrew.
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK

Re: Saving record with changed primary key

Postby pkennedy » Tue Oct 02, 2012 4:06 pm

Sorry to dredge up an old topic, but I'm getting this same Fatal error when updating a primary key. Whatever the issue is, it also seems to break the Ajax inline editing. Any recent solutions to this?

Thanks!
Patrick
pkennedy
 
Posts: 10
Joined: Tue Oct 02, 2012 3:05 am

Re: Saving record with changed primary key

Postby shannah » Tue Oct 02, 2012 6:18 pm

Can you post your issue as a new topic. I doubt the error is actually the same as this is quite an old issue - one that has been fixed. In your post, please include your Xataface version, and any relevant information like error messages etc...

_Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Saving record with changed primary key

Postby andperry » Wed Oct 03, 2012 12:49 am

I have just posted a new topic as requested (6958).

Andrew.
andperry
 
Posts: 57
Joined: Wed Feb 18, 2009 9:20 am
Location: Wirral, UK


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 25 guests

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