Set default value for Not Null Column in CRE.sql#3
Set default value for Not Null Column in CRE.sql#3revsi wants to merge 1 commit intonihavi:masterfrom revsi:patch-1
Conversation
|
Thanks for the PR! This seems weird. CRE.sql has ALTER TABLE `candidates`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;and then the insert code in $query = mysqli_prepare($DB, "INSERT INTO `candidates` (name) VALUES (?)");
mysqli_stmt_bind_param($query, 's', $_POST["candidate_name"]);We only set |
polybuildr
left a comment
There was a problem hiding this comment.
Aha, so it does default to 0. Thanks @hharchani.
@revsi, can you please update the commit message to match convention? Capital first letter, imperative tense of writing, etc.? Also, since @hharchani says it implicitly defaults to 0, maybe you can explicitly say: "Set default value of some fields in CRE.sql" or something like that?
|
Yeah, it defaults to 0, but better to be explicit |
|
I am not sure exactly. But for MySql V5.7, If strict SQL mode is enabled, an error occurs for transactional tables and the statement is rolled back in case of Not Null Column. In my case it was causing error. |
polybuildr
left a comment
There was a problem hiding this comment.
Ah, I see. That's interesting. It's certainly better to be explicit then. Will merge this after the commit message change. :)
Sorry, you changed the PR title but not the commit itself. Could you please git commit --amend and update the commit message too?
No description provided.