mysql1_dart
mysql1_dart copied to clipboard
Return value varies depending on whether column is auto_increment
I changed the create table text on my table and got an unexpected result.
Here is the original (with auto_increment) :
CREATE TABLE task_item ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, task_id INTEGER UNSIGNED NOT NULL , item_description VARCHAR(30) CHARACTER SET ascii NOT NULL , item_complete TINYINT(1) UNSIGNED NOT NULL ,CONSTRAINT id UNIQUE (id) ,CONSTRAINT task_id UNIQUE (task_id,item_description))
Here is what I changed it to :
CREATE TABLE task_item ( id INTEGER UNSIGNED NOT NULL , task_id INTEGER UNSIGNED NOT NULL , item_description VARCHAR(30) CHARACTER SET ascii NOT NULL , item_complete TINYINT(1) UNSIGNED NOT NULL ,CONSTRAINT id UNIQUE (id) ,CONSTRAINT task_id UNIQUE (task_id,item_description))
Then, I performed an insert on the table :
INSERT INTO task_item ( id, task_id, item_description, item_complete ) VALUES ( 1, 1, 'Walk to shops', 0 );
When the table had auto_increment in the create table the query call has a return value of 1 (what I expected). When I removed the auto_increment from the create table, now the query call returns 0.
Is this to be expected ?
The thing to do is to see if the behaviour is different from using mysql a different way (e.g. from the command line).
Is there a way to see the return value on the command line ?