Page 1 of 1

Subform never completes save

Posted: Thu Feb 23, 2017 2:13 am
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?

Re: Subform never completes save

Posted: Thu Feb 23, 2017 4:13 am
by admin
Jan,

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

Steven

Re: Subform never completes save

Posted: Thu Feb 23, 2017 7:52 am
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.

Re: Subform never completes save

Posted: Thu Feb 23, 2017 9:03 am
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!

Re: Subform never completes save

Posted: Sat Feb 25, 2017 12:09 am
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

Re: Subform never completes save

Posted: Sun Mar 19, 2017 5:32 pm
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!

Re: Subform never completes save

Posted: Fri Mar 31, 2017 6:37 am
by admin
Jan,

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

Steven