Error in Insert SQL in demo


#1

In trying to run the CRUD full editing example, I get this when trying to add a new value:

Fatal Error
atk4\dsql\Exception: DSQL got Exception when executing this query
Exception Parameters
error: "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null"
query: "insert into `country` (`id`,`nicename`,`name`,`iso`,`iso3`,`numcode`,`phonecode`) values (NULL,'GE','GE','GE','GEK','GE2',6969)"
Stack Trace
File	Object	Method
w/ui/vendor/atk4/dsql/src/Expression.php: 563	atk4\dsql\Exception	atk4\core\Exception::__construct()
vendor/atk4/data/src/Persistence_SQL.php: 773	atk4\dsql\Query_MySQL	atk4\dsql\Expression::execute()

It is best to NOT include the id field so that the auto-increment can set its own value.


#2

If the ID field is defined as “id not null primary key auto_increment” then it works just fine. If you are using MySQL Workbench you have forgotten to tick that checkbox, I’ve done that many times myself.


#3

This happened in your online demo


#4

oh, which one :slight_smile:


#5

“the CRUD full editing example”


#6

please provide a full link, :slight_smile: I have stuff all over the place …