Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Subform never completes save

Post Reply
EcoReality
Posts: 26
Joined: Wed Feb 15, 2017 8:50 am
Location: Salt Spring Island, British Columbia, Canada
Contact:

Subform never completes save

Unread post by EcoReality »

I have a subform that never completes a save; it just shows the "blip" animated GIF forever. I go look at the table via another tool (Sequel Pro), and it does not change.

The last thing I did was change two of the subform fields from TINYINT(3) to FLOAT. I then went to those objects in nuBuilder and changed the format to blank from "10000".

This table also has two ENUM fields, and they were behaving badly until I removed the first bar ("|") from the "Dropdown --> SQL" field in the object editor.

I have not messed with table or field names.

What are some reasons a subform might get stuck and never complete a save?
:::: Jan Steinman EcoReality Co-op ::::
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform never completes save

Unread post by admin »

Jan,

You may need to look at apache's php error log.

Steven
EcoReality
Posts: 26
Joined: Wed Feb 15, 2017 8:50 am
Location: Salt Spring Island, British Columbia, Canada
Contact:

Re: Subform never completes save

Unread post by EcoReality »

Good idea.

When I try to save, I get:

Code: Select all

[Wed Feb 22 22:37:11 2017] [error] [client 10.1.2.2] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`SSIAA`.`Questionare_Workforce`, CONSTRAINT `Questionare-Workforce` FOREIGN KEY (`Questionare`) REFERENCES `Questionares` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)' in /Library/WebServer/EcoReality/a/nuBuilderPro-master/nuapi.php:788\nStack trace:\n#0 /Library/WebServer/EcoReality/a/nuBuilderPro-master/nuapi.php(788): PDO->exec('INSERT INTO `Qu...')\n#1 /Library/WebServer/EcoReality/a/nuBuilderPro-master/nuapi.php(675): nuGetNewPrimaryKey('Questionare_Wor...', 'ID')\n#2 /Library/WebServer/EcoReality/a/nuBuilderPro-master/nuapi.php(140): nuSaveForm(Array, Array)\n#3 {main}\n  thrown in /Library/WebServer/EcoReality/a/nuBuilderPro-master/nuapi.php on line 788, referer: ****************
I do have InnoDB constraints defined, and they work properly in tools like phpMyAdmin and Sequel Pro. They are handy in "bare metal tools" because they let you follow references easily.

I removed them, and things are saving properly. Odd, that.
Last edited by EcoReality on Thu Feb 23, 2017 9:06 am, edited 1 time in total.
:::: Jan Steinman EcoReality Co-op ::::
EcoReality
Posts: 26
Joined: Wed Feb 15, 2017 8:50 am
Location: Salt Spring Island, British Columbia, Canada
Contact:

Re: Subform never completes save

Unread post by EcoReality »

Are you doing something that would cause InnoDB constraint violations, like delete/add instead of UPDATE?

I can do the functionally identical INSERTs and UPDATEs with the constraints in place.

Unless I had a problem in my constraints, I consider this a bug. InnoDB is pretty strict about setting up relations. I don't think I had a problem there.

In any event, stripping all constraints out of the data model allows nuBuilder to work. But it should be able to work with proper InnoDB constraints in place; they are actually useful!
:::: Jan Steinman EcoReality Co-op ::::
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform never completes save

Unread post by admin »

Jan,

If constraints are used in your DB it will break.

nuBuilder will just use the tables and handle validation its self.

Steven
EcoReality
Posts: 26
Joined: Wed Feb 15, 2017 8:50 am
Location: Salt Spring Island, British Columbia, Canada
Contact:

Re: Subform never completes save

Unread post by EcoReality »

admin wrote:If constraints are used in your DB it will break.
Are there any work-arounds? Can we keep InnoDB relations if we set the constraint to NULL?

Are there any plans to fix this bug? Would you like some help? I've done many years of PHP...

This seems like a huge issue to me. Anytime I have a foreign key, I use InnoDB relationships. It guarantees referential integrity. Many, many third-party tools (DB diagrammers, code analyzers, etc.) are dependent on InnoDB relationships. For example, Querious (https://www.araelium.com/querious/) will draw me a complete, FK-linked entity-relationship diagram with InnoDB relationships, but it only shows a bunch of isolated tables without.

You have an awesome tool, and I realize it is designed primarily to meet your consulting needs. Please consider how properly supporting InnoDB relationships might extend your own use of this tool!
:::: Jan Steinman EcoReality Co-op ::::
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform never completes save

Unread post by admin »

Jan,

If you use any type of constraint, you are on your own.

Steven
Post Reply