Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
===PDO MESSAGE===
SQLSTATE[HY000]: General error: 1364 Field 'field01' doesn't have a default value
===SQL===========
INSERT INTO test (test_id, `field00`, `field02`) VALUES ('5ebbf910018af47', '1', '2.00');
This is right because all fields in the mysql (mariadb) are marked no null and no default.
Is there a changed behavior how empty fields are treated / inserted into a database ? Do I need to initialize all fields on creation to some kind of default , even empty value ?
kev1n wrote:Do you get the same error when executing the same SQL directly in phpMyAdmin ?
Yes - the error is correct. The DB-Server runs in strict mode (default for mysql / mariadb) the table is created (automatically by creating a test fast form within nubuilder) with "NO DEFAULT" and "NOT NULL" no explicit default values here. If I now create a new record and just leave a filed blank, the SQL query don't set the field which must lead to an SQL Error.
You need to click on change and set the default to NULL for each column but the primary key.
The problem is that Fast Form doesn't set DEFAULT NULL when creating the table.
I modified the function nuBuildNewTable() in nubuilders.php so that DEFAULT NULL is set for each field.
You can exchange the original file with the one in the zip archive.
This means when you create other froms/tables with Fast Forms, default null is set.
You do not have the required permissions to view the files attached to this post.
kev1n wrote:You need to click on change and set the default to NULL for each column but the primary key.
The problem is that Fast Form doesn't set DEFAULT NULL when creating the table.
I know it's possible to change the settings, but wouldn't it better if the creation of the Table would take care of this. Maybe it wasn't an issue until now but later Versions of mariadb enable strict mode by default. This wasn't the case in earlier Versions. Maybe nuBuilder should set up Tables with proper default settings now.
I will try to disable strict mode - this should also help.
hagie wrote:
I know it's possible to change the settings, but wouldn't it better if the creation of the Table would take care of this. Maybe it wasn't an issue until now but later Versions of mariadb enable strict mode by default. This wasn't the case in earlier Versions. Maybe nuBuilder should set up Tables with proper default settings now.
I know it's possible to change the settings, but wouldn't it better if the creation of the Table would take care of this. Maybe it wasn't an issue until now but later Versions of mariadb enable strict mode by default. This wasn't the case in earlier Versions. Maybe nuBuilder should set up Tables with proper default settings now.
Looks like it was solved almost 2 years ago but why is it reoccurring ? And who is Admin
Sorry for cause you extra work ..
P.S: Maybe Nubuilder should check the variable on the Database Server and Display a warning for those who try to build upon old Databases / Tables , even if new one now created with working default / empty flag.