Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks are not creating #1

Open
pmarcis opened this issue Nov 22, 2014 · 2 comments
Open

Tasks are not creating #1

pmarcis opened this issue Nov 22, 2014 · 2 comments
Assignees

Comments

@pmarcis
Copy link

pmarcis commented Nov 22, 2014

Hi,

You have in your code:

$res = safe_query("INSERT INTO task (name,owner) VALUES ('_NEW_','".$mysession['userid']."');");

The task table, however, requires NOT NULL values for descr, instructions, ranges. Also, the task name here is a default one - _NEW_.

It seems that tasks cannot be created.

I get an exception from MySQL:

Query failed:
errorno=1364
error=Field 'descr' doesn't have a default value
query=INSERT INTO task (name,owner) VALUES ('_NEW_','0');
@pmarcis
Copy link
Author

pmarcis commented Nov 22, 2014

I changed the line to:

$res = safe_query("INSERT INTO task (name,type,descr,instructions,ranges,owner) VALUES ('".$taskinfo["name"]."','".$taskinfo["type"]."','".$taskinfo["descr"]."','".$taskinfo["instructions"]."','".$taskinfo["ranges"]."','".$mysession['userid']."');");

Seems to be working, but I am not sure whether it is supposed to work with these parameters.

@cgirardi cgirardi self-assigned this Nov 24, 2014
@pmarcis
Copy link
Author

pmarcis commented Nov 27, 2014

This issue was due to MySQL 5.6 (starting from) having sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES as the default parameter. That means that non-strict behaviour was not allowed. However, I would encourage writing queries that are compliant with SQL table definitions nonetheless (makes support easier as well, because you won't have to troubleshoot issues that could have been avoided).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants